Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does this still work? #11

Closed
mjb83 opened this issue Nov 23, 2021 · 24 comments
Closed

Does this still work? #11

mjb83 opened this issue Nov 23, 2021 · 24 comments

Comments

@mjb83
Copy link

mjb83 commented Nov 23, 2021

I've been trying to get this working for a few days now. No success. Many errors in the logs (note SERIAL ID is intentional to hide my serial #). Just trying to show output on a sensor integration with no success.

2021-11-23 01:14:34 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'sensor' is undefined when rendering '{{sensor.owlet_smart_sock_[SERIALID].attributes.heart_rate}}'

2021-11-23 01:14:34 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template("{{sensor.owlet_smart_sock_[SERIALID].attributes.heart_rate}}")

and many like this:

homeassistant.exceptions.TemplateError: UndefinedError: 'sensor' is undefined
2021-11-23 01:14:34 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'sensor' is undefined when rendering '{{sensor.owlet_smart_sock_[SERIALID].attributes.heart_rate}}'
2021-11-23 01:14:34 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('UndefinedError: 'sensor' is undefined') while processing template 'Template("{{sensor.owlet_smart_sock_[SERIALID].attributes.heart_rate}}")' for attribute 'attr_native_value' in entity 'sensor.owlet_heart_rate'
2021-11-23 01:14:34 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template("{{states.sensor.owlet_smart_sock
[SERIALID].attributes.oxygen_saturation}}")

homeassistant.exceptions.TemplateError: TemplateError: str: Invalid entity ID 'sensor.owlet_smart_sock_'
2021-11-23 01:14:34 ERROR (MainThread) [homeassistant.components.template.template_entity] TemplateError('TemplateError: str: Invalid entity ID 'sensor.owlet_smart_sock_'') while processing template 'Template("{{states.sensor.owlet_smart_sock_[SERIALID].attributes.oxygen_saturation}}")' for attribute 'attr_native_value' in entity 'sensor.owlet_spo2'
2021-11-23 01:14:34 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template("{{states.sensor.owlet_smart_sock
[SERIALID].attributes.movement}}")

This is the setup in configuration.yaml:

sensor:

  • platform: owlet
    username: "email@address"
    password: password
    region: "world"

  • platform: template
    sensors:
    owlet_heart_rate:
    friendly_name: "Beats per minute"
    unit_of_measurement: BPM
    value_template: "{{sensor.owlet_smart_sock_[SERIALID].attributes.heart_rate}}"
    owlet_spo2:
    value_template: "{{states.sensor.owlet_smart_sock_[SERIALID].attributes.oxygen_saturation}}"
    unit_of_measurement: SPO2

I have been trying but I'm a little behind on the scripting. Not sure if I have a silly mistake here.

@florianwedler
Copy link

Used to work up to a week ago. Then owlet servers were down, also no data in the owlet app. Once recovered it quit working on my side. Will need to investigate, unfortunately I am a newbe. ;-)

@mjb83
Copy link
Author

mjb83 commented Nov 25, 2021

Ahh. super bummer! I was really looking forward to getting some custom dashboards going. Ya I have some experience coding but pulling data from Owlets API I have no idea where to start.

Even things that aren't HA specific seem to have not been updated for at least 3 years. I think Owlet is actively restricting access to their API because they want users to use their app. Very disappointing...

@florianwedler
Copy link

It quit working on the 21st of Nov. I have two sock of different generation. Both quit working. I also did some HA updates during last week, due to their outage I thought it was an issue on their side. Log says invalid entity id in template. Not sure how i can troubleshoot and check data traffic or what may be the new entity id.

@mjb83
Copy link
Author

mjb83 commented Nov 25, 2021

Ya apparently Owlet has a cease and desist from the FDA right now... nothing concerning about how the socks work - its just owlet has been marketing them as medical devices, and that requires FDA approval. Owlet never got this approval.

Could be related but the timelines don't exactly match up.

https://www.romper.com/life/fda-warning-owlet-smart-sock-baby-monitor

@mjb83
Copy link
Author

mjb83 commented Nov 25, 2021

and yes, I'm getting sensor undefined all the time as my error.

@florianwedler
Copy link

