TheFes / HA-configuration

My Home Assistant config
154 stars 24 forks source link

00 - Ulanzi activate or deactivate app automation error #86

Closed lennvilardi closed 1 year ago

lennvilardi commented 1 year ago

I used the automation gui switched in yaml mode to copy/paste and edit your automation but when it tried to execute I've got this error : Error: Error rendering data template: TypeError: Object of type LoggingUndefined is not JSON serializable

alias: 00 - Ulanzi activate or deactivate app
description: ""
trigger:
  - platform: state
    entity_id: sensor.battery
    to: null
    variables:
      show: "{{ trigger.to_state.state != '100' }}"
      app: bat
condition:
  - "{{ app is defined and app is not none }}"
action:
  - alias: Activate or deactivate app
    service: mqtt.publish
    data:
      qos: 0
      retain: false
      topic: awtrix_1aaad0/apps
      payload: |
        {{
          [
            dict(
                name = app,
                show = show | default(true) | bool(true)
              )
          ] | to_json
        }}
mode: queued
TheFes commented 1 year ago

I'll check, will probably be tomorrow

TheFes commented 1 year ago

BTW, did you manually run it by pressing the RUN ACTIONS button? In that case it won't work. It relies on data from the trigger, and in that case there is no trigger data (because there is no trigger).

TheFes commented 1 year ago

closed because there was no response