I am trying to split up some of my config files. I set up a new file for sensors that has a bunch of template sensors which work.When I add a new rest sensor and it fails. If I comment out the external file in the configuation.yaml file and directly add the sensor to the config, the sensor works fine. I am just trying to figure out how I can add the reset sensor to the sensors.yaml file.
This is the content of the sensors.yaml file
platform: template
sensors:
foyer_smoke_alarm_status:
friendly_name: "Foyer Smoke Alarm Status"
unique_id: sensor.foyer_smoke_alarm_status
value_template: >-
{% if is_state("sensor.foyer_smoke_alarm_smoke", "2")%}
Smoke
{% elif is_state("sensor.foyer_smoke_alarm_carbon_monoxide", "2")%}
CO
{% elif is_state("sensor.foyer_smoke_alarm_carbon_monoxide", "5")%}
CO_EOL
{% elif is_state("sensor.foyer_smoke_alarm_smoke", "3")%}
Testing
{% elif is_state("sensor.foyer_smoke_alarm_smoke", "6") or is_state("sensor.foyer_smoke_alarm_carbon_monoxide", "6")%}
Testing
{% else %}
OK
{% endif %}
icon_template: >-
{% if is_state("sensor.foyer_smoke_alarm_smoke", "2")%}
mdi:fire
{% elif is_state("sensor.foyer_smoke_alarm_carbon_monoxide", "2")%}
mdi:cloud-outline
{% else %}
mdi:smoke-detector
{% endif %}
My configuration.yaml
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
#homeassistant:
# Load packages
#packages: !include_dir_named packages
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
# base_url: example.duckdns.org:8123
# 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
This is the new sensor I am trying to add.
sensor:
Get OpenEVSE min/max current from RAPI
- platform: rest
name: "OpenEVSE RAPI $GC"
resource: !secret OPENEVSE_REST_GET_CURRENT_CAPACITY_RANGE
force_update: no
authentication: basic
username: !secret OPENEVSE_USERNAME
password: !secret OPENEVSE_PASSWORD
headers:
User-Agent: Home Assistant
Content-Type: application/json
json_attributes: ["cmd", "ret"]
value_template: >-
{{- value_json.ret -}}