Skip to content

Commit

Permalink
Merge pull request #356 from Stormalong/mqtt_state_class
Browse files Browse the repository at this point in the history
Add MQTT state class
  • Loading branch information
sfeakes authored Oct 20, 2024
2 parents cbf6567 + 74b149a commit c1675b9
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions source/hassio.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -110,9 +109,6 @@ const char *HASSIO_SWG_DISCOVER = "{"
// (value-600) / (3450-600) * 100
// (value) / 100 * (3450-600) + 600


\

const char *HASSIO_VSP_DISCOVER = "{"
"\"device\": {" HASS_DEVICE "},"
"\"availability\": {" HASS_AVAILABILITY "},"
Expand Down Expand Up @@ -179,11 +175,11 @@ const char *HASSIO_TEMP_SENSOR_DISCOVER = "{"
"\"device\": {" HASS_DEVICE "},"
"\"availability\": {" HASS_AVAILABILITY "},"
"\"type\": \"sensor\","
"\"state_class\": \"measurement\","
"\"unique_id\": \"aqualinkd_%s\","
"\"name\": \"%s Temp\","
"\"state_topic\": \"%s/%s\","
"\"value_template\": \"{{ value_json }}\","
/*"\"unit_of_measurement\": \"°F\","*/
"\"unit_of_measurement\": \"%s\","
"\"device_class\": \"temperature\","
"\"icon\": \"%s\""
Expand All @@ -193,6 +189,7 @@ const char *HASSIO_SENSOR_DISCOVER = "{"
"\"device\": {" HASS_DEVICE "},"
"\"availability\": {" HASS_AVAILABILITY "},"
"\"type\": \"sensor\","
"\"state_class\": \"measurement\","
"\"unique_id\": \"aqualinkd_%s\","
"\"name\": \"%s\","
"\"state_topic\": \"%s/%s\","
Expand All @@ -218,6 +215,7 @@ const char *HASSIO_PUMP_SENSOR_DISCOVER = "{"
"\"device\": {" HASS_DEVICE "},"
"\"availability\": {" HASS_AVAILABILITY "},"
"\"type\": \"sensor\","
"\"state_class\": \"measurement\","
"\"unique_id\": \"aqualinkd_%s%d_%s\","
"\"name\": \"%s %s %s\","
"\"state_topic\": \"%s/%s%s\","
Expand All @@ -231,6 +229,7 @@ const char *HASSIO_PUMP_SENSOR_DISCOVER2 = "{"
"\"device\": {" HASS_DEVICE "},"
"\"availability\": {" HASS_AVAILABILITY "},"
"\"type\": \"sensor\","
"\"state_class\": \"measurement\","
"\"unique_id\": \"aqualinkd_%s%d_%s\","
"\"name\": \"%s %s %s\","
"\"state_topic\": \"%s/%s%s\","
Expand Down Expand Up @@ -477,13 +476,6 @@ void publish_mqtt_hassio_discover(struct aqualinkdata *aqdata, struct mg_connect
sprintf(msg, HASSIO_SWG_TEXT_SENSOR_DISCOVER,_aqconfig_.mqtt_aq_topic,idbuf,"SWG Msg",_aqconfig_.mqtt_aq_topic,SWG_EXTENDED_TOPIC);
sprintf(topic, "%s/sensor/aqualinkd/aqualinkd_%s/config", _aqconfig_.mqtt_hass_discover_topic, idbuf);
send_mqtt(nc, topic, msg);
/*
// SWG Display message (move to SWG area)
rsm_char_replace(idbuf, SWG_STATUS_MSG_TOPIC, "/", "_");
sprintf(msg, HASSIO_TEXT_SENSOR_DISCOVER,idbuf,"SWG Msg",_aqconfig_.mqtt_aq_topic,SWG_STATUS_MSG_TOPIC);
sprintf(topic, "%s/sensor/aqualinkd/aqualinkd_%s/config", _aqconfig_.mqtt_hass_discover_topic, idbuf);
send_mqtt(nc, topic, msg);
*/
}

// Temperatures
Expand Down

0 comments on commit c1675b9

Please sign in to comment.