Running Docker on a pi.
I’m new to home assistant, but not to home automation in general. I’ve gotten a ton done with NodeRed and am very proficient in SQL (for work). I’ve been really trying to understand the documentation, but I don’t fully get what goes where. All the documentation keeps telling me to update my configuration.yaml, but it’s not always obvious which one (I don’t think it’s actually the home_assistant/configuration.yaml, but rather it means “a” configuration file that is written in yaml.
Anyway, I’m struggling following this post here:
Continuing the discussion from UK (and worldwide) Pollen Count using tomorrow.io API:
my configuration currently looks like this:
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
#sensor: !include sensors.yaml
rest:
- resource: https://api.tomorrow.io/v4/timelines?location=[MY lat/long]&fields=temperature×teps=1h&units=metric&apikey=[my API key]&fields=treeIndex,grassIndex,weedIndex tomorrowio_pollen_api
scan_interval: 600
sensor:
### Pollen - Tree Index
- name: "Pollen - Grass Index - Day 0"
value_template: "{{ value_json.data.timelines[0].intervals[0]['values']['grassIndex'] }}"
json_attributes_path: "$.data.timelines[0].intervals[0].values"
json_attributes:
- treeIndex
- weedIndex
- temperature
- name: "Pollen - Grass Index - Day 1"
value_template: "{{ value_json.data.timelines[0].intervals[1]['values']['grassIndex'] }}"
json_attributes_path: "$.data.timelines[0].intervals[1].values"
json_attributes:
- treeIndex
- weedIndex
- temperature
- name: "Pollen - Grass Index - Day 2"
value_template: "{{ value_json.data.timelines[0].intervals[2]['values']['grassIndex'] }}"
json_attributes_path: "$.data.timelines[0].intervals[2].values"
json_attributes:
- treeIndex
- weedIndex
- temperature
- name: "Pollen - Grass Index - Day 3"
value_template: "{{ value_json.data.timelines[0].intervals[3]['values']['grassIndex'] }}"
json_attributes_path: "$.data.timelines[0].intervals[3].values"
json_attributes:
- treeIndex
- weedIndex
- temperature
- name: "Pollen - Grass Index - Day 4"
value_template: "{{ value_json.data.timelines[0].intervals[4]['values']['grassIndex'] }}"
json_attributes_path: "$.data.timelines[0].intervals[4].values"
json_attributes:
- treeIndex
- weedIndex
- temperature
IF I check my config, everything is good. When I uncomment #sensor
, it breaks. In my sensors.yaml file (in the main /home_assistant/ folder), I get:
Invalid config for [sensor]: required key not provided @ data['platform']. Got None. (See /config/configuration.yaml, line 12).
Which I interpret to mean that it thinks my sensors.yaml file is written incorrectly.
Here’s what I have in that:
template:
- sensor:
- name: Pollen - Grass
unique_id: sensor.pollen_grass
state: "{{ states('sensor.pollen_grass_index_day_0') }}"
icon: 'mdi:grass'
attributes:
Today: "{{ states('sensor.pollen_grass_index_day_0') }}"
Tomorrow: "{{ states('sensor.pollen_grass_index_day_1') }}"
Today + 2: "{{ states('sensor.pollen_grass_index_day_2') }}"
Today + 3: "{{ states('sensor.pollen_grass_index_day_3') }}"
Today + 4: "{{ states('sensor.pollen_grass_index_day_4') }}"
- name: Pollen - Tree
unique_id: sensor.pollen_tree
state: "{{ state_attr('sensor.pollen_grass_index_day_0', 'treeIndex') }}"
icon: 'mdi:tree'
attributes:
Today: "{{ state_attr('sensor.pollen_grass_index_day_0', 'treeIndex') }}"
Tomorrow: "{{ state_attr('sensor.pollen_grass_index_day_1', 'treeIndex') }}"
Today + 2: "{{ state_attr('sensor.pollen_grass_index_day_2', 'treeIndex') }}"
Today + 3: "{{ state_attr('sensor.pollen_grass_index_day_3', 'treeIndex') }}"
Today + 4: "{{ state_attr('sensor.pollen_grass_index_day_4', 'treeIndex') }}"
- name: Pollen - Weed
unique_id: sensor.pollen_weed
state: "{{ state_attr('sensor.pollen_grass_index_day_0', 'weedIndex') }}"
icon: 'mdi:spa'
attributes:
Today: "{{ state_attr('sensor.pollen_grass_index_day_0', 'weedIndex') }}"
Tomorrow: "{{ state_attr('sensor.pollen_grass_index_day_1', 'weedIndex') }}"
Today + 2: "{{ state_attr('sensor.pollen_grass_index_day_2', 'weedIndex') }}"
Today + 3: "{{ state_attr('sensor.pollen_grass_index_day_3', 'weedIndex') }}"
Today + 4: "{{ state_attr('sensor.pollen_grass_index_day_4', 'weedIndex') }}"
I’m just not sure how to debug this and what exactly is broken. I really have tried researching this, but the different docs don’t tell me where to put things, they just say "edit your config.yaml
". Could someone point me in the right direction? Thank you so much!