|
@@ -532,9 +532,11 @@ try:
|
|
|
|
|
|
if sensorDataComplete:
|
|
|
|
|
|
+
|
|
|
+
|
|
|
if sensors_batteryState.get(id,None) == 2:
|
|
|
s_battNew = True
|
|
|
- s_battState = "NEW"
|
|
|
+ s_battState = "OK"
|
|
|
elif sensors_batteryState.get(id, None) == 1:
|
|
|
s_battNew = False
|
|
|
s_battState = "LOW"
|
|
@@ -542,6 +544,10 @@ try:
|
|
|
s_battNew = False
|
|
|
s_battState = "OK"
|
|
|
|
|
|
+ if s_battNew:
|
|
|
+ s_battNew_str = "YES"
|
|
|
+ else:
|
|
|
+ s_battNew_str = "NO"
|
|
|
|
|
|
if s_name is not None:
|
|
|
s_domIdx = sensors_yaml[s_name].get('DomoticzIdx', None)
|
|
@@ -568,6 +574,7 @@ try:
|
|
|
mqttc.publish(mqtt_topic_prefix+"/"+ s_name +"/temperature", str(s_currAvgTemp), qos=0, retain=False)
|
|
|
mqttc.publish(mqtt_topic_prefix+"/"+ s_name +"/humidity", str(s_currAvgHum), qos=0, retain=False)
|
|
|
mqttc.publish(mqtt_topic_prefix+"/"+ s_name +"/battery", s_battState, qos=0, retain=False)
|
|
|
+ mqttc.publish(mqtt_topic_prefix+"/"+ s_name +"/batteryNew", s_battNew_str, qos=0, retain=False)
|
|
|
mqttc.publish(mqtt_topic_prefix+"/"+ s_name +"/availability", "available", qos=0, retain=False)
|
|
|
mqttc.publish(mqtt_topic_prefix+"/"+ s_name +"/lastUpdate", strftime("%Y-%m-%d %H:%M:%S", localtime()), qos=0, retain=False)
|
|
|
|
|
@@ -666,6 +673,7 @@ try:
|
|
|
if s_battNew:
|
|
|
mqttc.publish(mqtt_topic_prefix+"/NewUnknownSensor/"+str(id)+"/temperature", str(s_currAvgTemp), qos=0, retain=False)
|
|
|
mqttc.publish(mqtt_topic_prefix+"/NewUnknownSensor/"+str(id)+"/humidity", str(s_currAvgHum), qos=0, retain=False)
|
|
|
+ mqttc.publish(mqtt_topic_prefix+"/UnknownSensor/"+str(id)+"/batteryNew", s_battNew_str, qos=0, retain=False)
|
|
|
else:
|
|
|
mqttc.publish(mqtt_topic_prefix+"/UnknownSensor/"+str(id)+"/temperature", str(s_currAvgTemp), qos=0, retain=False)
|
|
|
mqttc.publish(mqtt_topic_prefix+"/UnknownSensor/"+str(id)+"/humidity", str(s_currAvgHum), qos=0, retain=False)
|