mcclown / home-assistant-custom-components

Custom components for Home-Assistant
Apache License 2.0
18 stars 7 forks source link

Won't read data anymore #4

Closed Clubeddie closed 5 years ago

Clubeddie commented 5 years ago

Hi there, i have an issue with this plugin. I have Home Assistant 0.93.2. Updated your plugin to latest version. In my logfiles i receive.

2019-05-25 12:07:35 ERROR (MainThread) [custom_components.uhooair.sensor] Error: HTTPSConnectionPool(host='api.uhooinc.com', port=443): Max retries exceeded with url: /v1/getdevicelist (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x6ce100d0>: Failed to establish a new connection: [Errno -3] Try again')) 2019-05-25 12:07:35 WARNING (MainThread) [homeassistant.components.sensor] Platform uhooair not ready yet. Retrying in 60 seconds.

I must say i now have two sensors inside my uHoo business account. Maybe this has something to do with it?

mcclown commented 5 years ago

Thanks for opening the ticket, sorry about the delay in responding. It looks like a connection error. Can you try again, in case it was just an intermittent issue? I have had problems connecting to uhoos servers before.

If that doesn't work, is it possible for you to remove one of the devices from your account and see if it works when there's one device? I only had one device for testing, so it could be a gap there, as I hadn't tested that scenario yet.

Clubeddie commented 5 years ago

Edited previous post. It looks my HA installation was somehow corrupted and could not receive any ouside api anymore. I started it with a complete new installation.

After a complete reboot no errors are showing. And now i can confirm i see both sensors (in and outside) receiving in in HA. Hope my install works longer this time.

Issue was on my side, not on the plugin.

Clubeddie commented 5 years ago

Okay, i thought i solved the issue. But after a couple of hours i get:

Error: HTTPSConnectionPool(host='api.uhooinc.com', port=443): Max retries exceeded with url: /v1/getdevicelist (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x6cd41e30>: Failed to establish a new connection: [Errno -3] Try again')) Verbinding verbroken. Opnieuw verbinden...

So no new data is receiving... can it be an issue that HA is connected to much in short time and the connection is refused? I set it up like described.

mcclown commented 5 years ago

So Uhoo do have a limitation on how many requests can be made to their API per hour. I wonder if with two devices, this is requesting twice as often as allowed. I'll have a look at the code tomorrow and see if I can figure out a way to work around this

Clubeddie commented 5 years ago

Is it also possible that another api has made to many request so that the max retries for all other api's failed either. I also had a air quality check

- platform: rest name: airquality_NO2 resource: https://api.luchtmeetnet.nl/open_api/stations/[stationid]/measurements?page=&order=&order_direction=&formula=NO2 unit_of_measurement: µg/m3 value_template: '{{ value_json.data[0].value }}'

This one not working either, and it seems that this one before uhoo get connection errors, but i cannot find it for sure. I disabled the luchtmeetnet api, rebooted hassio. Still get the errors. For know i disable Uhoo, and try to activate it tomorrow.

But i get the same issue as in the last installation. All outside api calls don't function after certain time. Connection to the outside (like updates and so one) are still function correctly. I must find the source of this. Don't know for sure if it is uhoo, but if we can sort it out i can investigate further. For now i only has this outside api's in my new installation. Last time i did not use the luchtmeetnet api.

Maybe it is something totally else, but for now i cannot find it.

Clubeddie commented 5 years ago

It seems Pi-Hole creating this issue, disabled the plugin and some stuff start working. So tonight i disabled Pi-Hole and let the rest loaded. Tomorrow morning check what the status is. Think some kind of loop because dns resolves to PiHole, same ip as HA...

Then configure static ip with outside dns.... will let you know

Clubeddie commented 5 years ago

Fixed the issue, PiHole was creating a loop hole. So no traffic goes outside. Fixed it with a static IP and outside DNS server.

Both sensors are shown in HA on this moment. The only error i get often is:

Updating state for sensor.binnen_project_carbon_monoxide (<class 'custom_components.uhooair.sensor.UhooAirSensor'>) took 3.450 seconds. Please report platform to the developers at https://goo.gl/Nvioub

Maybe you can something with this info. Hope to hear from you if there must be an adjustment for how many api calls per hour is accepted.

mcclown commented 5 years ago

Yeah, I know about that warning message. I'll be rewriting this to be asynchronous at some point, which should fix that.

For the moment is seems like this issue is resolved though, so I'll close it. Let me know if you have any other issues.