Addon state sensor not updating (LetsEncrypt renewal automation)

Hi,

I’m trying to fully automate my certification renewal. There is a feature available that should tell me if the LE addon is running, introduced by this PR:

With this feature I wrote an automation to run every week to renew my certificate (or more precise start the LE addon). In the automation I use a trigger wait for LE started and stopped again. But, the state variable is never updated.

Is there a minimal runtime required for the sensor to report an addon as running?

My automation looks as follows:

alias: Update LetsEncrypt
description: ""
trigger:
  - platform: time
    at: "01:00:00"
condition:
  - condition: time
    weekday:
      - sun
action:
  - service: hassio.addon_start
    data:
      addon: core_letsencrypt
  - wait_for_trigger:
      - type: running
        platform: device
        device_id: 91031c6a70f670a16a9400f073fb3b0f
        entity_id: binary_sensor.let_s_encrypt_running
        domain: binary_sensor
        for:
          hours: 0
          minutes: 0
          seconds: 10
    continue_on_timeout: false
    timeout:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
  - wait_for_trigger:
      - type: not_running
        platform: device
        device_id: 91031c6a70f670a16a9400f073fb3b0f
        entity_id: binary_sensor.let_s_encrypt_running
        domain: binary_sensor
        for:
          hours: 0
          minutes: 0
          seconds: 10
    timeout:
      hours: 0
      minutes: 10
      seconds: 0
      milliseconds: 0
  - service: hassio.addon_restart
    data:
      addon: core_nginx_proxy
  - service: hassio.addon_restart
    data:
      addon: core_mosquitto
mode: restart

Before the type: running trigger was added the depending addons (nginx, mosquito) where restarted after the timeout of the type: not_running trigger wait expired. However, as the automation executes the timeout should never be reached.

Using the Dev-Tools → Template page reading the state of the state object {{ states('binary_sensor.let_s_encrypt_running') }} the sensor remains in off state while the addon page correctly reports the LE addon running.

Thanks
aLMa