Want to keep resetting volume

I have an ecobee with voice assistant and if I have the volume say 80% high over time the volume gets lower. The gauge still shows 80% but you can’t hear it hardly after a few says. I tweak the volume bar and it’s good again for a day or two. Any way to keep pushing say every hour a volume of 8 to the ecobee? Curious if it would work.

Time pattern trigger.

I did the below automation, but notice when you restart HA that the volume_level variable is not there on restart. Not sure when it shows up but tried this:

- alias: "Media: Monitor and set ecobee volume to 8"
  trigger:
    - platform: numeric_state
      entity_id: media_player.ecobee
      value_template: '{{ states.media_player.ecobee.attributes.volume_level }}'
      below: 0.8
  action:
    - service: media_player.volume_set
      entity_id: media_player.ecobee
      data_template:
        volume_level: 0.8

In the logs I get:

2020-03-20 09:23:50 WARNING (MainThread) [homeassistant.helpers.condition] Value cannot be processed as a number: <state media_player.ecobee=standby; is_volume_muted=False, media_content_type=standby, media_position_updated_at=2020-03-20T09:23:50.509754-05:00, available=True, last_called=True, last_called_timestamp=1584711339973, friendly_name=Ecobee, supported_features=56253 @ 2020-03-20T09:21:24.387846-05:00> (Offending entity: )

Not sure if it’s a standby thing or what and you just let it error until the device shows that value and then it will do something or what, or a way to get it out of standby. Assuming what I did above makes sense in the first place.

- alias: "Media: Monitor and set ecobee volume to 8"
  trigger:
    - platform: template
      value_template: '{{ state_attr('media_player.ecobee','volume_level') | float < 0.8 }}'
  action:
    - service: media_player.volume_set
      entity_id: media_player.ecobee
      data_template:
        volume_level: 0.8

Thanks Tom, that caused HA to start in safe mode. Got:

Error loading /config/configuration.yaml: while parsing a block mapping
in “/config/automations/automations_ecobee.yaml”, line 3, column 7
expected , but found ‘’
in “/config/automations/automations_ecobee.yaml”, line 4, column 39

Ugh. Too many single quotes. Sorry. Try:

- alias: "Media: Monitor and set ecobee volume to 8"
  trigger:
    - platform: template
      value_template: "{{ state_attr('media_player.ecobee','volume_level') | float < 0.8 }}"
  action:
    - service: media_player.volume_set
      entity_id: media_player.ecobee
      data_template:
        volume_level: 0.8

Also you should validate your config before restarting / reloading automations.

You may have to enable advanced mode in your user profile for all the controls to be visible. Damn stupid decision that one.

Also be careful about using special characters ( : ) in your aliases.

Thanks Tom, usually i do that but when someone shares code I occasionally just trust it. Went thru without error in the logs on restart or anything. Though for some reason the volume_level variable is available where last reboot it wasn’t so not sure if it’s the code change from mine to yours or if it’s because I just walked by the thermostat while rebooting since it seems like alexa doesn’t report volume_level until they are activated normally.