Fix output state "on" not being recognised

This commit is contained in:
fvanroie 2022-01-31 00:06:41 +01:00
parent 152d366822
commit be62ae46bb

View File

@ -242,8 +242,8 @@ static void dispatch_output(const char* topic, const char* payload)
JsonVariant brightness = json[F("brightness")]; JsonVariant brightness = json[F("brightness")];
// Check if the state needs to change // Check if the state needs to change
if(!state.isNull() && power_state != state.as<bool>()) { if(!state.isNull() && power_state != Parser::is_true(state.as<const char*>())) {
power_state = state.as<bool>(); power_state = Parser::is_true(state.as<const char*>());
updated = true; updated = true;
} }
@ -257,7 +257,7 @@ static void dispatch_output(const char* topic, const char* payload)
// Set new state // Set new state
if(updated && gpio_set_pin_state(pin, power_state, state_value)) { if(updated && gpio_set_pin_state(pin, power_state, state_value)) {
return; // value was set and state output already return; // value was set and state output already in gpio_set_pin_state
} else { } else {
// output the new state to the log // output the new state to the log
} }