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

Failed to read current modes correctly #99

Open
m0urs opened this issue Jul 2, 2022 · 17 comments
Open

Failed to read current modes correctly #99

m0urs opened this issue Jul 2, 2022 · 17 comments
Assignees

Comments

@m0urs
Copy link

m0urs commented Jul 2, 2022

Since a few weeks I do have again the problem, that my script is no longer correctly reading the current mode of my camera and my lights. After the first connect to Arlo, the modes are read correctly. If I then change the mode via the script, the mode is changed correctly also, but then, if I try to reread the current mode, it does not reflect the current one but still the old one.

It looks rather similar to this older issue #77.

Basically what my script is doing:

# Get the base object for the device
base = getDeviceFromName("Base",arlo.base_stations)
# Set the mode for the device to the specified value
base.mode = 'disarmed'

The above does work correctly. If I check with the Arlo app, the mode is set to the correct value.

# Get the base object for the device
base = getDeviceFromName("Base",arlo.base_stations)
# Get the current mode for that device
status = base.mode

This does not work. The "status" is still the one it had after the initial connect to Arlo and the initial reading of the state.

I enclose a debug file which has the following timestamps:

Before setting the mode: 2022-07-02 14:09:13,655
After setting the mode: 2022-07-02 14:10:08,375
Before getting the mode: 2022-07-02 14:11:37,357 
After getting the mode: 2022-07-02 14:11:51,436 

I am logging in with the following parameters:

arlo = pyaarlo.PyArlo(username=username, password=password,tfa_source='imap', tfa_type='email', tfa_host=tfa_host, tfa_username=tfa_username, tfa_password=tfa_password, synchronous_mode=False, refresh_devices_every=1,reconnect_every=90, stream_timeout=180, request_timeout=120, user_agent='arlo', verbose_debug=True)

Could you please have a look, if you can see, why this is no longer working? I did not change anything on my side and it worked a few months this way.

Thanks a lot.

UPDATE:

It seems that even setting the modes are most of the time working, but not always ...

Uploading debug-encrypted.log…

@Jopand
Copy link

Jopand commented Jul 7, 2022

In my setup it seems that modes are wrong in HA, if I use MQTT backend in aarlo. If I revert to SSE it seems to work.

@m0urs
Copy link
Author

m0urs commented Jul 8, 2022

Thanks. I was not aware of the "backend" parameter in PyArlo. Just tried to switch from ""mqtt" to "sse" and will try for some time to see if this improves something.

@m0urs
Copy link
Author

m0urs commented Jul 14, 2022

I can confirm that changing the backend from "mqtt" to "sse" solved the issues for me. It seems now reliable again.

@m0urs m0urs closed this as completed Jul 14, 2022
@Jopand
Copy link

Jopand commented Jul 14, 2022

I really don't think this issue should be closed. Because if I switch to "sse" backend, I cannot get livestream from HA. That works with "mqtt"... So it would be very nice to get this fixed. The backend switching was just meant to be a clue to where the bug might be

@Jopand
Copy link

Jopand commented Jul 21, 2022

@m0urs could you please reopen the issue?? It is still a bug

@m0urs
Copy link
Author

m0urs commented Jul 21, 2022

Reopened because the issue still seems to exist if the backend is set to "mqtt". For me with "sse" backend it is working correctly.

@m0urs m0urs reopened this Jul 21, 2022
@Jopand
Copy link

Jopand commented Jul 22, 2022

Is live streaming working for you when using sse? Because I can only get live streaming when using mqtt, and that's why I would reslly like to get this mode-issue solved

@m0urs
Copy link
Author

m0urs commented Jul 22, 2022

I cannot tell you. I am only using pyArlo to control the states of my cameras from within my FHEM home automation environment. E.g. switch them off if I open the door to the garden etc.

@twrecked
Copy link
Owner

@Jopand Can you get some traces of what happens when you start live streaming? I'd like to see the difference.

This describes how to turn on the debug.

And this explains how to encrypt the output. You only need to include the output around the time things fails.

@Jopand
Copy link

Jopand commented Jul 25, 2022

Will do today or tomorrow 👍

@Jopand
Copy link

Jopand commented Jul 27, 2022

Not working log. Backend set to "sse"
https://pastebin.com/5wQjkYW5

@twrecked
Copy link
Owner

twrecked commented Jul 28, 2022

Thanks, I got that. Can you attach one where it works?

edit: can you also paste in your config? Or tell me what the user_agent is. And can you tell me what you are trying to stream on to.

and can you add the lovelace card configuration.

Thanks!

edit #2; I think I'm seeing something similar here, I think they changed the protocol; I'll look some more. It still works with direct streaming.

@Jopand
Copy link

Jopand commented Jul 31, 2022

I just tried to make a log of a working stream. I cannot make any live stream work through Home Assistant now.
I get the same error in the log with invalid data:

2022-07-31 21:48:25 DEBUG (ArloEventStream) [pyaarlo] mqtt: connected=0
2022-07-31 21:48:25 DEBUG (ArloEventStream) [pyaarlo] topcs=
[]
2022-07-31 21:48:26 ERROR (stream_worker) [homeassistant.components.stream.stream.camera.aarlo_carport] Error from stream worker: Error opening stream (INVALIDDATA, Invalid data found when processing input) rtsps://arlostreaming01-z1-prod.wowza.arlo.com:443/vzmodulelive/59U17C7MB102A_EDITED_BY_ME?egressToken=542522EDITED_BY_ME&userAgent=iOS&cameraId=59U17EDITED_BY_ME&txnId=be!d17afd9EDITED_BY_ME

@twrecked
Copy link
Owner

twrecked commented Aug 2, 2022

My feeling is Arlo has changed their backend tto remove RTSP support - they don't need it any more since they swapped to mpeg-dash.

If you use the aarlo lovelace card you can try direct viewing, that still works for me here.

@twrecked twrecked self-assigned this Aug 2, 2022
@Jopand
Copy link

Jopand commented Aug 2, 2022

I have direct stream. It just doesn't work when the backend is sse:

entity: camera.aarlo_indkorsel
image_click: stream
image_view: direct
name: Alrum
show:
  - motion
  - sound
  - snapshot
  - battery_level
  - signal_strength
  - captured_today
  - image_date
top_date: false
top_status: false
top_title: false
type: custom:aarlo-glance

@twrecked
Copy link
Owner

twrecked commented Aug 2, 2022

You traces are showing it's not using direct; see the piece userAgent=iOS in the stream open request, it would use linux if it was trying direct. And the stream worker won't be starting.

Can you try saving that config and trying once based off this example configuration, your current config looks like a mix of old style and new style and I wonder if that is confusing it.

edit: expand link

@Jopand
Copy link

Jopand commented Aug 3, 2022

It worked... \o/ Thanks

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