Automation: any event or state change

Hi, I would like to pass any state changes and events (including zwave events) to another (web-)server.

Right now I have:

shell_command:
  send_update: 'curl -d "entity_id={{ e }}&value_new={{ vn }}&value_old={{ vo }}" -X POST https://mydomain.com/api/update'

automation:
  - alias: Send updates
    trigger:
      platform: state
    action:
      service: shell_command.send_update
      data_template:
        e: "{{ trigger.entity_id }}"
        vn: "{{ trigger.to_state.state }}"
        vo: "{{ trigger.from_state }}"
  - alias: Zwave update
    trigger:
      platform: event
      event_type: zwave.node_event
    action:
      - service: shell_command.send_update
        data:
        e: "{{ trigger.entity_id }}"
        vn: "{{ trigger.to_state.state }}"
        vo: "{{ trigger.from_state }}"

This is not working. At all. I debiuged the shell command, that one seems to work. So the problem is in the events. Any idea? Oh and I hav 60+ debices, so it would be really nice if I could use 1 generic function, otherwise I have a lot of typework to do :slight_smile:

Then you should trigger on event state_changed, but i think there will be a lot to do for your shell_command.


Go to Dev Tools/events and listen for state_changed, then you will see them.

What is your end goal with this? I think something like mqtt statestream/eventstream might be a better solution for your needa.