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

Fix KeyError when sceneId is missing #114

Merged
merged 1 commit into from
Feb 9, 2022

Conversation

bdraco
Copy link
Contributor

@bdraco bdraco commented Feb 9, 2022

No description provided.

@bdraco
Copy link
Contributor Author

bdraco commented Feb 9, 2022

I just had some more devices show up so I'm going to see if I can add motion sensor support

@codecov-commenter
Copy link

codecov-commenter commented Feb 9, 2022

Codecov Report

Merging #114 (54f930c) into master (f345bdc) will increase coverage by 0.19%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #114      +/-   ##
==========================================
+ Coverage   75.32%   75.52%   +0.19%     
==========================================
  Files          12       12              
  Lines         762      764       +2     
==========================================
+ Hits          574      577       +3     
+ Misses        188      187       -1     
Impacted Files Coverage Δ
pywizlight/bulb.py 78.78% <100.00%> (+0.39%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f345bdc...54f930c. Read the comment docs.

@bdraco bdraco force-pushed the guard_missing_sceneId branch 2 times, most recently from 87fac2a to 79eadb8 Compare February 9, 2022 19:47
@sbidy sbidy merged commit 950cdb8 into sbidy:master Feb 9, 2022
@sbidy
Copy link
Owner

sbidy commented Feb 9, 2022

I'm not sure, but I think the motion sensor is a BLE device and doesn't communicate via Wi-Fi. Do you have one?

@bdraco
Copy link
Contributor Author

bdraco commented Feb 9, 2022

Just got one. Unboxing it now

@bdraco
Copy link
Contributor Author

bdraco commented Feb 9, 2022

Looks like its detectable on the light with src pir

2022-02-09 14:51:58 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.209.205', 49155): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb5087933b","rssi":-60,"src":"pir","state":false,"sceneId":0,"temp":2762,"dimming":100}}'
2022-02-09 14:51:58 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.212.173', 49154): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb509c1599","rssi":-70,"src":"pir","state":false,"sceneId":0}}'

@bdraco
Copy link
Contributor Author

bdraco commented Feb 9, 2022

2022-02-09 14:51:58 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.212.173', 49154): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb509c1599","rssi":-70,"src":"pir","state":false,"sceneId":0}}'
2022-02-09 14:52:08 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.212.173', 49154): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb509c1599","rssi":-68,"src":"pir","state":false,"sceneId":0}}'
2022-02-09 14:52:09 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.212.173', 49154): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb509c1599","rssi":-70,"src":"pir","state":false,"sceneId":0}}'
2022-02-09 14:52:28 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.212.173', 49154): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb509c1599","rssi":-67,"src":"pir","state":false,"sceneId":0}}'
2022-02-09 14:52:29 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.212.173', 49154): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb509c1599","rssi":-68,"src":"pir","state":false,"sceneId":0}}'
2022-02-09 14:52:49 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.212.173', 49154): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb509c1599","rssi":-68,"src":"pir","state":false,"sceneId":0}}'
2022-02-09 14:52:49 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.212.173', 49154): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb509c1599","rssi":-68,"src":"pir","state":false,"sceneId":0}}'
2022-02-09 14:53:08 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.212.173', 49154): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb509c1599","rssi":-68,"src":"pir","state":false,"sceneId":0}}'
2022-02-09 14:53:09 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.212.173', 49154): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb509c1599","rssi":-68,"src":"pir","state":false,"sceneId":0}}'
2022-02-09 14:53:28 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.212.173', 49154): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb509c1599","rssi":-67,"src":"pir","state":false,"sceneId":0}}'
2022-02-09 14:53:29 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.212.173', 49154): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb509c1599","rssi":-68,"src":"pir","state":false,"sceneId":0}}'
2022-02-09 14:53:40 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.214.216', 64299): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb50d46a1c","rssi":-48,"src":"pir","state":true,"sceneId":27,"speed":100,"dimming":100}}'
2022-02-09 14:53:40 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.212.68', 52195): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"6c2990f7743e","rssi":-45,"src":"pir","state":true,"sceneId":27,"speed":100,"dimming":100}}'
2022-02-09 14:53:40 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.211.79', 49156): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb50818e7c","rssi":-57,"src":"pir","state":true,"sceneId":27,"speed":100,"dimming":100}}'
2022-02-09 14:53:40 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.210.189', 49156): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb509c0e96","rssi":-71,"src":"pir","state":true,"sceneId":0}}'
2022-02-09 14:53:40 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.212.173', 49154): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb509c1599","rssi":-69,"src":"pir","state":true,"sceneId":0}}'
2022-02-09 14:53:48 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.212.68', 52195): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"6c2990f7743e","rssi":-44,"src":"pir","state":true,"sceneId":27,"speed":100,"dimming":100}}'
2022-02-09 14:53:48 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.212.173', 49154): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb509c1599","rssi":-71,"src":"pir","state":true,"sceneId":0}}'
2022-02-09 14:53:48 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.211.79', 49156): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb50818e7c","rssi":-59,"src":"pir","state":true,"sceneId":27,"speed":100,"dimming":100}}'
2022-02-09 14:53:48 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.210.189', 49156): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb509c0e96","rssi":-72,"src":"pir","state":true,"sceneId":0}}'
2022-02-09 14:53:49 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.212.173', 49154): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb509c1599","rssi":-71,"src":"pir","state":true,"sceneId":0}}'
2022-02-09 14:53:49 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.212.68', 52195): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"6c2990f7743e","rssi":-44,"src":"pir","state":true,"sceneId":27,"speed":100,"dimming":100}}'
2022-02-09 14:53:49 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.211.79', 49156): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb50818e7c","rssi":-57,"src":"pir","state":true,"sceneId":27,"speed":100,"dimming":100}}'
2022-02-09 14:53:49 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.210.189', 49156): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb509c0e96","rssi":-72,"src":"pir","state":true,"sceneId":0}}'
2022-02-09 14:53:51 DEBUG (MainThread) [pywizlight.push_manager] ('192.168.214.216', 64299): PUSH << b'{"method":"syncPilot","env":"pro","params":{"mac":"a8bb50d46a1c","rssi":-48,"src":"pir","state":true,"sceneId":27,"speed":100,"dimming":100}}'

@sbidy
Copy link
Owner

sbidy commented Feb 9, 2022

Does the motion sensor provide a UDP interface?

@bdraco
Copy link
Contributor Author

bdraco commented Feb 9, 2022

The motion sensor is BLE only so we have to get the state from the light

@sbidy
Copy link
Owner

sbidy commented Feb 9, 2022

Ah, ok. But the state change at the bulb property should be fast enough to avoid a latency gap.

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

Successfully merging this pull request may close these issues.

None yet

3 participants