Long-time user of Home Assistant; first time using the RESTful integration to capture multiple sensors from a single resource. I’m trying to name the sensors as shown in the example from the documentation:
… yet I am getting duplicate sensor names. I can’t seem to figure out why!
So here is my configuration:
First, in configuration.yaml:
rest: !include rest-sensors.yaml
Then in rest-sensors.yaml:
- resource: https://api.covidactnow.org/v2/state/OH.json?apiKey=[shhh]
scan_interval: 3600
sensor:
- name: "Ohio COVID Metrics"
json_attributes_path: "$.metrics"
json_attributes:
- caseDensity
- testPositivityRatio
- infectionRate
- icuCapacityRatio
- vaccinationsInitiatedRatio
- vaccinationsCompletedRatio
value_template: '{{ value_json.lastUpdatedDate }}'
- name: "Ohio COVID Risk"
json_attributes_path: "$.riskLevels"
json_attributes:
- overall
- caseDensity
- testPositivityRatio
- infectionRate
value_template: '{{ value_json.lastUpdatedDate }}'
- resource: https://api.covidactnow.org/v2/county/39041.json?apiKey=[shhh]
scan_interval: 3600
sensor:
- name: "DelCo COVID Metrics"
json_attributes_path: "$.metrics"
json_attributes:
- caseDensity
- testPositivityRatio
- infectionRate
- vaccinationsInitiatedRatio
- vaccinationsCompletedRatio
value_template: '{{ value_json.lastUpdatedDate }}'
- name: "DelCo COVID Risk"
json_attributes_path: "$.riskLevels"
json_attributes:
- overall
- caseDensity
- testPositivityRatio
- infectionRate
value_template: '{{ value_json.lastUpdatedDate }}'
So I should have four sensors come out of this, right?
sensor.ohio_covid_metrics
sensor.ohio_covid_risk
sensor.delco_covid_metrics
sensor.delco_covid_risk
Instead I get the following:
sensor.delco_covid_metrics
sensor.delco_covid_risk
sensor.delco_covid_metrics_2
sensor.delco_covid_risk_2
Per the Developer Tools:
Am I doing something wrong with the integration syntax? In addition to the sensor naming issue, it looks like the (intended) ohio_covid_metrics
sensor is failing to pull one of its listed attributes - icuCapacityRatio
. It appears, instead, that the two DelCo
sensors are each being applied twice against the two different resources. Not sure why.
Thanks in advance!