So, i would like to turn on the tv when there i walk in the living room. I can achieve by this by using a motion sensor, but the problem is, next time someone walks in the living room, it switches off due to the IR signals being the same.
If the signals are not the same, i could use Viera (panasonic viera is the tv) turn on, but it would send a IR signal every second or so (sounds like a bad idea). If i would set it to every 10 minutes, then obviously the automation would only run every 10 minutes and it would take a long time for it to turn on. So that is not an option either.
I tried doing: Check for motion (1sec) but only if no motion in the previous 10 minutes was detection as a condition. It sounded like it should work, and the automation was accepted, but it never triggered. And in hindsight, it makes sense. Obviously the first time it senses motion, then the condition is invalidated.
Sigh. So now i’m thinking how else could i construct this. I want the tv to turn on but only if no one is currently in the room.
what about creating a input_boolean which get turn on when the tv is turn on by IR and turn off when the tv is turn off
then you can add a condition to the motion sensor automation then the input_boolean switch must off TV can be turn on by IR
same sh logic as I did for my linen Cupboard
turn hall light off only if light off before I open it.
#=======================================================================
# Hall Light On Cupboard Open
#=======================================================================
- id: Hall Light On Cupboard Open
alias: Hall Light On Cupboard/linen Open
initial_state: true
trigger:
- entity_id:
- binary_sensor.linen_door
platform: state
to: 'on'
condition:
- condition: state
entity_id: light.hallway
state: 'off'
- condition: state
entity_id: sensor.day_night
state: Night
action:
- data:
entity_id: light.hallway
service: light.turn_on
- data:
entity_id: input_boolean.hall_light
service: input_boolean.turn_on
#=======================================================================
#=======================================================================
- id: Hall Light OFF Cupboard Closed
alias: Hall Light Off Cupboard/linen Closed
initial_state: true
trigger:
- entity_id:
- binary_sensor.linen_door
platform: state
to: 'off'
condition:
- condition: state
entity_id: input_boolean.hall_light
state: 'on'
action:
- delay: 00:00:03 #only to get to where going to
- data:
entity_id: light.hallway
service: light.turn_off
- data:
entity_id: input_boolean.hall_light
service: input_boolean.turn_off
Thanks both, very useful. For now i managed to solve the problem by checking for motion, but only when the TV is in the off state. That seems to work great.
Ofcourse, a luxury problem now is that when one turns off the tv, it almost immediately goes back on