Sonoff Refresh Automation

When the Jinja template is on the same line as the YAML option, you have to wrap the template in quotes like this:

action:
  - service: homeassistant.update_entity
    target:
      entity_id: "{{ integration_entities('sonoff') }}"

You don’t wrap it quotes when it’s on a separate line like this (multi-line):

action:
  - service: homeassistant.update_entity
    target:
      entity_id: >
        {{ integration_entities('sonoff') }}

If you only want the sensors whose entity_id contains the word temperature, you can filter the list like this:

action:
  - service: homeassistant.update_entity
    target:
      entity_id: >
        {{ integration_entities('sonoff')
          | select('search', 'temperature') | list }}

If you want sensors containing either ‘temperature’ or ‘humidity’ in their entity_id then use this:

action:
  - service: homeassistant.update_entity
    target:
      entity_id: >
        {{ integration_entities('sonoff') 
          | select('search', 'temperature|humidity') | list }}
3 Likes