Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DISC] Nexa additional auto-discovery properties (#1953) #1955

Merged
merged 3 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions main/ZgatewayRTL_433.ino
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,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
"" //State Class
);
} else if (strcmp(parameters[i][0], "state") == 0 && (strcmp(pdevice->modelName, "Nexa-Security") == 0 || strcmp(pdevice->modelName, "Brennenstuhl-RCS2044") == 0 || strcmp(pdevice->modelName, "Proove-Security") == 0 || strcmp(pdevice->modelName, "Waveman-Switch") == 0)) {
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,
"ON", "OFF", parameters[i][2], //set,payload_on,payload_off,unit_of_meas,
0, //set off_delay
"", "", false, "", //set,payload_available,payload_not available ,is a gateway entity, command topic
(char*)idWoKey.c_str(), "", pdevice->modelName, (char*)idWoKey.c_str(), false, // device name, device manufacturer, device model, device ID, retain
"" //State Class
);
} else if (strcmp(parameters[i][0], "strike_count") == 0) {
createDiscovery("sensor", //set Type
(char*)topic.c_str(), parameters[i][1], pdevice->uniqueId, //set state_topic,name,uniqueId
Expand Down
75 changes: 39 additions & 36 deletions main/config_RF.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,56 +80,59 @@ struct RTL_433device {
bool isDisc;
};

const char parameters[50][4][24] = {
const char parameters[53][4][24] = {
// RTL_433 key, name, unit, device_class
{"temperature_C", "temperature", "°C", "temperature"},
{"temperature_1_C", "temperature", "°C", "temperature"},
{"temperature_2_C", "temperature", "°C", "temperature"},
{"temperature_F", "temperature", "°F", "temperature"},
{"time", "timestamp", "", "timestamp"},
{"battery_ok", "battery", "%", "battery"},
{"alarm", "alarm", "", ""},
{"battery_mV", "battery", "mV", "voltage"},
{"battery_ok", "battery", "%", "battery"},
{"co2_ppm", "Carbon Dioxide", "ppm", "carbon_dioxide"},
{"depth_cm", "depth", "cm", "distance"},
{"estimated_pm10_0_ug_m3", "estimated PM10", "μg/m³", "pm10"},
{"event", "Status", "", "moisture"},
{"group", "Group", "", ""},
{"gust_speed_km_h", "gust speed", "km/h", "wind_speed"},
{"gust_speed_m_s", "gust speed", "m/s", "wind_speed"},
{"humidity", "humidity", "%", "humidity"},
{"light_lux", "light", "lx", "illuminance"},
{"lux", "lux", "lx", "illuminance"},
{"moisture", "moisture", "%", "humidity"},
{"motion", "motion", "", "motion"},
{"noise", "noise", "dB", "sound_pressure"},
{"pm1_ug_m3", "PM1", "μg/m³", "pm1"},
{"pm10_ug_m3", "PM10", "μg/m³", "pm10"},
{"pm2_5_ug_m3", "PM2.5", "μg/m³", "pm25"},
{"power_W", "power", "W", "power"},
{"pressure_hPa", "pressure", "hPa", "pressure"},
{"pressure_kPa", "pressure", "kPa", "pressure"},
{"wind_speed_km_h", "wind speed", "km/h", "wind_speed"},
{"wind_avg_km_h", "wind average", "km/h", "wind_speed"},
{"wind_avg_mi_h", "wind average", "mi/h", "wind_speed"},
{"wind_avg_m_s", "wind average", "m/s", "wind_speed"},
{"wind_speed_m_s", "wind speed", "m/s", "wind_speed"},
{"gust_speed_km_h", "gust speed", "km/h", "wind_speed"},
{"wind_max_km_h", "wind max", "km/h", "wind_speed"},
{"wind_max_m_s", "wind max", "m/s", "wind_speed"},
{"gust_speed_m_s", "gust speed", "m/s", "wind_speed"},
{"wind_dir_deg", "wind direction", "°", ""},
{"rain_mm", "rain", "mm", "precipitation"},
{"rain_rate_mm_h", "rain", "mm/h", "precipitation_intensity"},
{"rain_in", "rain", "in", "precipitation"},
{"rain_mm", "rain", "mm", "precipitation"},
{"rain_rate_in_h", "rain", "in/h", "precipitation_intensity"},
{"rain_rate_mm_h", "rain", "mm/h", "precipitation_intensity"},
{"rssi", "rssi", "dB", "signal_strength"},
{"snr", "snr", "dB", ""},
{"noise", "noise", "dB", "sound_pressure"},
{"depth_cm", "depth", "cm", "distance"},
{"power_W", "power", "W", "power"},
{"light_lux", "light", "lx", "illuminance"},
{"lux", "lux", "lx", "illuminance"},
{"uvi", "UVI", "UV index", ""},
{"uv", "UV", "UV level", ""},
{"storm_dist", "storm distance", "mi", "distance"},
{"state", "State", "", ""},
{"storm_dist_km", "storm distance", "km", "distance"},
{"storm_dist", "storm distance", "mi", "distance"},
{"strike_count", "strike count", "", ""}, // from rtl_433_mqtt_hass.py
{"strike_distance", "strike distance", "mi", "distance"},
{"strike_distance_km", "strike distance", "km", "distance"},
{"co2_ppm", "Carbon Dioxide", "ppm", "carbon_dioxide"},
{"pm2_5_ug_m3", "PM2.5", "μg/m³", "pm25"},
{"pm10_ug_m3", "PM10", "μg/m³", "pm10"},
{"estimated_pm10_0_ug_m3", "estimated PM10", "μg/m³", "pm10"},
{"pm1_ug_m3", "PM1", "μg/m³", "pm1"},
{"strike_distance", "strike distance", "mi", "distance"},
{"tamper", "tamper", "", ""},
{"alarm", "alarm", "", ""},
{"motion", "motion", "", "motion"},
{"event", "Status", "", "moisture"}};
{"temperature_1_C", "temperature", "°C", "temperature"},
{"temperature_2_C", "temperature", "°C", "temperature"},
{"temperature_C", "temperature", "°C", "temperature"},
{"temperature_F", "temperature", "°F", "temperature"},
{"time", "timestamp", "", "timestamp"},
{"unit", "Unit", "", ""},
{"uv", "UV", "UV level", ""},
{"uvi", "UVI", "UV index", ""},
{"wind_avg_km_h", "wind average", "km/h", "wind_speed"},
{"wind_avg_m_s", "wind average", "m/s", "wind_speed"},
{"wind_avg_mi_h", "wind average", "mi/h", "wind_speed"},
{"wind_dir_deg", "wind direction", "°", ""},
{"wind_max_km_h", "wind max", "km/h", "wind_speed"},
{"wind_max_m_s", "wind max", "m/s", "wind_speed"},
{"wind_speed_km_h", "wind speed", "km/h", "wind_speed"},
{"wind_speed_m_s", "wind speed", "m/s", "wind_speed"}};
# endif
# ifdef RTL_433_DISCOVERY_LOGGING
# define DISCOVERY_TRACE_LOG(...) Log.trace(__VA_ARGS__)
Expand Down
Loading