# turn tv light on when tv goes on
- alias: Auto tvlight on
trigger:
platform: numeric_state
entity_id: switch.red_room_switch
value_template: '{{ states.switch.red_room_switch.current_power_mwh }}'
above: 30000
action:
service: light.turn_on
entity_id: light.tvlight
- alias: Auto tvlight off
trigger:
platform: numeric_state
entity_id: switch.red_room_switch
value_template: '{{ states.switch.red_room_switch.current_power_mwh }}'
below: 30000
action:
service: light.turn_off
entity_id: light.tvlight
The idea is to detect when my TV is not asleep by the current power draw (itās plugged into a wemo insight switch) and use that to switch on/off a light.
Iām getting the error āValue cannot be processed as a numberā. Iām guessing that this is because I chose numeric_state as a platform and the state of switch.red_room_switch is on/off. The value I want to use to control the light is actually a state attribute of the switch.
You could create a template sensor to determine whether the value is above 30000 mwh. That sensor will return a true or false state. Then use state instead of numeric state and the value of āTrueā or āFalseā as the trigger. Just remember that the case has to be āTrueā or āFalseā, not ātrueā or āfalseā. That screwed me up doing a similar automation.