From f07d798fcf8116a96974cb81d317b2412ac48848 Mon Sep 17 00:00:00 2001 From: Mikhail Diatchenko Date: Thu, 7 Jul 2022 08:26:00 +1200 Subject: [PATCH 1/2] Fixed set method not ignoring invalid state --- components/state_machine/state_machine.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/components/state_machine/state_machine.cpp b/components/state_machine/state_machine.cpp index 595d468..dcbf99a 100644 --- a/components/state_machine/state_machine.cpp +++ b/components/state_machine/state_machine.cpp @@ -81,6 +81,7 @@ namespace esphome if (std::find(this->states_.begin(), this->states_.end(), state) == this->states_.end()) { ESP_LOGE(TAG, "Invalid state: %s", state.c_str()); + return; } if (state != this->current_state_) From 909bbe01f14e3c5b3896829aaa657510dd29f4ba Mon Sep 17 00:00:00 2001 From: Mikhail Diatchenko Date: Fri, 8 Jul 2022 09:01:41 +1200 Subject: [PATCH 2/2] Changed text sensor icon to state machine --- components/state_machine/text_sensor/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/state_machine/text_sensor/__init__.py b/components/state_machine/text_sensor/__init__.py index 38ac7e2..80bc628 100644 --- a/components/state_machine/text_sensor/__init__.py +++ b/components/state_machine/text_sensor/__init__.py @@ -20,7 +20,9 @@ "StateMachineTextSensor", text_sensor.TextSensor, cg.Component ) -CONFIG_SCHEMA = text_sensor.TEXT_SENSOR_SCHEMA.extend( +CONFIG_SCHEMA = text_sensor.text_sensor_schema( + icon="mdi:state-machine", +).extend( { cv.GenerateID(): cv.declare_id(StateMachineTextSensor), }