@@ -673,9 +673,17 @@ bool ws_sdcard::ParseI2cDeviceAddReplace(
673
673
msg_i2c_add.i2c_device_sensor_types_count = 0 ;
674
674
for (JsonObject components_0_i2cDeviceSensorType :
675
675
component[" i2cDeviceSensorTypes" ].as <JsonArray>()) {
676
- msg_i2c_add
677
- .i2c_device_sensor_types [msg_i2c_add.i2c_device_sensor_types_count ] =
678
- ParseSensorType (components_0_i2cDeviceSensorType[" type" ]);
676
+ if (components_0_i2cDeviceSensorType[" type" ].is <JsonString>()) {
677
+ msg_i2c_add
678
+ .i2c_device_sensor_types [msg_i2c_add.i2c_device_sensor_types_count ] =
679
+ ParseSensorType (components_0_i2cDeviceSensorType[" type" ]);
680
+ } else {
681
+ msg_i2c_add
682
+ .i2c_device_sensor_types [msg_i2c_add.i2c_device_sensor_types_count ] =
683
+ ParseSensorType (
684
+ components_0_i2cDeviceSensorType[" type" ][" sensorType" ] |
685
+ " UNSPECIFIED" );
686
+ }
679
687
msg_i2c_add.i2c_device_sensor_types_count ++;
680
688
}
681
689
@@ -997,7 +1005,11 @@ bool ws_sdcard::ParseComponents(JsonArray &components) {
997
1005
msg_signal_b2d.payload .ds18x20_add = msg_add;
998
1006
}
999
1007
} else if (strcmp (component_api_type, " i2c" ) == 0 ) {
1000
- WS_DEBUG_PRINTLN (" [SD] I2C component found in cfg" );
1008
+ WS_DEBUG_PRINT (" [SD] I2C component (" );
1009
+ WS_DEBUG_PRINT (component[" name" ] | UNKNOWN_VALUE);
1010
+ WS_DEBUG_PRINT (" @ " );
1011
+ WS_DEBUG_PRINT (component[" i2cDeviceAddress" ] | " 0x??" );
1012
+ WS_DEBUG_PRINTLN (" ) found in cfg" );
1001
1013
// Init for use=yes || use=auto
1002
1014
wippersnapper_i2c_I2cDeviceAddOrReplace msg_add =
1003
1015
wippersnapper_i2c_I2cDeviceAddOrReplace_init_default;
0 commit comments