Skip to content

Prevent crash from corrupt thermostat record - #20

Open
rossbeazley wants to merge 3 commits into
Juerd:masterfrom
rossbeazley:master
Open

Prevent crash from corrupt thermostat record#20
rossbeazley wants to merge 3 commits into
Juerd:masterfrom
rossbeazley:master

Conversation

@rossbeazley

Copy link
Copy Markdown

The cube is unstable (i understand) and so its possible for max to stop working when this happens, boiler control will stop and things can get a little frosty ;)

output might be like

$ ~/workspace/eq3/eq3-max/bin/max 
Found cube at 192.168.10.145
Unexpected device 0cfb4d at /home/rdlb/workspace/eq3/eq3-max/bin/../lib/Max.pm line 126, <GEN2> line 7.
Can't call method "_set" on an undefined value at /home/rdlb/workspace/eq3/eq3-max/bin/../lib/Max.pm line 129, <GEN2> line 7.

even forgetting the device cant work

$ ~/workspace/eq3/eq3-max/bin/max forget 0cfb4d
Found cube at 192.168.10.145
Unexpected device 0cfb4d at /home/rdlb/workspace/eq3/eq3-max/bin/../lib/Max.pm line 126, <GEN2> line 7.
Can't call method "_set" on an undefined value at /home/rdlb/workspace/eq3/eq3-max/bin/../lib/Max.pm line 129, <GEN2> line 7

this PR simply guards against this undefined $device

and even though it looks like things are not good, the device can then be forgotten and things recover

$ ~/workspace/eq3/eq3-max/bin/max forget 0cfb4d
Found cube at 192.168.10.145
Unexpected device 0cfb4d at /home/rdlb/workspace/eq3/eq3-max/bin/../lib/Max.pm line 126, <GEN2> line 7.
Unexpected device 0ad98d at /home/rdlb/workspace/eq3/eq3-max/bin/../lib/Max.pm line 126, <GEN2> line 7.
Unexpected device 09ed2a at /home/rdlb/workspace/eq3/eq3-max/bin/../lib/Max.pm line 126, <GEN2> line 7.
Unexpected device 0bda40 at /home/rdlb/workspace/eq3/eq3-max/bin/../lib/Max.pm line 126, <GEN2> line 7.
Unexpected device 0bda32 at /home/rdlb/workspace/eq3/eq3-max/bin/../lib/Max.pm line 126, <GEN2> line 7.
Unexpected device 09ed35 at /home/rdlb/workspace/eq3/eq3-max/bin/../lib/Max.pm line 126, <GEN2> line 7.
Unexpected device 0bef2a at /home/rdlb/workspace/eq3/eq3-max/bin/../lib/Max.pm line 126, <GEN2> line 7.
Done.

$ ~/workspace/eq3/eq3-max/bin/max 
Found cube at 192.168.10.145
* Kitchen(1)         0.0 →  0.0   
* TV(2)              0.0 → 21.5    74%
* Conservatory(3)   18.2 → 19.5    65%
* Tech Room(4)       0.0 → 19.0     0%
* Hall(5)           20.0 → 20.5    25%
* Bedroom 2(6) 19.6 → 19.0    13%
* Bathroom(7)       18.6 → 19.5    20%
* Bedroom(8)         0.0 → 19.0     0%
* Office(9)     0.0 → 18.5     0%
* Loft(10)           0.0 → 18.0     0%

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.

1 participant