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

Wyze Sense sensor support removed from last releases #168

Closed
mmichon opened this issue May 13, 2021 · 6 comments
Closed

Wyze Sense sensor support removed from last releases #168

mmichon opened this issue May 13, 2021 · 6 comments

Comments

@mmichon
Copy link

mmichon commented May 13, 2021

After upgrading to 2021.5.6, my 5 Wyze Sense sensors (contact and motion) sensors have disappeared. I have 10 cameras, each now with 10 binary_sensor motion sensors, and 10 on/off switches.

I'm seeing this ~40 seconds after bootup and every 1-8 minutes thereafter:

May 12 18:12:27 pi hass[573]: 2021-05-12 18:12:27 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating wyzeapi binary_sensor took longer than the scheduled update interval 0:00:10
May 12 18:17:47 pi hass[573]: 2021-05-12 18:17:47 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating wyzeapi binary_sensor took longer than the scheduled update interval 0:00:10
May 12 18:21:37 pi hass[573]: 2021-05-12 18:21:37 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating wyzeapi binary_sensor took longer than the scheduled update interval 0:00:10
May 12 18:23:47 pi hass[573]: 2021-05-12 18:23:47 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating wyzeapi binary_sensor took longer than the scheduled update interval 0:00:10
May 12 18:31:47 pi hass[573]: 2021-05-12 18:31:47 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating wyzeapi binary_sensor took longer than the scheduled update interval 0:00:10
May 12 18:33:47 pi hass[573]: 2021-05-12 18:33:47 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating wyzeapi binary_sensor took longer than the scheduled update interval 0:00:10
May 12 18:44:27 pi hass[573]: 2021-05-12 18:44:27 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating wyzeapi binary_sensor took longer than the scheduled update interval 0:00:10
May 12 18:48:37 pi hass[573]: 2021-05-12 18:48:37 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating wyzeapi binary_sensor took longer than the scheduled update interval 0:00:10
May 12 18:49:37 pi hass[573]: 2021-05-12 18:49:37 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating wyzeapi binary_sensor took longer than the scheduled update interval 0:00:10
May 12 18:49:57 pi hass[573]: 2021-05-12 18:49:57 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating wyzeapi binary_sensor took longer than the scheduled update interval 0:00:10
May 12 18:49:58 pi hass[573]: 2021-05-12 18:49:58 WARNING (MainThread) [homeassistant.helpers.entity] Update of binary_sensor.bedroom is taking over 10 seconds
May 12 18:49:59 pi hass[573]: 2021-05-12 18:49:59 ERROR (MainThread) [homeassistant.helpers.entity] Update for binary_sensor.bedroom fails
May 12 18:49:59 pi hass[573]: Traceback (most recent call last):
May 12 18:49:59 pi hass[573]:   File "/home/pi/.homeassistant/deps/lib/python3.8/site-packages/urllib3/connection.py", line 169, in _new_conn
May 12 18:49:59 pi hass[573]:     conn = connection.create_connection(
May 12 18:49:59 pi hass[573]:   File "/home/pi/.homeassistant/deps/lib/python3.8/site-packages/urllib3/util/connection.py", line 73, in create_connection
May 12 18:49:59 pi hass[573]:     for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
May 12 18:49:59 pi hass[573]:   File "/usr/local/lib/python3.8/socket.py", line 918, in getaddrinfo
May 12 18:49:59 pi hass[573]:     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
May 12 18:49:59 pi hass[573]: socket.gaierror: [Errno -3] Temporary failure in name resolution
May 12 18:49:59 pi hass[573]: During handling of the above exception, another exception occurred:
May 12 18:49:59 pi hass[573]: Traceback (most recent call last):
May 12 18:49:59 pi hass[573]:   File "/home/pi/.homeassistant/deps/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen
May 12 18:49:59 pi hass[573]:     httplib_response = self._make_request(
May 12 18:49:59 pi hass[573]:   File "/home/pi/.homeassistant/deps/lib/python3.8/site-packages/urllib3/connectionpool.py", line 382, in _make_request
May 12 18:49:59 pi hass[573]:     self._validate_conn(conn)
May 12 18:49:59 pi hass[573]:   File "/home/pi/.homeassistant/deps/lib/python3.8/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
May 12 18:49:59 pi hass[573]:     conn.connect()
May 12 18:49:59 pi hass[573]:   File "/home/pi/.homeassistant/deps/lib/python3.8/site-packages/urllib3/connection.py", line 353, in connect
May 12 18:49:59 pi hass[573]:     conn = self._new_conn()
May 12 18:49:59 pi hass[573]:   File "/home/pi/.homeassistant/deps/lib/python3.8/site-packages/urllib3/connection.py", line 181, in _new_conn
May 12 18:49:59 pi hass[573]:     raise NewConnectionError(
May 12 18:49:59 pi hass[573]: urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x6949a358>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution
May 12 18:49:59 pi hass[573]: During handling of the above exception, another exception occurred:
May 12 18:49:59 pi hass[573]: Traceback (most recent call last):
May 12 18:49:59 pi hass[573]:   File "/home/pi/.homeassistant/deps/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
May 12 18:49:59 pi hass[573]:     resp = conn.urlopen(
May 12 18:49:59 pi hass[573]:   File "/home/pi/.homeassistant/deps/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen
May 12 18:49:59 pi hass[573]:     retries = retries.increment(
May 12 18:49:59 pi hass[573]:   File "/home/pi/.homeassistant/deps/lib/python3.8/site-packages/urllib3/util/retry.py", line 574, in increment
May 12 18:49:59 pi hass[573]:     raise MaxRetryError(_pool, url, error or ResponseError(cause))
May 12 18:49:59 pi hass[573]: urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.wyzecam.com', port=443): Max retries exceeded with url: /app/v2/device/get_event_list (Caused by NewConnectionError('<urllib3.connection.HTTPSConnec
May 12 18:49:59 pi hass[573]: During handling of the above exception, another exception occurred:
May 12 18:49:59 pi hass[573]: Traceback (most recent call last):
May 12 18:49:59 pi hass[573]:   File "/home/pi/.local/lib/python3.8/site-packages/homeassistant/helpers/entity.py", line 316, in async_update_ha_state
May 12 18:49:59 pi hass[573]:     await self.async_device_update()
...skipping...
@faanskit
Copy link
Contributor

faanskit commented May 16, 2021

Noted the same, and in #170 I have updated scan interval to 20 s.

binary_sensor.py

21: -SCAN_INTERVAL = timedelta(seconds=10)
21: +SCAN_INTERVAL = timedelta(seconds=20)

Number of cameras installed will extend the time it takes to update. Possible that refactoring is required to reduce number of requests to Wyze.

I.e.
For each camera, get_latest_event() in Wyzeapy is called on a regular interval (10 sec).
This result in a /get_event_list call to Wyze, for each camera. With 10 cameras, 10 lists more or less in parallel. If PR #170 is approved, double that.

A caching implementation in Wyzeapy would be of preference.
E.g.
For each camera, get_latest_event() in Wyzeapy is called on a regular interval (10 sec).
The result comes from a cached value in Wyzeapy.
When get_event_list() in base_client.py is called, return value from cache.
If cache is more that 10 sec old, call performed /get_event_list call to Wyze

@faanskit
Copy link
Contributor

Oh..I noted that in #129, support for sensors were removed. Don't know why.

@mmichon
Copy link
Author

mmichon commented May 16, 2021

Thanks @faanskit, totally missed that in the notes. But yep, it's all removed. Going to revert back.

@JoshuaMulliken would love to know why they were removed, since they were working beautifully!

@faanskit
Copy link
Contributor

Thanks @faanskit, totally missed that in the notes. But yep, it's all removed. Going to revert back.

I have submitted a PR for Wyzeay that allows for sensors again.

When/if that is approved I intend a PR in ha-wyzeapi to bring back sensors.

@mmichon mmichon changed the title Updating wyzeapi binary_sensor took longer than the scheduled update interval Wyze sensor support removed from last releases May 16, 2021
@mmichon
Copy link
Author

mmichon commented May 16, 2021

Thanks @faanskit! Updated the issue title accordingly.

@mmichon mmichon changed the title Wyze sensor support removed from last releases Wyze Sense sensor support removed from last releases May 16, 2021
@SecKatie
Copy link
Owner

Please see #164

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