In order to get it initially working,... like instructions said. HACS, Custom Repository, config.yaml with sensor section and for me europe as region and then platform template. Just like discribed, was working perfectly for months. With additional temperature reading via mqtt the dashboard/ monitoring of the kids looked like in ER/ICU, if not better. ;-)

@jlamendo
Copy link
Owner

Sorry, I don't monitor my personal Github as often as I should :) Is this still not working for folks? It's working for me, but I may have made some local changes at some point.

FWIW, in regards to the app store blocking etc etc, I find that this integration is now the only thing that makes my Owlet worthwhile. I have my own sets of alerts that can trigger on far more advanced things like 30m rolling averages and trendlines. So I'd like to do what I can to get this working for you all again if you're still having issues.

@florianwedler
Copy link

At least not working for me. 😢

@mjb83
Copy link
Author

mjb83 commented Jan 13, 2022

Hi @jlamendo still not working for me either. My configuration hasn't changed from what I posted on 23-NOV. Does my config look any different to what you are currently running?

@jlamendo
Copy link
Owner

Nope, it looks exactly the same as mine! I will say - sometimes it stops working, and I have to restart my HA instance to get it working again. Can you take a look at your HA logs and let me know if there are any messages related to the integration? You can find the relevant logs in your HA instance under Configuration -> Settings -> Logs Tab. You might need to hit the "Load Full HomeAssistant Log" button to see it if it's been a while since you've booted up your instance.

@mjb83
Copy link
Author

mjb83 commented Jan 17, 2022

I've got quite a few of them... My device ID is changed to xxx

Template variable error: 'sensor' is undefined when rendering '{{sensor.owlet_smart_sock_[xxx].attributes.heart_rate}}'
1:43:53 AM – (ERROR) helpers/template.py - message first occurred at January 11, 2022, 3:19:19 PM and shows up 6511 times

Owlet Network error while retrieving data for Sock xxx: 503 Server Error: Service Unavailable for url: https://ads-field-1a2039d9.aylanetworks.com/apiv1/dsns/xxx/properties.json
January 16, 2022, 9:53:29 AM – (ERROR) owlet (custom integration) - message first occurred at January 12, 2022, 9:01:18 PM and shows up 3 times

Owlet Network error while activating Sock xxx: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
January 15, 2022, 11:00:58 AM – (ERROR) owlet (custom integration) - message first occurred at January 11, 2022, 3:42:03 PM and shows up 5 times

Updating owlet sensor took longer than the scheduled update interval 0:00:10
January 14, 2022, 11:00:45 AM – (WARNING) Sensor - message first occurred at January 14, 2022, 10:55:45 AM and shows up 31 times

Update of sensor.owlet_smart_sock_xxx is taking over 10 seconds
January 14, 2022, 10:55:45 AM – (WARNING) helpers/entity.py

TemplateError('TemplateError: str: Invalid entity ID 'sensor.owlet_smart_sock_'') while processing template 'Template("{{states.sensor.owlet_smart_sock_[xxx].attributes.HIGH_HR_ALRT}}")' for attribute '_attr_native_value' in entity 'sensor.owlet_tachycardia_alert'
January 11, 2022, 3:19:19 PM – (ERROR) Template - message first occurred at January 11, 2022, 3:19:19 PM and shows up 12 times

Error while processing template: Template("{{states.sensor.owlet_smart_sock_[xxx].attributes.HIGH_HR_ALRT}}")
January 11, 2022, 3:19:19 PM – (ERROR) helpers/template.py - message first occurred at January 11, 2022, 3:19:19 PM and shows up 12 times

@mjb83
Copy link
Author

mjb83 commented Jan 21, 2022

Is there anything in the manifest.json or sensor.py configs that had to be customized? I only added the custom sensor entries to configuration.yaml

@mjb83
Copy link
Author

mjb83 commented Feb 7, 2022

Still no luck here @jlamendo
Do any of my logs make sense to you?

@mjb83
Copy link
Author

mjb83 commented Feb 9, 2022

Looks like the /config/custom_components/owlet/init.py file has nothing in it? Should it?

Was looking at this setup https://github.com/CAB426/HomeAssistant-Owlet and it looks like init file should have much more? Did you move everything over to sensor.py?

@jlamendo
Copy link
Owner

