Ninebot Max does not update entity
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] `
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.
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!
has there been any dev on this?
I don't think i'm skilled enough to figure out the polling. But I found that disabling the integration and then enabling it resulting in a sucessful update of the values.
I'm trying to figure out an automation to stop the battery charging at a certain %. I don't think i'll be able to get it very precise, but if i disable the integration every 30 minutes when it is charging then when it updates could probably get it within 5-10%...
I believe spook has a way to automate the disabling and enabling of integrations...
Played with this for a bit and came up with the following integration. The premise is this - my scooter is hooked up to a smart plug with power monitoring capability. When the plug turns on (at a specific time in a separate automation), every 20 minutes (not the most efficient code) that the voltage is higher than a specific amount my automation gets triggered. The automation disabled the integration, re-enables it and checks the battery %. If its over 85% it turns off the smart plug. The thing that seems to make this work is when the charger turns on by the smart plug, the scooter connects automatically to BLE, I don't need to manually turn on the scooter for the integration to connect.
alias: scooter integration charge
description: ""
triggers:
- entity_id:
- sensor.hive_2_power
for:
hours: 0
minutes: 20
seconds: 0
above: 39.4
trigger: numeric_state
- entity_id:
- sensor.hive_2_power
for:
hours: 0
minutes: 40
seconds: 0
above: 39.4
trigger: numeric_state
- entity_id:
- sensor.hive_2_power
for:
hours: 0
minutes: 60
seconds: 0
above: 39.4
trigger: numeric_state
- entity_id:
- sensor.hive_2_power
for:
hours: 0
minutes: 80
seconds: 0
above: 39.4
trigger: numeric_state
- entity_id:
- sensor.hive_2_power
for:
hours: 0
minutes: 100
seconds: 0
above: 39.4
trigger: numeric_state
- entity_id:
- sensor.hive_2_power
for:
hours: 0
minutes: 120
seconds: 0
above: 39.4
trigger: numeric_state
- entity_id:
- sensor.hive_2_power
for:
hours: 0
minutes: 140
seconds: 0
above: 39.4
trigger: numeric_state
- entity_id:
- sensor.hive_2_power
for:
hours: 0
minutes: 160
seconds: 0
above: 39.4
trigger: numeric_state
- entity_id:
- sensor.hive_2_power
for:
hours: 0
minutes: 180
seconds: 0
above: 39.4
trigger: numeric_state
- entity_id:
- sensor.hive_2_power
for:
hours: 0
minutes: 200
seconds: 0
above: 39.4
trigger: numeric_state
- entity_id:
- sensor.hive_2_power
for:
hours: 0
minutes: 220
seconds: 0
above: 39.4
trigger: numeric_state
- entity_id:
- sensor.hive_2_power
for:
hours: 4
minutes: 0
seconds: 0
above: 39.4
trigger: numeric_state
conditions: []
actions:
- action: homeassistant.disable_config_entry
target: {}
data:
config_entry_id: 01JVQV2CB2NHM7S9G4MNW4HYH0
- delay:
hours: 0
minutes: 0
seconds: 30
milliseconds: 0
- action: homeassistant.enable_config_entry
target: {}
data:
config_entry_id: 01JVQV2CB2NHM7S9G4MNW4HYH0
- delay:
hours: 0
minutes: 0
seconds: 30
milliseconds: 0
- choose:
- conditions:
- type: is_battery_level
condition: device
device_id: 07b5cf786e5672f078b804bf8a90c872
entity_id: 57f527b8399e253ad7fd73706344503d
domain: sensor
above: 85
sequence:
- action: switch.turn_off
metadata: {}
data: {}
target:
entity_id: switch.hive_2
- conditions:
- type: is_battery_level
condition: device
device_id: 07b5cf786e5672f078b804bf8a90c872
entity_id: 57f527b8399e253ad7fd73706344503d
domain: sensor
below: 85
sequence: []
mode: single