Reboot lock on Hybrid failure and logging fix

This commit is contained in:
iranl
2025-01-05 12:50:20 +01:00
parent 850f7fcc8a
commit dbb58caf97
19 changed files with 400 additions and 343 deletions

View File

@@ -86,14 +86,14 @@ void NukiOfficial::onOfficialUpdateReceived(const char *topic, const char *value
memset(&str, 0, sizeof(str));
Log->println("Official Nuki change received");
Log->print(F("Topic: "));
Log->print(("Topic: "));
Log->println(topic);
Log->print(F("Value: "));
Log->print(("Value: "));
Log->println(value);
if(strcmp(topic, mqtt_topic_official_connected) == 0)
{
Log->print(F("Connected: "));
Log->print(("Connected: "));
Log->println((strcmp(value, "true") == 0 ? 1 : 0));
offConnected = (strcmp(value, "true") == 0 ? 1 : 0);
_publisher->publishBool(mqtt_topic_hybrid_state, offConnected, true);
@@ -102,12 +102,12 @@ void NukiOfficial::onOfficialUpdateReceived(const char *topic, const char *value
{
offState = atoi(value);
_statusUpdated = true;
Log->println(F("Lock: Updating status on Hybrid state change"));
Log->println(("Lock: Updating status on Hybrid state change"));
_publisher->publishBool(mqtt_topic_hybrid_state, offConnected, true);
NukiLock::lockstateToString((NukiLock::LockState)offState, str);
_publisher->publishString(mqtt_topic_lock_state, str, true);
Log->print(F("Lockstate: "));
Log->print(("Lockstate: "));
Log->println(str);
_offStateToPublish = (NukiLock::LockState)offState;
@@ -117,11 +117,11 @@ void NukiOfficial::onOfficialUpdateReceived(const char *topic, const char *value
{
offDoorsensorState = atoi(value);
_statusUpdated = true;
Log->println(F("Lock: Updating status on Hybrid door sensor state change"));
Log->println(("Lock: Updating status on Hybrid door sensor state change"));
_publisher->publishBool(mqtt_topic_lock_status_updated, _statusUpdated, true);
NukiLock::doorSensorStateToString((NukiLock::DoorSensorState)offDoorsensorState, str);
Log->print(F("Doorsensor state: "));
Log->print(("Doorsensor state: "));
Log->println(str);
_publisher->publishString(mqtt_topic_lock_door_sensor_state, str, true);
@@ -130,7 +130,7 @@ void NukiOfficial::onOfficialUpdateReceived(const char *topic, const char *value
{
offCritical = (strcmp(value, "true") == 0 ? 1 : 0);
Log->print(F("Battery critical: "));
Log->print(("Battery critical: "));
Log->println(offCritical);
if(!_disableNonJSON)
@@ -143,7 +143,7 @@ void NukiOfficial::onOfficialUpdateReceived(const char *topic, const char *value
{
offCharging = (strcmp(value, "true") == 0 ? 1 : 0);
Log->print(F("Battery charging: "));
Log->print(("Battery charging: "));
Log->println(offCharging);
if(!_disableNonJSON)
@@ -156,7 +156,7 @@ void NukiOfficial::onOfficialUpdateReceived(const char *topic, const char *value
{
offChargeState = atoi(value);
Log->print(F("Battery level: "));
Log->print(("Battery level: "));
Log->println(offChargeState);
if(!_disableNonJSON)