ha-sensor.owlet icon indicating copy to clipboard operation
ha-sensor.owlet copied to clipboard

how to code the entity_id?

Open mjb83 opened this issue 3 years ago • 6 comments

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:

  • platform: template sensors: owlet_heart_rate: value_template: "{{states.sensor.owlet_smart_sock_[YOUR_SMART_SOCK_SERIAL_NUMBER].attributes.heart_rate}}" unit_of_measurement: BPM

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_smart_sock_[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 avatar Feb 19 '22 20:02 mjb83

Friendly bump :)

mjb83 avatar Mar 02 '22 04:03 mjb83

Figured it out! Thanks for the base code again!

mjb83 avatar Mar 03 '22 14:03 mjb83

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.

jacobwtyler avatar Apr 22 '22 14:04 jacobwtyler

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

mjb83 avatar Apr 22 '22 15:04 mjb83

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.

jacobwtyler avatar Apr 22 '22 23:04 jacobwtyler

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:

  • platform: owlet username: emailaddresshere password: passwordhere region: world

  • platform: template sensors: owlet_heart_rate: value_template: "{{states.sensor.owlet_smart_sock_[BASESTATIONID].attributes.heart_rate}}" unit_of_measurement: BPM owlet_spo2: value_template: "{{states.sensor.owlet_smart_sock_[BASESTATIONID].attributes.oxygen_saturation}}" unit_of_measurement: SPO2 owlet_movement: value_template: "{{states.sensor.owlet_smart_sock_[BASESTATIONID].attributes.movement}}" unit_of_measurement: '%' owlet_battery: value_template: "{{states.sensor.owlet_smart_sock_[BASESTATIONID].attributes.battery}}" unit_of_measurement: '%' owlet_rssi: value_template: "{{states.sensor.owlet_smart_sock_[BASESTATIONID].attributes.ble_rssi}}" unit_of_measurement: dBm owlet_monitoring_status: value_template: "{{(states.sensor.owlet_smart_sock_[BASESTATIONID].attributes.active) and (states.sensor.owlet_smart_sock_[BASESTATIONID].state == 'Connected')}}" unit_of_measurement: boolean owlet_connection: value_template: "{{states.sensor.owlet_smart_sock_[BASESTATIONID].state}}" unit_of_measurement: boolean owlet_tachycardia_alert: value_template: "{{states.sensor.owlet_smart_sock_[BASESTATIONID].attributes.HIGH_HR_ALRT}}" unit_of_measurement: boolean owlet_bradycardia_alert: value_template: "{{states.sensor.owlet_smart_sock_[BASESTATIONID].attributes.LOW_HR_ALRT}}" unit_of_measurement: boolean owlet_hypoxia_alert: value_template: "{{states.sensor.owlet_smart_sock_[BASESTATIONID].attributes.LOW_OX_ALRT}}" unit_of_measurement: boolean owlet_lobatt_alert: value_template: "{{states.sensor.owlet_smart_sock_[BASESTATIONID].attributes.LOW_BATT_ALRT}}" unit_of_measurement: boolean owlet_read_integrity_alert: value_template: "{{states.sensor.owlet_smart_sock_[BASESTATIONID].attributes.LOW_INTEG_READ}}" unit_of_measurement: boolean

mjb83 avatar Apr 27 '22 18:04 mjb83