ownbee / ninebot-integration

Ninebot Scooter integration for Home Assistant
7 stars 4 forks source link

Ninebot Max does not update entity #5

Open JoeyGE0 opened 2 months ago

JoeyGE0 commented 2 months ago

integration works and provides all info needed but will only pull data when integration is first added. even after power cycle of scooter and shortly after the scooter Bluetooth is connected, it doesn't seem to update!

`This error originated from a custom integration.

Logger: custom_components.ninebot_scooter Source: components/bluetooth/active_update_processor.py:122 integration: Ninebot Scooter First occurred: 9:14:17 PM (2 occurrences) Last logged: 9:19:11 PM

F8:20:4F:11:A3:02: Failure while polling Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/bluetooth/active_update_processor.py", line 122, in _async_poll update = await self._async_poll_data(self._last_service_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/bluetooth/active_update_processor.py", line 115, in _async_poll_data return await self._poll_method(last_service_info) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/ninebot_scooter/init.py", line 52, in _async_poll return await data.async_poll(connectable_device) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/ninebot_ble/sensor.py", line 35, in async_poll await self.client.connect(device) File "/usr/local/lib/python3.12/site-packages/ninebot_ble/transport.py", line 119, in connect resp = await self.request(Packet(DeviceId.PC, DeviceId.ES_BLE, Command.INIT, 0)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/ninebot_ble/transport.py", line 213, in request raise TimeoutError(f"Did not get a response on {request}") TimeoutError: Did not get a response on Packet[PC -> ES_BLE, cmd=INIT, idx=00] `

ownbee commented 2 months ago

Yes, this is something that I have tried fixing but needed a large refactoring/rewriting so I did not have time to finish it and currently I have forgotten where I was in it. I recently got a child and moved to a house so my free-time developing is not as it has been and currently I have no need for a scooter in day-to-day basis so this is not on top of my list unfortunately. I cant say when I will have time working on this integration but if someone pushes PR I will do my best reviewing and testing it.

JoeyGE0 commented 1 month ago

oh, that's great you are still interested in the integration. I would love to help with this but I lack most coding skills so I would not be much help. I have pulled a copy to add some changes

I'm aware you still have a list of things to do and are quite busy but things to keep in mind. I would appreciate the feature of sending requests to the scooter. like locking, headlight, taillight etc. I actually have my ninebot max on a custom SHFW profile and speed unlocked and while doing all this I have learned that Scooterhacking.org also has all the commands and strings available for controls for the scooter. you already have written the foundations so I'm sure you, or someone else smart can implement his without a heap of hassle.

I would love to get an automation running so that when I plug the scooter in it locks. or once plugged in closes garage door, or if i go out riding at night light is enabled. simple things like that I have always dreamed of adding. of course, it is not a high priority but something I'm interested in and im sure others would be too!

anyways thanks for this integration!