I added support for multiple (16 currently) 1-wire temperature sensor in this great code. It's work's fine but before i can make a merge request i need to understand how to inform zigbee2mqtt that devise have multiple sensors.
I can add use the same idea of how current sensors/peripherals are defined in zcl_zigup.c but it causes a problem when a new sensor is added and sensor order will be chances
Example there is 3 sensor and zigup sending to zigbee2mqtt following message:
'{
"state":"OFF",
"cpu_temperature":23.98,
"external_temperature_1":21.4, // device 4D000004D0DC8328
"external_temperature_1":22.4, // device B1000004D01FBF28
"external_temperature_3":23.4, // device C000004D03CA328
"external_temperature_4":-1000,
"external_temperature_5":-1000,
...
"external_temperature_16":-1000,
"external_humidity":null,
"s0_counts":0,
"adc_volt":32.354,
"dig_input":1,
"reason":"timer",
"linkquality":23
}'
and when we add one new sensor (4 total) then important part would be:
"external_temperature_1":21.4, // device 4D000004D0DC8328
"external_temperature_2":24.4, // device A1000004D05ABF28
"external_temperature_3":22.4, // device B1000004D01FBF28
"external_temperature_4":23.4, // device C000004D03CA328
"external_temperature_5":-1000,
so sensor order what you see in zigbee2mqtt is mixed (old sensor_2 is now sensor 3)
One way to solve this is to send sensor id and temperature at the same time like this:
"4D000004D0DC8328":21.4,
"B1000004D01FBF28":22.4,
and if zigbee2mqtt do not support dynamically added devices then send dummy code for sensor what aren't connected like "0000000000000000":-1000.
As you see, i don't really know how to proceed and i would appreciate every guide/hint what you can give me to make code nice and compatible with zigbee2mqtt philosophy.
Hello,
I added support for multiple (16 currently) 1-wire temperature sensor in this great code. It's work's fine but before i can make a merge request i need to understand how to inform zigbee2mqtt that devise have multiple sensors.
I can add use the same idea of how current sensors/peripherals are defined in zcl_zigup.c but it causes a problem when a new sensor is added and sensor order will be chances
Example there is 3 sensor and zigup sending to zigbee2mqtt following message: '{ "state":"OFF", "cpu_temperature":23.98, "external_temperature_1":21.4, // device 4D000004D0DC8328 "external_temperature_1":22.4, // device B1000004D01FBF28 "external_temperature_3":23.4, // device C000004D03CA328 "external_temperature_4":-1000, "external_temperature_5":-1000, ... "external_temperature_16":-1000, "external_humidity":null, "s0_counts":0, "adc_volt":32.354, "dig_input":1, "reason":"timer", "linkquality":23 }'
and when we add one new sensor (4 total) then important part would be: "external_temperature_1":21.4, // device 4D000004D0DC8328 "external_temperature_2":24.4, // device A1000004D05ABF28 "external_temperature_3":22.4, // device B1000004D01FBF28 "external_temperature_4":23.4, // device C000004D03CA328 "external_temperature_5":-1000,
so sensor order what you see in zigbee2mqtt is mixed (old sensor_2 is now sensor 3)
One way to solve this is to send sensor id and temperature at the same time like this: "4D000004D0DC8328":21.4, "B1000004D01FBF28":22.4,
and if zigbee2mqtt do not support dynamically added devices then send dummy code for sensor what aren't connected like "0000000000000000":-1000.
As you see, i don't really know how to proceed and i would appreciate every guide/hint what you can give me to make code nice and compatible with zigbee2mqtt philosophy.