jlamendo / ha-sensor.owlet

Owlet Smart Sock v2/v3 Sensor Integration for HomeAssistant using the modern Owlet API.
MIT License
81 stars 22 forks source link

how to code the entity_id? #12

Open mjb83 opened 2 years ago

mjb83 commented 2 years ago

Me again! Thanks for the help last time :)

So I've got my DB working (im actually using influx instead of prometheus). But I can't figure out how to code the entity_id?

For example:

If I just code the sensor.owlet_smart_sock it gives me a "1" on data output, if I try the entire state states.sensor.owlet_smartsock[YOUR_SMART_SOCK_SERIAL_NUMBER].attributes.heart_rate I get no data.

How do you have this coded in Grafana? Specifically the JSON section

  "tags": [
    {
      "key": "entity_id",
      "operator": "=",
      "value": "sensor.owlet_smart_sock_[YOUR_SMART_SOCK_SERIAL_NUMBER].attributes.heart_rate"
    }
mjb83 commented 2 years ago

Friendly bump :)

mjb83 commented 2 years ago

Figured it out! Thanks for the base code again!

jacobwtyler commented 2 years ago

What was the solution @mjb83 ? I am having similar issue. I’ve got no data on the sensors but my base hub is connecting because it has the serial number automatically appended at the end of it. My sensors do not. Any help very much appreciated.

mjb83 commented 2 years ago

This is what worked for me: SELECT "heart_rate" FROM "autogen"."state" WHERE ("entity_id" = 'YOUR_SMART_SOCK_SERIAL_NUMBER')

SELECT "oxygen_saturation" FROM "autogen"."state" WHERE ("entity_id" = 'YOUR_SMART_SOCK_SERIAL_NUMBER')

SELECT "battery" FROM "autogen"."state" WHERE ("entity_id" = 'YOUR_SMART_SOCK_SERIAL_NUMBER')

Owlet_entity_ID

jacobwtyler commented 2 years ago

Okay thanks for that! Not to derail to another issue but I’m not getting any sensor data in my actual HA entity for each measurement. The hub has the serial number appended to it but the sensors don’t. I must be doing something wrong but I’m racking my brain and can’t solve it. I’m fairly novice with HA and yaml.

mjb83 commented 2 years ago

I recall the first time I tried to connect one of the users here said I might have to use a VPN to connect to a US server so the servers you are connecting to get 'tricked' into thinking you are US based... but I could be confusing that with another setup.

I had to play around with the config quite a bit, but this is what works for me.

This is what I have in my configuration.yaml:

owlet

sensor: