Skip to content

Commit

Permalink
MQTTPublisher: change disinfection topic data type from bool (on/off)…
Browse files Browse the repository at this point in the history
… to int (hours)
  • Loading branch information
jnsbyr committed Aug 4, 2023
1 parent a48b360 commit 37c6a29
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions MQTTPublisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ void MQTTPublisher::loop()

if (pureSpaIO.getModel() == PureSpaIO::MODEL::SJBHS)
{
publishIfDefined(MQTT_TOPIC::DISINFECTION, pureSpaIO.isDisinfectionOn(), PureSpaIO::UNDEF::BOOL);
publishIfDefined(MQTT_TOPIC::JET, pureSpaIO.isJetOn(), PureSpaIO::UNDEF::BOOL);
publishIfDefined(MQTT_TOPIC::DISINFECTION, pureSpaIO.isDisinfectionOn()? pureSpaIO.getDisinfectionTime() : 0, (int)PureSpaIO::UNDEF::USHORT);
publishIfDefined(MQTT_TOPIC::JET, pureSpaIO.isJetOn(), PureSpaIO::UNDEF::BOOL);
}

bool b = pureSpaIO.isHeaterOn();
Expand All @@ -147,16 +147,16 @@ void MQTTPublisher::loop()
publishIfDefined("pool/telegram/led", pureSpaIO.getRawLedValue(), PureSpaIO::UNDEF::USHORT);
#endif

uint32 errorVal = pureSpaIO.getErrorValue();
if (errorVal == 0)
String errorCode = pureSpaIO.getErrorCode();
if (errorCode.length())
{
mqttClient.publish(MQTT_TOPIC::STATE, "online", retainAll, forcedStateUpdate);
mqttClient.publish(MQTT_TOPIC::STATE, "error", retainAll, forcedStateUpdate);
}
else
{
mqttClient.publish(MQTT_TOPIC::STATE, "error", retainAll, forcedStateUpdate);
mqttClient.publish(MQTT_TOPIC::STATE, "online", retainAll, forcedStateUpdate);
}
mqttClient.publish(MQTT_TOPIC::ERROR, pureSpaIO.getErrorMessage(errorVal).c_str(), retainAll);
mqttClient.publish(MQTT_TOPIC::ERROR, pureSpaIO.getErrorMessage(errorCode).c_str(), retainAll);
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,13 @@ Prepare your MQTT server for a new device.
Topic | Values | Unit | Notes
------------------ |:----------------------:|:----:| -----------------------------------
pool/bubble | on\|off | |
pool/disinfection | on\|off | | SJB-HS only, experimental
pool/disinfection | 0\|3\|5\|8 | h | SJB-HS only, 0 h = off
pool/filter | on\|off | |
pool/heater | on\|standby\|off | |
pool/jet | on\|off | | SJB-HS only
pool/power | on\|off | |
pool/water/tempAct | int | °C |
pool/water/tempSet | int | °C |
pool/water/tempSet | int | °C | -99 °C at power up until set
pool/error | string | | error message (see manual) or empty
pool/model | string | | metadata
wifi/rssi | int | dBm |
Expand Down
2 changes: 1 addition & 1 deletion common.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

namespace CONFIG
{
const char WIFI_VERSION[] = "1.0.4.0"; // 18.06.2023
const char WIFI_VERSION[] = "1.0.5.0"; // 18.06.2023

// WiFi parameters
const unsigned long WIFI_MAX_DISCONNECT_DURATION = 900000; // [ms] 5 min until reboot
Expand Down

0 comments on commit 37c6a29

Please sign in to comment.