mirror of https://github.com/arendst/Tasmota.git
Add domoticz support to SR04
Add domoticz support to sensor SR04 (#4325)
This commit is contained in:
parent
9f09b6179c
commit
72dede855a
|
@ -136,6 +136,11 @@ void Sr04Show(boolean json)
|
|||
if (Sr04Read(&distance)) { // Check if read failed
|
||||
if(json) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"SR04\":{\"" D_JSON_DISTANCE "\":%d}"), mqtt_data, distance);
|
||||
#ifdef USE_DOMOTICZ
|
||||
if (0 == tele_period) {
|
||||
DomoticzSensor(DZ_COUNT, distance); // Send distance as Domoticz Counter value
|
||||
}
|
||||
#endif // USE_DOMOTICZ
|
||||
#ifdef USE_WEBSERVER
|
||||
} else {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_DISTANCE, mqtt_data, distance);
|
||||
|
|
Loading…
Reference in New Issue