Skons / hassio-addons

7 stars 4 forks source link

invalid config for automation #22

Closed MedicoreV8 closed 2 years ago

MedicoreV8 commented 2 years ago
-----------------------------------------------------------
 Add-on: Dutch gas prices
 Get gas prices from dutch gas stations
-----------------------------------------------------------
 Add-on version: 2022.1.2.1
 You are running the latest version of this add-on.
 System: Home Assistant OS 7.4  (armv7 / raspberrypi4)
 Home Assistant Core: 2022.2.7
 Home Assistant Supervisor: 2022.01.1
-----------------------------------------------------------

My Home assistant log shows the following:

2022-02-16 13:33:36 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: template value should be a string for dictionary value @ data['action'][0]['data']. Got None. (See /config/configuration.yaml, line 16).

This leads to the automation.yaml file. I removed every single automation and the log still pops up. It seems that the error is caused by something in the following code from the automation.yaml file

- alias: Update gas stations
  trigger:
  - platform: time_pattern
    minutes: 5
  action:
  - service: mqtt.publish
    data:
      topic: dgp/gas_stations
      payload_template: '{"fuel_type":"euro95","radius":10,"latitude":{{ state_attr("person.[redacted]",
        "latitude") }},"longitude":{{ state_attr("person.[redacted]", "longitude")
        }},"friendly_name_template":"[brand] ([station_street])", "to_publish":5}'
- alias: Notify lowest price gas station
  trigger:
  - platform: state
    entity_id: sensor.gas_station_[fuel_type]_lowest_price_1
  action:
  - service: notify.mobile_app_IphoneP
    data:
      title: Cheapest gas station
      message: 'Gas costs € {{ states.sensor.gas_station_[fuel_type]_lowest_price_1.state
        }} at {{ state_attr("sensor.gas_station_[fuel_type]_lowest_price_1","station_street")
        }}. '
      data:
        url: https://www.google.com/maps/search/?api=1&query={{ state_attr("sensor.gas_station_[fuel_type]_lowest_price_1","latitude")
          }},{{ state_attr("sensor.gas_station_[fuel_type]_lowest_price_1", "longitude")
          }}
  id: [redacted]

Unfortunately, the mobile app notification doesn't seem to work either, this could be related. (It works if I create an automation through the GUI)

Skons commented 2 years ago

you did not replace [fuel_type]

MedicoreV8 commented 2 years ago

Error message is resolved. Replaced 4x [fuel-type] with euro95

MedicoreV8 commented 2 years ago

First notification received in the app.