glynhudson / leaf-python-mqtt

Extract data from Nissan Leaf API and post to mqtt
Apache License 2.0
24 stars 7 forks source link

Crash when receiving update 60s after starting heating... #7

Closed YanPelletier closed 6 years ago

YanPelletier commented 6 years ago

Hello,

I've integrated your development with my OpenHab2 server and I'm now having a little problem.

When I send a request to starting heating int my Leaf, the heating starts fine in the car, but something is going wrong in pycarwings2 and leaf-python-mqtt.py crash with a "KeyError: 'cruisingRangeAcOff'" after its 60s wainting.

The whole trace is :

INFO:root:publishing to MQTT base status topic: leaf/status INFO:root:leaf/control/leaf_update ON INFO:root:control sub-topic: leaf_update INFO:root:control message: ON INFO:root:leaf/control/climate 1 INFO:root:control sub-topic: climate INFO:root:control message: 1 INFO:root:Climate control command received: 1 INFO:root:Prepare Session climate control update INFO:root:Login... INFO:root:2018-01-25 23:37:33 INFO:root:Turning on climate control..wait 60s Exception in thread Thread-1: Traceback (most recent call last): File "/volume1/@appstore/python/lib/python2.7/threading.py", line 801, in __bootstrap_inner self.run() File "/volume1/@appstore/python/lib/python2.7/threading.py", line 754, in run self.target(*self.args, **self.kwargs) File "/volume1/@appstore/python/lib/python2.7/site-packages/paho/mqtt/client.py", line 2650, in _thread_main self.loop_forever(retry_first_connection=True) File "/volume1/@appstore/python/lib/python2.7/site-packages/paho/mqtt/client.py", line 1481, in loop_forever rc = self.loop(timeout, max_packets) File "/volume1/@appstore/python/lib/python2.7/site-packages/paho/mqtt/client.py", line 1003, in loop rc = self.loop_read(max_packets) File "/volume1/@appstore/python/lib/python2.7/site-packages/paho/mqtt/client.py", line 1284, in loop_read rc = self._packet_read() File "/volume1/@appstore/python/lib/python2.7/site-packages/paho/mqtt/client.py", line 1849, in _packet_read rc = self._packet_handle() File "/volume1/@appstore/python/lib/python2.7/site-packages/paho/mqtt/client.py", line 2305, in _packet_handle return self._handle_publish() File "/volume1/@appstore/python/lib/python2.7/site-packages/paho/mqtt/client.py", line 2500, in _handle_publish self._handle_on_message(message) File "/volume1/@appstore/python/lib/python2.7/site-packages/paho/mqtt/client.py", line 2647, in _handle_on_message self.on_message(self, self._userdata, message) File "./leaf-python-mqtt.py", line 68, in on_message climate_control(1) File "./leaf-python-mqtt.py", line 108, in climate_control start_cc_result = l.get_start_climate_control_result(result_key) File "/volume1/@appstore/python/lib/python2.7/site-packages/pycarwings2/pycarwings2.py", line 249, in get_start_climate_control_result return CarwingsStartClimateControlResponse(response) File "/volume1/@appstore/python/lib/python2.7/site-packages/pycarwings2/responses.py", line 319, in init__ self._set_cruising_ranges(status) File "/volume1/@appstore/python/lib/python2.7/site-packages/pycarwings2/responses.py", line 50, in _set_cruising_ranges self.cruising_range_ac_off_km = float(status[off_key]) / 1000 KeyError: 'cruisingRangeAcOff'

After that, "leaf-python-mqtt.py" need to be restarted if I want to do anything else.

One thing worth mentioning : I'm in Canada and therefore my region is NCI.

Thank you!

steintore commented 6 years ago

Hi!

I think this is a problem in the Pycarwings2-library, as the issue is reported here: https://github.com/jdhorne/pycarwings2/issues/21

glynhudson commented 6 years ago

Error from with pycarwings lib. Best follow up the issue on on the pycarwings repo. I will close this issue.