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

Climate.py error #10

Closed
omribenami opened this issue May 6, 2019 · 8 comments
Closed

Climate.py error #10

omribenami opened this issue May 6, 2019 · 8 comments

Comments

@omribenami
Copy link

Hey.
After install i get the following error (hassbian 0.92.2, RPI3):

Update for climate.4th_room_ac failsTraceback (most recent call last): File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 220, in async_update_ha_state await self.async_device_update() File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 377, in async_device_update await self.hass.async_add_executor_job(self.update) File "/usr/lib/python3.5/asyncio/futures.py", line 380, in iter yield self # This tells Task to wait for completion. File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup future.result() File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result raise self._exception File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run result = self.fn(*self.args, **self.kwargs) File "/home/homeassistant/.homeassistant/custom_components/gree/climate.py", line 408, in update self.SyncState() File "/home/homeassistant/.homeassistant/custom_components/gree/climate.py", line 326, in SyncState currentValues = self.GreeGetValues(optionsToFetch) File "/home/homeassistant/.homeassistant/custom_components/gree/climate.py", line 224, in GreeGetValues return self.FetchResult(self.CIPHER, self._ip_addr, self._port, jsonPayloadToSend)['dat'] File "/home/homeassistant/.homeassistant/custom_components/gree/climate.py", line 192, in FetchResult receivedJson = simplejson.loads(data) File "/usr/lib/python3.5/json/init.py", line 312, in loads s.class.name)) TypeError: the JSON object must be str, not 'bytes'

Thank you for the amazing effort!

@RobHofmann
Copy link
Owner

Do you have simplejson installed? Im running HASSIO so it gets fixed automatically (if I recall correctly). I think you need to install modules on hassbian.

Let me know :)

@RobHofmann RobHofmann added the help wanted Extra attention is needed label May 6, 2019
@omribenami
Copy link
Author

omribenami commented May 6, 2019 via email

@omribenami
Copy link
Author

hi.
installed simplejson and running python 3.5.3
unfortunatly no good news :(

Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File "/usr/lib/python3.5/asyncio/tasks.py", line 400, in wait_for
return fut.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "/usr/lib/python3.5/asyncio/coroutines.py", line 210, in coro
res = func(*args, **kw)
File "/home/homeassistant/.homeassistant/custom_components/gree/climate.py", line 113, in async_setup_platform
GreeClimate(hass, name, ip_addr, port, mac_addr, min_temp, max_temp, target_temp, target_temp_step, temp_sensor_entity_id, operation_list, fan_list, swing_updn_mode_list, default_operation, default_fan_mode, default_operation_from_idle, default_swing_updn_mode, encryption_key, uid)
File "/home/homeassistant/.homeassistant/custom_components/gree/climate.py", line 152, in init
self._encryption_key = self.GetDeviceKey().encode("utf8")
File "/home/homeassistant/.homeassistant/custom_components/gree/climate.py", line 220, in GetDeviceKey
return self.FetchResult(cipher, self._ip_addr, self._port, jsonPayloadToSend)['key']
File "/home/homeassistant/.homeassistant/custom_components/gree/climate.py", line 192, in FetchResult
receivedJson = simplejson.loads(data)
File "/usr/lib/python3.5/json/init.py", line 312, in loads
s.class.name))
TypeError: the JSON object must be str, not 'bytes'

@RobHofmann
Copy link
Owner

Hi, im not sure why this is going wrong. Maybe, if possible, you can switch to HASSIO? All dependencies will be fixed for you in that distro.

Unfortunately I dont have a test-setup with hassbian available.

@srozb
Copy link

srozb commented May 15, 2019

Hi, looks like recvfrom method returns bytes type as described here, and simplejson.loads method expects string. Perhaps decode() will solve that.

@RobHofmann
Copy link
Owner

@omribenami can you try the suggestion from @srozb and let us know?

@omribenami
Copy link
Author

guys with a help of a friend i got it fixed... it turned out to be like rob said... a lack of Simplejson..ive installed it on PIP command instead of PIP3... i still got an time out error because climate.py couldnt fetch the encryption keys but i extracted them myself and now its fully working. tnx for the help you guys and tnx for effort bringing gree to HA Rob!!

@RobHofmann RobHofmann removed the help wanted Extra attention is needed label May 16, 2019
@RobHofmann
Copy link
Owner

Glad to hear! Enjoy.

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