ownbee / ninebot-integration

Ninebot Scooter integration for Home Assistant
3 stars 2 forks source link

Failed to set up for MAX G2D #3

Open bannert1337 opened 4 weeks ago

bannert1337 commented 4 weeks ago

The scooter was automatically detected. But the integration fails to set up. The log shows this error message: TypeError: Too few arguments for <class 'homeassistant.components.bluetooth.passive_update_processor.PassiveBluetoothDataProcessor'>; actual 1, expected at least 2

I found a similar issue for another integration with this issue. A fix was proposed here.

ok i found a solution. edit the sensor.py file and change the line 215 to

PassiveBluetoothDataProcessor[Optional[Union[float, int]], 1]

reload integration and you get data from the bluetooth device. working here with a smartshunt

bannert1337 commented 4 weeks ago

After changing line 69 from PassiveBluetoothProcessorEntity[PassiveBluetoothDataProcessor[str | int | None]], to PassiveBluetoothProcessorEntity[PassiveBluetoothDataProcessor[str | int | None,1]], the integration gets set up but has no devices or entities

bannert1337 commented 4 weeks ago

The debug log shows this

2024-06-23 13:54:20.616 ERROR (MainThread) [custom_components.ninebot_scooter] F1:62:0C:30:E7:F6: 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 114, in connect
    await self.client.start_notify(NORDIC_UART_TX_UUID, self._read_callback)
  File "/usr/local/lib/python3.12/site-packages/bleak/__init__.py", line 844, in start_notify
    await self._backend.start_notify(characteristic, wrapped_callback, **kwargs)
  File "/usr/local/lib/python3.12/site-packages/bleak/backends/bluezdbus/client.py", line 951, in start_notify
    reply = await self._bus.call(
            ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dbus_fast/aio/message_bus.py", line 385, in call
    await future
  File "src/dbus_fast/aio/message_reader.py", line 19, in dbus_fast.aio.message_reader._message_reader
  File "src/dbus_fast/_private/unmarshaller.py", line 777, in dbus_fast._private.unmarshaller.Unmarshaller._unmarshall
  File "src/dbus_fast/_private/unmarshaller.py", line 638, in dbus_fast._private.unmarshaller.Unmarshaller._read_header
  File "src/dbus_fast/_private/unmarshaller.py", line 374, in dbus_fast._private.unmarshaller.Unmarshaller._read_to_pos
  File "src/dbus_fast/_private/unmarshaller.py", line 317, in dbus_fast._private.unmarshaller.Unmarshaller._read_sock_with_fds
EOFError
2024-06-23 13:54:26.465 ERROR (MainThread) [custom_components.ninebot_scooter] F1:62:0C:30:E7:F6: Bluetooth error whilst polling: [org.bluez.Error.Failed] Operation failed with ATT error: 0x0e (Unlikely Error)
2024-06-23 13:54:52.815 WARNING (MainThread) [homeassistant.components.climate] Entity None (<class 'homeassistant.components.eq3btsmart.climate.Eq3Climate'>) implements HVACMode(s): off, auto, heat and therefore implicitly supports the turn_on/turn_off methods without setting the proper ClimateEntityFeature. Please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+eq3btsmart%22
2024-06-23 13:55:10.903 INFO (MainThread) [ninebot_ble.transport] Please press power button on scooter!
2024-06-23 13:55:11.904 DEBUG (MainThread) [ninebot_ble.transport] Sending Packet[PC -> ES_BLE, cmd=PAIR, idx=00, data=3031475A46323431324331383834]
2024-06-23 13:55:11.907 DEBUG (MainThread) [ninebot_ble.transport] Sending chuck 20/27: 5AA50EB9678F46B87C7737D1FEB997F48B89D91D
2024-06-23 13:55:11.962 DEBUG (MainThread) [ninebot_ble.transport] Sending chuck 27/27: CE7A7FB62D0011
2024-06-23 13:55:12.340 INFO (MainThread) [ninebot_ble.transport] Connecting to 01GZF2412C1884 (F1:62:0C:30:E7:F6): ...
2024-06-23 13:55:12.343 DEBUG (MainThread) [ninebot_ble.transport] Authenticating ...
2024-06-23 13:55:12.343 DEBUG (MainThread) [ninebot_ble.transport] Sending Packet[PC -> ES_BLE, cmd=INIT, idx=00]
2024-06-23 13:55:12.343 DEBUG (MainThread) [ninebot_ble.transport] Sending chuck 13/13: 5AA500A56749A9000046FF0000
2024-06-23 13:55:13.058 INFO (MainThread) [ninebot_ble.transport] Please press power button on scooter!
2024-06-23 13:55:13.418 DEBUG (MainThread) [ninebot_ble.transport] Retrying request ...
2024-06-23 13:55:13.418 DEBUG (MainThread) [ninebot_ble.transport] Sending Packet[PC -> ES_BLE, cmd=INIT, idx=00]
2024-06-23 13:55:13.419 DEBUG (MainThread) [ninebot_ble.transport] Sending chuck 13/13: 5AA500A56749A9000046FF0000
2024-06-23 13:55:13.553 ERROR (MainThread) [homeassistant.helpers.dispatcher] Exception in _handle_update when dispatching 'mobile_app_sensor_update-d6db07786075ad7b6647e6953a0d0895452ce5707742dd67a97742fc1b967aff_hwmon_3_iwlwifi_1_temp_1': ({'attributes': {'native_unit_of_measurement': '°C', 'data_source': 'SysFS', 'sensor_type': 'Temp', 'sysfs_path': '/sys/class/hwmon/hwmon3'}, 'state': 'Unknown', 'icon': 'mdi:thermometer', 'type': 'sensor', 'unique_id': 'hwmon_3_iwlwifi_1_temp_1', 'webhook_id': 'd6db07786075ad7b6647e6953a0d0895452ce5707742dd67a97742fc1b967aff'},)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 658, in state
    numerical_value = int(value)
                      ^^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'Unknown'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 661, in state
    numerical_value = float(value)
                      ^^^^^^^^^^^^
ValueError: could not convert string to float: 'Unknown'
bannert1337 commented 4 weeks ago

The scooter shows the Bluetooth icon, which means there is a connection. I also pressed the power button as described in the log, but to no success.

Victini517 commented 3 weeks ago

Max G30E II here, after adding the fix to line 69 the scooter is added but doesn't show any entities here either unfortunately