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

Error "invalid literal for int() with base 10: 'INIT'" in Home Assistant #35

Open
cjmjmartens opened this issue Feb 4, 2021 · 1 comment

Comments

@cjmjmartens
Copy link

In Home Assistant, I get the following error often: unhandled exception for the Dyson integration:

Source: /usr/src/homeassistant/homeassistant/bootstrap.py:310
First occurred: 21:10:31 (1 occurrences)
Last logged: 21:10:31

Uncaught thread exception
Traceback (most recent call last):
File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3452, in _thread_main
self.loop_forever(retry_first_connection=True)
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1779, in loop_forever
rc = self.loop(timeout, max_packets)
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1181, in loop
rc = self.loop_read(max_packets)
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1572, in loop_read
rc = self._packet_read()
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 2310, in _packet_read
rc = self._packet_handle()
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 2936, in _packet_handle
return self._handle_publish()
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3216, in _handle_publish
self._handle_on_message(message)
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3444, in _handle_on_message
self.on_message(self, self._userdata, message)
File "/usr/local/lib/python3.8/site-packages/libpurecool/dyson_pure_cool_link.py", line 106, in on_message
device_msg = DysonEnvironmentalSensorState(payload)
File "/usr/local/lib/python3.8/site-packages/libpurecool/dyson_pure_state.py", line 122, in init
self._dust = int(self.__get_field_value(data, 'pact'))
ValueError: invalid literal for int() with base 10: 'INIT'

@Raamkonijn
Copy link

Raamkonijn commented Feb 19, 2021

I've had the same problem with libpurecool + HP02. I'm not experienced with python/git, but i've managed to make it work on Ubuntu 20.04 + Python 3.8.5.

git clone https://github.com/bfayers/libpurecool.git
cd libpurecool/
git checkout fix_auth

Now edit the file ./libpurecool/libpurecool/dyson_pure_state.py
line 117/118:

self._volatil_compounds = 0 if volatil_copounds == 'INIT' else int(
            volatil_copounds)

to

self._volatil_compounds = 0 if volatil_copounds == 'INIT' else str(
            volatil_copounds)

and edit line 122:
self._dust = int(self.__get_field_value(data, 'pact'))
to
self._dust = str(self.__get_field_value(data, 'pact'))

and install
sudo python3 setup.py install

I don't know how Home Assistent works, but you could try to edit /usr/local/lib/python3.8/site-packages/libpurecool/dyson_pure_state.py and make the same changes I did.

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

2 participants