Skip to content

Comparing Pyscript to Home Assistant Automations

Daniel Lashua edited this page Oct 15, 2020 · 9 revisions

Template Trigger

In Home Assistant:

- alias: some automation
  trigger:
    platform: template
    value_template: "{{ is_state('binary_sensor.test', 'on') }}"
  action:
    - service: homeassistant.turn_on
      entity_id: switch.test

In Pyscript:

@state_trigger('binary_sensor.test == "on"')
def turn_on():
  homeassistant.turn_on(entity_id='switch.test')