Nothing in either of those files needs to be customized, and your sensor entries look fine. The issue is in this log line - "Owlet Network error while retrieving data for Sock xxx: 503 Server Error: Service Unavailable for url:" - the rest of it is just cascading effects from that failure.

Essentially, Owlet's servers are responding to your requests with a 503 error indicating that the service is unavailable. Why it's specifically responding as unavailable to you, but not for anyone else, that's the real question. Unfortunately, that's one of many potential downsides when dealing with undocumented and unsupported private API's like this.

A blank init file is fairly standard in python - if the module doesn't require setup before loading, and the module doesn't contain submodules that you want to expose as top-level functionality, there's not much reason to include anything in there. The file is just there to let python know that it should treat the files in the directory as a module. See http://docs.python.org/tutorial/modules.html#packages

@jlamendo
Copy link
Owner

One thing you might want to try is to disconnect your Owlet from your wifi and reconnect it. Sometimes mine gets stuck in a weird state where I have to do that. If that doesn't resolve the problem, if you aren't located in the US you might want to try connecting to a US-based VPN. It would likely need to have both the Owlet and your HA instance both connected to the internet via VPN in order to work, so you'd most likely need a router capable of tunneling your entire network's connection via VPN.

@mjb83
Copy link
Author

mjb83 commented Feb 11, 2022

One thing you might want to try is to disconnect your Owlet from your wifi and reconnect it. Sometimes mine gets stuck in a weird state where I have to do that. If that doesn't resolve the problem, if you aren't located in the US you might want to try connecting to a US-based VPN. It would likely need to have both the Owlet and your HA instance both connected to the internet via VPN in order to work, so you'd most likely need a router capable of tunneling your entire network's connection via VPN.

Well, I think this did it. Got my router behind my VPN connecting into Chicago... I'm not seeing any errors and I'm actually seeing entity value data after adding the base station to a lovelace entity tile.

Do you know if its possible to show the data as individual entity tiles in home assistant or is this setup specifically designed for prometheus / grafana?

@mjb83
Copy link
Author

mjb83 commented Feb 11, 2022

I should clarify.. I have the following setup:
type: vertical-stack
cards:

  • type: sensor
    entity: sensor.owlet_smart_sock_xxxxyyyy
    name: Owlet Base Station
    icon: mdi:home-heart
    graph: line
  • type: entity
    entity: sensor.owlet_battery
    attribute: unit_of_measurement

I can see the owlet smart sock is connected, and if I hover over the tile I can see the attributes that are associated with it. I just can't add each individual attribute to its own entity tile on lovelace to give me a dashboard.

@jlamendo
Copy link
Owner

That's more of an HA thing than anything specific to this integration, but you definitely can expose an entity attribute in a tile.

type: attribute
entity: sensor.owlet_smart_sock_xxxxyyyy
attribute: heart_rate

@jlamendo
Copy link
Owner

jlamendo commented Feb 11, 2022

In any case, I'm glad that fixed it for you! I suspect that there's some value of the string which is currently configured as "world" that would allow you to connect without VPN, but I don't know what it might be or have any way of finding out. And hey, if it's not broken don't fix it.

It is pretty hilarious though that the Owlet developers felt it fitting to call the US "World" - classic American Exceptionalism! Sorry our hubris caused you problems 😬

@mjb83
Copy link
Author

mjb83 commented Feb 11, 2022

That's more of an HA thing than anything specific to this integration, but you definitely can expose an entity attribute in a tile.

type: attribute
entity: sensor.owlet_smart_sock_xxxxyyyy
attribute: heart_rate

Doesn't look like attribute is picking up?

Unknown type encountered: attribute

@mjb83
Copy link
Author

mjb83 commented Feb 11, 2022

Figured it out! For everyone else following along:

  • type: entities
    entities:
    • type: attribute
      entity: sensor.owlet_smart_sock_xxxxyyyy
      attribute: battery
      name: Owlet Battery
    • type: attribute
      entity: sensor.owlet_smart_sock_xxxxyyyy
      attribute: Heart_rate
      name: Heart rate
    • type: attribute
      entity: sensor.owlet_smart_sock_xxxxyyyy
      attribute: Oxygen saturation
      name: sp02

@jlamendo
Copy link
Owner

Going to close this issue out for now, as it sounds like your problem is resolved.

@mjb83
Copy link
Author

mjb83 commented Feb 14, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants