Add domoticz support to SR04

Add domoticz support to sensor SR04 (#4325)
This commit is contained in:
Theo Arends 2018-11-11 13:21:46 +01:00
parent 9f09b6179c
commit 72dede855a
1 changed files with 5 additions and 0 deletions

View File

@ -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);