HA Update Entity

Hi,
I’am trying to create a automation that will update an entity every 10 seconds.
when creating this entity it’s not updating every 10 seconds but somewhere around 40 seconds.

platform: time_pattern
seconds: “10”

service: homeassistant.update_entity
data: {}
target:
entity_id: device_tracker.oppo_reno4_z_5g

looking for somebody who have some advice

First, when posting code you need to properly format it by using three backticks (```) both on the line before and after the code block. we can’t read it correctly otherwise.

but trying to decipher what you posted you need to add a / to the seconds.

right now it will only update when the seconds equal 10 not every 10.

So it should now be updating every minute by the trigger. and depending on how often the standard integration update (scan_interval) is you might get a strange 40 second update.

trigger:
  platform: time_pattern
  seconds: '/10'
action:
  service: homeassistant.update_entity
  target:
    entity_id: device_tracker.oppo_reno4_z_5g

@finity,
thanks for your reply and tips.
i was not putting the automation through the automation.yaml but via the UI.


so just filled in the seconds without the backslash.
when i put the value into /20 it stills runs the automation every 30 seconds.
so any idea?

1 Like

You can still post the resulting code by going to the three-dot menu and selecting “view in yaml” (or something like that since I never use the UI).

Are you sure it’s also not updating every 20 seconds by your automation and every 30 seconds by the integrations normal scan interval setting

Hi finity,
this is how the automation looks like.
but when leaving from Home to Away is about 1 minute while entering from Away to Home about 15 seconds.
i use the known.yaml to update the entity

  • id: ‘1662455941966’
    alias: HA_Update OPPO van Wil
    description: HA_Update OPPO van Wil
    trigger:
    • platform: time_pattern
      seconds: /15
      condition: []
      action:
    • service: homeassistant.update_entity
      data: {}
      target:
      entity_id: device_tracker.wil_s_oppo
      mode: single
  • id: ‘1662486590757’
    alias: Arm alarm when Away
    description: ‘’
    trigger:
    • platform: state
      entity_id:
      • device_tracker.wil_s_oppo
        to: not_home
        from: home
        condition: []
        action:
    • service: alarmo.arm
      data:
      entity_id: alarm_control_panel.alarmo
      code: ‘xxxx’
      mode: away
      mode: single
  • id: ‘1662488515899’
    alias: Disarm alarm when Home
    description: ‘’
    trigger:
    • platform: state
      entity_id:
      • device_tracker.wil_s_oppo
        to: home
        from: not_home
        condition: []
        action:
    • service: alarm_control_panel.alarm_disarm
      data:
      code: ‘xxxx’
      target:
      entity_id: alarm_control_panel.alarmo
      mode: single

Sorry for this lay-out but i don’t know how to place it like your sample with the copy possibility in it.
any idea?

add three backticks (```) to the line before and the line after the code.

1 Like

You can also click on “</>” (see the top of the screen opened when you reply… it is called preformatted text) You will have a block created on your answer where you can put your code…

1 Like

Hi finity,
sorry but where should i place the backticks?

- id: '1662455941966'
  alias: HA_Update OPPO van Wil
  description: HA_Update OPPO van Wil
  trigger:
  - platform: time_pattern
    seconds: /15
  condition: []
  action:
  - service: homeassistant.update_entity
    data: {}
    target:
      entity_id: device_tracker.wil_s_oppo
  mode: single
- id: '1662486590757'
  alias: Arm alarm when Away
  description: ''
  trigger:
  - platform: state
    entity_id:
    - device_tracker.wil_s_oppo
    to: not_home
    from: home
  condition: []
  action:
  - service: alarmo.arm
    data:
      entity_id: alarm_control_panel.alarmo
      code: 'secret'
      mode: away
  mode: single
- id: '1662488515899'
  alias: Disarm alarm when Home
  description: ''
  trigger:
  - platform: state
    entity_id:
    - device_tracker.wil_s_oppo
    to: home
    from: not_home
  condition: []
  action:
  - service: alarm_control_panel.alarm_disarm
    data:
      code: 'secret'
    target:
      entity_id: alarm_control_panel.alarmo
  mode: single

Hi browetd,
sometimes live can be so simple.
i’am just a newby.
thanks for your tips

Hi finity,
where should i place the three backticks?

it look as tho you already figured it out.

Thanks so much for sharing this, it’s just fixed an issue I’ve had for months whereby my HP_iLO sensors stopped updating after an HA update. I’ve now got this automation working so they update every 15 mins. Thanks :slight_smile: