Hello, it is few weeks that sometime when I reboot HASS, some specific light turn on.
I dig into the log and I noticed that only the light attached with a shelly 1 switch have this behaviour.
I changed the internal settings of the shelly to be a detachable switch so when a user presses the physical button nothing happens, it just changes the internal state of the shelly. Then I exploited this to create an automation so whenever a user presses the physical button it can turn on the light or do whatever the automation said to do.
So I created this automation:
alias: Shelly luce camera input
description: Accende e spegne il gruppo camera basandosi sul detached switch mode di Shelly
trigger:
- platform: state
entity_id:
- binary_sensor.bedroom_switch_outlet_input
from: null
to: null
condition:
- condition: not
conditions:
- condition: state
entity_id: binary_sensor.bedroom_switch_outlet_input
state: unavailable
action:
- if:
- condition: state
state: "on"
entity_id: light.bedroom_lights_headboard_group
then:
- service: light.turn_off
data: {}
target:
entity_id: light.bedroom_lights_headboard_group
else:
- if:
- condition: state
state: "off"
entity_id: light.bedroom_lights_headboard_group
then:
- service: light.turn_on
data:
kelvin: 6500
brightness_pct: 100
target:
entity_id: light.bedroom_lights_headboard_group
mode: single
Can somebody help?
It happens a lot lately that during the night the lights turn on… I also noticed that when my internet connection goes offline and then come back it happens…
Its the automation but dont know how to fix
alias: Shelly luce camera input
description: Accende e spegne il gruppo camera basandosi sul detached switch mode di Shelly
trigger:
- id: '100'
platform: state
entity_id:
- binary_sensor.bedroom_switch_outlet_input
not_from: 'unavailable'
to: 'on'
- id: '0'
platform: state
entity_id:
- binary_sensor.bedroom_switch_outlet_input
not_from: 'unavailable'
to: 'off'
condition: []
action:
- service: light.turn_on
data:
kelvin: 6500
brightness_pct: '{{ trigger.id }}'
target:
entity_id: light.bedroom_lights_headboard_group
mode: single
I noticed an error. If I turn off the light from the app and then press the physical switch It won’t turn on and I have to press it again to turn it on.
How can it be fixed?
It switches between clear and detected but when turn on/off the light from the HA app it doesnt switch the status of the bedroom_switch_outlet_input
I explain myself a bit bad sorry
No its related to the automation because its check the value of the switch and not if the light is on or off like it was before in my automation.
if light on and switch changes state light goes off and viceversa. But Im not sure how to do that.
Maybe something like that?