diff --git a/main/ZgatewayRTL_433.ino b/main/ZgatewayRTL_433.ino index 197eef7..a2094a7 100644 --- a/main/ZgatewayRTL_433.ino +++ b/main/ZgatewayRTL_433.ino @@ -161,6 +161,16 @@ void launchRTL_433Discovery(bool overrideDiscovery) { (char*)idWoKey.c_str(), "", pdevice->modelName, (char*)idWoKey.c_str(), false, // device name, device manufacturer, device model, device ID, retain stateClassTotalIncreasing //State Class ); + } else if (strcmp(parameters[i][0], "event") == 0 && strcmp(pdevice->modelName, "Govee-Water") == 0) { //the entity will detect Water Leak Event and go back to Off state after 60seconds + createDiscovery("binary_sensor", //set Type + (char*)topic.c_str(), parameters[i][1], pdevice->uniqueId, //set state_topic,name,uniqueId + "", parameters[i][3], (char*)value_template.c_str(), //set availability_topic,device_class,value_template, + "Water Leak", "", parameters[i][2], //set,payload_on,payload_off,unit_of_meas, + 60, //set off_delay + "", "", false, "", //set,payload_available,payload_not available ,is a gateway entity, command topic + (char*)idWoKey.c_str(), "Govee", pdevice->modelName, (char*)idWoKey.c_str(), false, // device name, device manufacturer, device model, device ID, retain + stateClassMeasurement //State Class + ); } else { createDiscovery("sensor", //set Type (char*)topic.c_str(), parameters[i][1], pdevice->uniqueId, //set state_topic,name,uniqueId diff --git a/main/config_RF.h b/main/config_RF.h index 587519e..a692a57 100644 --- a/main/config_RF.h +++ b/main/config_RF.h @@ -82,7 +82,7 @@ struct RTL_433device { extern std::vector RTL_433devices; -const char parameters[39][4][24] = { +const char parameters[40][4][24] = { // RTL_433 key, name, unit, device_class {"temperature_C", "temperature", "°C", "temperature"}, {"temperature_1_C", "temperature", "°C", "temperature"}, @@ -122,7 +122,8 @@ const char parameters[39][4][24] = { {"tamper", "tamper", "", ""}, {"alarm", "alarm", "", ""}, {"motion", "motion", "", "motion"}, - {"strike_count", "strike count", "", ""}}; // from rtl_433_mqtt_hass.py + {"strike_count", "strike count", "", ""}, // from rtl_433_mqtt_hass.py + {"event", "Status", "", "moisture"}}; # endif #endif /*-------------------RF topics & parameters----------------------*/