twrecked / hass-aarlo

Asynchronous Arlo Component for Home Assistant
GNU Lesser General Public License v3.0
383 stars 77 forks source link

Issue with modes being set #461

Open lexiismadd opened 3 years ago

lexiismadd commented 3 years ago

It appears that the service "alarm_control_panel.alarm_disarm" doesn't work with Aarlo, even with the setting setup correctly in configuration.yaml. My configuration.yaml entry is:

`alarm_control_panel:

All other alarm_control_panel services work, just not alarm_disarm. Is this a known issue in Aarlo?

twrecked commented 3 years ago

Some people have issues with the alarms but they generally work.

What kind of base station are you using?

And is there anything in the log (home-assistant.log) showing an error?

lexiismadd commented 3 years ago

I'm using the VMB4000r3 base station.

The only error I can find relating to aarlo is this:

ERROR (ArloEventStream) [pyaarlo] general-error=HTTPError
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 697, in _update_chunk_length
    self.chunk_left = int(line, 16)
ValueError: invalid literal for int() with base 16: b''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 438, in _error_catcher
    yield
  File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 764, in read_chunked
    self._update_chunk_length()
  File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 701, in _update_chunk_length
    raise InvalidChunkLength(self, line)
urllib3.exceptions.InvalidChunkLength: InvalidChunkLength(got length b'', 0 bytes read)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 753, in generate
    for chunk in self.raw.stream(chunk_size, decode_content=True):
  File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 572, in stream
    for line in self.read_chunked(amt, decode_content=decode_content):
  File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 793, in read_chunked
    self._original_response.close()
  File "/usr/local/lib/python3.8/contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.8/site-packages/urllib3/response.py", line 455, in _error_catcher
    raise ProtocolError("Connection broken: %r" % e, e)
urllib3.exceptions.ProtocolError: ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/aarlo/pyaarlo/sseclient.py", line 83, in __next__
    next_chunk = next(self.resp_iterator)
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 756, in generate
    raise ChunkedEncodingError(e)
requests.exceptions.ChunkedEncodingError: ("Connection broken: InvalidChunkLength(got length b'', 0 bytes read)", InvalidChunkLength(got length b'', 0 bytes read))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/aarlo/pyaarlo/backend.py", line 423, in _ev_thread_main
    self._ev_loop(self._ev_stream)
  File "/config/custom_components/aarlo/pyaarlo/backend.py", line 308, in _ev_loop
    for event in stream:
  File "/config/custom_components/aarlo/pyaarlo/sseclient.py", line 100, in __next__
    self._connect()
  File "/config/custom_components/aarlo/pyaarlo/sseclient.py", line 71, in _connect
    self.resp.raise_for_status()
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 943, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 504 Server Error: Gateway Time-out for url: https://arlo.netgear.com//hmsweb/client/subscribe
lexiismadd commented 3 years ago

Moving another same issue I'm having to this issue:

Hello, I'm experiencing issues with Aarlo setting modes using the aarlo.alarm_set_mode service. The problem seems to be very intermittent, and when debugging is enabled, is less problematic. I find that often the service does not actual set the mode. The debug logs even show that its set to "armed" (or "disarmed" depending on what I am setting), but Arlo itself is not switching to that mode.

Here's an example from my hassio log when I tried to arm:

2021-06-23 12:58:45 DEBUG (ArloEventStream) [pyaarlo] sseclient-error=ChunkedEncodingError
2021-06-23 12:58:50 DEBUG (ArloEventStream) [pyaarlo] Fetching device list after ev-reconnect
2021-06-23 12:59:05 DEBUG (ArloBackgroundWorker) [pyaarlo] pinging Arlo Home
2021-06-23 12:59:07 DEBUG (ArloBackgroundWorker) [pyaarlo] set:ArloBase/4RE1737KA107B/connectionState=available
2021-06-23 12:59:07 DEBUG (ArloBackgroundWorker) [custom_components.aarlo.binary_sensor] callback:Connected Arlo Home:connectionState:available
2021-06-23 12:59:17 INFO (SyncWorker_2) [custom_components.aarlo.alarm_control_panel] alarm_set_mode service called
2021-06-23 12:59:17 DEBUG (SyncWorker_2) [custom_components.aarlo.alarm_control_panel] Arlo Home set mode to armed
2021-06-23 12:59:17 DEBUG (SyncWorker_2) [pyaarlo] no mode change needed
2021-06-23 12:59:17 INFO (SyncWorker_2) [custom_components.aarlo.alarm_control_panel] alarm_control_panel.aarlo_arlo_home setting mode to armed

However if I go to the Arlo app, its still showing as Disarmed. The same happens when I do the reverse (try to disarm when armed).

It seems to be very intermittent from what I can see too. After a reboot of HASSIO, it works the first 1-2 times ok, but then starts failing again..

lexiismadd commented 3 years ago

For those looking for a workaround until this is fixed:

I've actually gone ahead and set it up to regularly check the Arlo state and set it to its correct value if it's wrong. I've done that with a time pattern automation and adding "refresh_modes_every: 1" under aarlo in configuration.yaml. That addition to configuration.yaml causes my Arlo (in HA) to poll Arlo's servers and refresh its current mode every 1 minute in HASS. I then setup a sensor template for presence detection for both my partner and I. If we are both away, the sensor goes to false, but if either or both of us are home, it sets its state to true. I then set a time pattern automation to run every /1 minute to check for presence state and if its false, it sets the mode to armed. If its true, it sets to disarmed. For some reason this works. I can't say flawlessly yet because I only set it up today, but in tests it hasn't failed and has set the mode every time, depending on the presence state.

TheDK commented 3 years ago

Damn, I missed that @twrecked already implemented refresh_mode - I will try that...

twrecked commented 3 years ago

@alexisspencer what version of code are you on? And what is your main aarlo config?

edit: I'll also check the set mode functionality here.

lexiismadd commented 3 years ago

@alexisspencer what version of code are you on? And what is your main aarlo config?

edit: I'll also check the set mode functionality here.

I'm on the latest version - i made sure of that yesterday before posting in here..

My aarlo config is:

aarlo:
  username: <sanitised>
  password: <sanitised>
  host: https://arlo.netgear.com/
  refresh_devices_every: 2
  stream_timeout: 120
  refresh_modes_every: 1
  reconnect_every: 30
  request_timeout: 120
  packet_dump: false
twrecked commented 3 years ago

Try without seeing the host.

(Sorry for brief reply, on phone)

On Wed., Jun. 23, 2021, 19:16 alexisspencer, @.***> wrote:

@alexisspencer https://github.com/alexisspencer what version of code are you on? And what is your main aarlo config?

edit: I'll also check the set mode functionality here.

I'm on the latest version - i made sure of that yesterday before posting in here..

My aarlo config is:

aarlo: username: password: host: https://arlo.netgear.com/ refresh_devices_every: 2 stream_timeout: 120 refresh_modes_every: 1 reconnect_every: 30 request_timeout: 120 packet_dump: false

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/twrecked/hass-aarlo/issues/461#issuecomment-867218889, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALHJU6SBFM7WZF2GDD6V2TLTUJTMFANCNFSM47CSLBKA .

twrecked commented 3 years ago

That mean to read "without setting the host"...

aarlo:
  username: <sanitised>
  password: <sanitised>
  refresh_devices_every: 2
  stream_timeout: 120
  refresh_modes_every: 1
  reconnect_every: 30
  request_timeout: 120
  packet_dump: false