seanrees / prometheus-dyson

Prometheus client for DysonLink fans (Pure Hot+Cool)
MIT License
13 stars 9 forks source link

AttributeError: 'DysonPureHotCoolV2State' object has no attribute 'fan_mode' #10

Closed Scaredycrow closed 3 years ago

Scaredycrow commented 3 years ago

Hey there, seeing a new crash from time to time in my logs:

Main error appears:

AttributeError: 'DysonPureHotCoolV2State' object has no attribute 'fan_mode'

Jan 26 13:21:36 nuc systemd[1]: Started Prometheus metrics exporter for Dyson Hot+Cool fans.
Jan 26 13:21:37 nuc python3[131116]: 2021/01/26 13:21:37       INFO Starting up on port=8091
Jan 26 13:21:37 nuc python3[131116]: 2021/01/26 13:21:37       INFO Including devices marked "inactive" from the Dyson API
Jan 26 13:21:37 nuc python3[131116]: 2021/01/26 13:21:37       INFO Reading "/etc/prometheus-dyson/config.ini"
Jan 26 13:21:39 nuc python3[131116]: 2021/01/26 13:21:39       INFO Attempting to discover device "Living room" (serial=A1F-AU-MKA1196A) via zeroconf
Jan 26 13:21:40 nuc python3[131116]: 2021/01/26 13:21:40       INFO Monitoring "Living room" (serial=A1F-AU-MKA1196A)
Jan 26 15:21:49 nuc python3[131116]: Exception in thread Thread-2:
Jan 26 15:21:49 nuc python3[131116]: Traceback (most recent call last):
Jan 26 15:21:49 nuc python3[131116]:   File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
Jan 26 15:21:49 nuc python3[131116]:     self.run()
Jan 26 15:21:49 nuc python3[131116]:   File "/usr/lib/python3.8/threading.py", line 870, in run
Jan 26 15:21:49 nuc python3[131116]:     self._target(*self._args, **self._kwargs)
Jan 26 15:21:49 nuc python3[131116]:   File "/tmp/Bazel.runfiles_d946inax/runfiles/pip_deps_pypi__paho_mqtt_1_5_1/paho/mqtt/client.py", line 3452, in _thread_main
Jan 26 15:21:49 nuc python3[131116]:     self.loop_forever(retry_first_connection=True)
Jan 26 15:21:49 nuc python3[131116]:   File "/tmp/Bazel.runfiles_d946inax/runfiles/pip_deps_pypi__paho_mqtt_1_5_1/paho/mqtt/client.py", line 1779, in loop_forever
Jan 26 15:21:49 nuc python3[131116]:     rc = self.loop(timeout, max_packets)
Jan 26 15:21:49 nuc python3[131116]:   File "/tmp/Bazel.runfiles_d946inax/runfiles/pip_deps_pypi__paho_mqtt_1_5_1/paho/mqtt/client.py", line 1181, in loop
Jan 26 15:21:49 nuc python3[131116]:     rc = self.loop_read(max_packets)
Jan 26 15:21:49 nuc python3[131116]:   File "/tmp/Bazel.runfiles_d946inax/runfiles/pip_deps_pypi__paho_mqtt_1_5_1/paho/mqtt/client.py", line 1572, in loop_read
Jan 26 15:21:49 nuc python3[131116]:     rc = self._packet_read()
Jan 26 15:21:49 nuc python3[131116]:   File "/tmp/Bazel.runfiles_d946inax/runfiles/pip_deps_pypi__paho_mqtt_1_5_1/paho/mqtt/client.py", line 2310, in _packet_read
Jan 26 15:21:49 nuc python3[131116]:     rc = self._packet_handle()
Jan 26 15:21:49 nuc python3[131116]:   File "/tmp/Bazel.runfiles_d946inax/runfiles/pip_deps_pypi__paho_mqtt_1_5_1/paho/mqtt/client.py", line 2936, in _packet_handle
Jan 26 15:21:49 nuc python3[131116]:     return self._handle_publish()
Jan 26 15:21:49 nuc python3[131116]:   File "/tmp/Bazel.runfiles_d946inax/runfiles/pip_deps_pypi__paho_mqtt_1_5_1/paho/mqtt/client.py", line 3216, in _handle_publish
Jan 26 15:21:49 nuc python3[131116]:     self._handle_on_message(message)
Jan 26 15:21:49 nuc python3[131116]:   File "/tmp/Bazel.runfiles_d946inax/runfiles/pip_deps_pypi__paho_mqtt_1_5_1/paho/mqtt/client.py", line 3444, in _handle_on_message
Jan 26 15:21:49 nuc python3[131116]:     self.on_message(self, self._userdata, message)
Jan 26 15:21:49 nuc python3[131116]:   File "/tmp/Bazel.runfiles_d946inax/runfiles/pip_deps_pypi__libpurecool_0_6_4/libpurecool/dyson_pure_cool_link.py", line 100, in on_message
Jan 26 15:21:49 nuc python3[131116]:     function(device_msg)
Jan 26 15:21:49 nuc python3[131116]:   File "/tmp/Bazel.runfiles_d946inax/runfiles/__main__/metrics.py", line 142, in update
Jan 26 15:21:49 nuc python3[131116]:     self.updatePureCoolV2State(name, serial, message)
Jan 26 15:21:49 nuc python3[131116]:   File "/tmp/Bazel.runfiles_d946inax/runfiles/__main__/metrics.py", line 285, in updatePureCoolV2State
Jan 26 15:21:49 nuc python3[131116]:     name, serial, message.fan_mode, fan_mode)
Jan 26 15:21:49 nuc python3[131116]: AttributeError: 'DysonPureHotCoolV2State' object has no attribute 'fan_mode'
seanrees commented 3 years ago

Is your tree at the latest HEAD? I think this should be fixed with nickrw@'s pull request #9

Scaredycrow commented 3 years ago

You may indeed be right! Would this change propagate if I'm using the bazel build :main-deb option?

seanrees commented 3 years ago

Yes, it would -- but it won't be automatic. You'll need to rebuild and reinstall the .deb, I put an incantation below with the needed steps in case it helps :-)

% git pull
% bazel build :main-deb
% sudo dpkg -i bazel-bin/*.deb
% sudo service prometheus-dyson restart
seanrees commented 3 years ago

Going to go with the assumption that #9 solves this and am closing this out -- feel free to reopen if that's a misfire :)