Hello, I’m a newbie using MiFlora bluetooth sensors that have limited reach and my HA doesn’t pick them up. I installed a RPI zero W in the same room as the sensors using the HA image and connected the sensors to that. So far so good.
On my primary HA, I’m now trying to setup a remote sensor using a REST sensor in such a way that the primary PI only has to do one REST call to pull all the values, but I’m struggling to get it to work. Whatever I try, the sensors show up as unavailable. Here’s the structure that the api/states call returns:
[
{...},
{...},
{
"attributes": {
"friendly_name": "miflora2 Moisture",
"icon": "mdi:water-percent",
"unit_of_measurement": "%"
},
"context": {
"id": "d03695c61fe447419639357d9e649137",
"parent_id": null,
"user_id": null
},
"entity_id": "sensor.miflora2_moisture",
"last_changed": "2020-04-03T10:33:53.375115+00:00",
"last_updated": "2020-04-03T10:33:53.375115+00:00",
"state": "45"
},
{
"attributes": {
"friendly_name": "miflora2 Light intensity",
"icon": "mdi:white-balance-sunny",
"unit_of_measurement": "lx"
},
"context": {
"id": "f3a00a8d907545d880b52e7f8ef32360",
"parent_id": null,
"user_id": null
},
"entity_id": "sensor.miflora2_light_intensity",
"last_changed": "2020-04-03T10:33:53.155332+00:00",
"last_updated": "2020-04-03T10:33:53.155332+00:00",
"state": "172"
},
{
"attributes": {
"friendly_name": "miflora2 Temperature",
"icon": "mdi:thermometer",
"unit_of_measurement": "°C"
},
"context": {
"id": "2f2de340b7624a2d8a6772034b82f28d",
"parent_id": null,
"user_id": null
},
"entity_id": "sensor.miflora2_temperature",
"last_changed": "2020-04-03T10:33:53.268074+00:00",
"last_updated": "2020-04-03T10:33:53.268074+00:00",
"state": "20.2"
},
{
"attributes": {
"friendly_name": "miflora2 Conductivity",
"icon": "mdi:flash-circle",
"unit_of_measurement": "µS/cm"
},
"context": {
"id": "fbe11cea840e4c0e8b6a2847135bd5fd",
"parent_id": null,
"user_id": null
},
"entity_id": "sensor.miflora2_conductivity",
"last_changed": "2020-04-03T10:33:53.176692+00:00",
"last_updated": "2020-04-03T10:33:53.176692+00:00",
"state": "409"
},
{...},
{...},
{...},
{...},
{...},
{...},
{...},
{...},
{...},
{...},
{...},
{...}
],
Here's the config on my primary HA:
- platform: rest
resource: http://192.168.1.111:8123/api/states
headers:
Authorization: !secret pizero_api_token
name: pizero
value_template: '{{ value_json }}'
json_attributes: '{{ value_json }}'
- platform: template
sensors:
miflora2_moisture:
value_template: '{{ states.sensor.pizero[3].state }}'
friendly_name: "Lemon Moisture"
unit_of_measurement: '%'
miflora2_light_intensity:
value_template: '{{ states.sensor.pizero.attributes[4].state }}'
friendly_name: "Lemon Light intensity"
unit_of_measurement: 'lx'
I’m probably going the wrong way about this, so if I should use a completely different way to achieve my goal, please let me know. Thanks!