1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-01 19:02:18 +01:00

[binary_sensor] Add action to invalidate state and pass to HA (#8961)

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Clyde Stubbs
2025-06-12 09:16:20 +10:00
committed by GitHub
parent 0228379a2e
commit 261b561bb2
27 changed files with 250 additions and 115 deletions

View File

@@ -0,0 +1,15 @@
binary_sensor:
- platform: template
trigger_on_initial_state: true
id: some_binary_sensor
name: "Random binary"
lambda: return (random_uint32() & 1) == 0;
on_state_change:
then:
- logger.log:
format: "Old state was %s"
args: ['x_previous.has_value() ? ONOFF(x_previous) : "Unknown"']
- logger.log:
format: "New state is %s"
args: ['x.has_value() ? ONOFF(x) : "Unknown"']
- binary_sensor.invalidate_state: some_binary_sensor

View File

@@ -0,0 +1,2 @@
packages:
common: !include common.yaml

View File

@@ -0,0 +1,2 @@
packages:
common: !include common.yaml

View File

@@ -0,0 +1,2 @@
packages:
common: !include common.yaml

View File

@@ -0,0 +1,2 @@
packages:
common: !include common.yaml

View File

@@ -0,0 +1,2 @@
packages:
common: !include common.yaml

View File

@@ -0,0 +1,2 @@
packages:
common: !include common.yaml

View File

@@ -0,0 +1,2 @@
packages:
common: !include common.yaml

View File

@@ -0,0 +1,2 @@
packages:
common: !include common.yaml

View File

@@ -63,7 +63,7 @@ binary_sensor:
id: lvgl_pressbutton
name: Pressbutton
widget: spin_up
publish_initial_state: true
trigger_on_initial_state: true
- platform: lvgl
name: ButtonMatrix button
widget: button_a