elsbrock / cowboy-ha

🤠 Custom Home Assistant Integration for Cowboy Bikes 🚲💨
MIT License
15 stars 2 forks source link

Update bike always on? #7

Closed vandenbogerd closed 9 months ago

vandenbogerd commented 9 months ago

System Health details

System Information

version core-2024.1.2
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.11.6
os_name Linux
os_version 6.1.70-haos
arch aarch64
timezone Europe/Brussels
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 5000 Installed Version | 1.33.0 Stage | running Available Repositories | 1387 Downloaded Repositories | 63 HACS Data | ok
Home Assistant Cloud logged_in | true -- | -- subscription_expiration | 1 september 2024 om 02:00 relayer_connected | true relayer_region | eu-central-1 remote_enabled | true remote_connected | true alexa_enabled | false google_enabled | true remote_server | eu-central-1-2.ui.nabu.casa certificate_status | ready instance_id | b1faf5fe25294683b133fceb8d454eea can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 11.3 -- | -- update_channel | stable supervisor_version | supervisor-2023.12.0 agent_version | 1.6.0 docker_version | 24.0.7 disk_total | 113.9 GB disk_used | 66.2 GB healthy | true supported | true board | odroid-n2 supervisor_api | ok version_api | ok installed_addons | Samba share (12.2.0), AirSonos (4.1.0), Check Home Assistant configuration (3.11.0), File editor (5.7.0), Mosquitto broker (6.4.0), Z-Wave JS UI (3.1.0), Home Assistant Google Drive Backup (0.112.1), Advanced SSH & Web Terminal (17.0.2), Zigbee2MQTT (1.35.1-1), Cloudflared (5.0.0), ESPHome (2023.12.5), Silicon Labs Multiprotocol (2.4.2), motionEye (0.20.0), deCONZ (6.22.0), HiSense Air Conditioners (0.3.17)
Dashboards dashboards | 6 -- | -- resources | 42 views | 19 mode | storage
Recorder oldest_recorder_run | 30 december 2023 om 09:25 -- | -- current_recorder_run | 8 januari 2024 om 14:27 estimated_db_size | 1578.10 MiB database_engine | sqlite database_version | 3.41.2

Checklist

Describe the issue

update_available always seems to be active, even after applying the battery update of today

Reproduction steps

  1. Update available activated
  2. Checking the bike & performing battery update
  3. No changes visible in component
  4. Reload component manually: all good
  5. One hour later: update available again
  6. Checking the bike: no updates at all ...

Debug logs

Nothing visible in the logs

Diagnostics dump

No response

elsbrock commented 9 months ago

Thanks for the report. Could you please check debug logs again; there should be log entries returning the detailed data (see coordinator.py).

What model do you have and what firmware are you on?

vandenbogerd commented 9 months ago

Cowboy V2 on firmware v4.16.5 Logs I need to check!

elsbrock commented 9 months ago

That’s what I’m on too with my C3. Looks like they’re using a single firmware for all models. It is the latest.

Anyhow, let me know once you have the logs.

vandenbogerd commented 9 months ago

The only things I see in home-assistant.log are:

2024-01-11 12:50:42.615 ERROR (MainThread) [custom_components.cowboy.coordinator] Timeout fetching cowboy data
2024-01-11 12:51:42.992 INFO (MainThread) [custom_components.cowboy.coordinator] Fetching cowboy data recovered

2024-01-11 15:24:37.100 INFO (MainThread) [custom_components.cowboy.coordinator] Initializing CowboyCoordinator
2024-01-11 15:24:37.100 INFO (MainThread) [custom_components.cowboy.coordinator] Initializing CowboyCoordinator
2024-01-11 15:24:37.520 DEBUG (MainThread) [custom_components.cowboy.coordinator] bike data fetched: {'id': 1834, 'mac_address': 'redacted', 'stolen': False, 'firmware_version': 'v4.16.5', 'activated_at': '2019-07-01T17:53:27.064+02:00', 'passkey': 'redacted', 'nickname': 'vandenbogerd', 'crashed': False, 'seen_at': '2024-01-11T12:13:00.048+01:00', 'sku_code': 'CBA2590BK1-01', 'last_crash_started_at': '2023-12-17T03:26:35.573+01:00', 'autonomy': 78.0, 'battery_state_of_charge_updated_at': '2024-01-11T12:13:00.048+01:00', 'battery_state_of_charge': 12, 'pcb_battery_state_of_charge': 75.0, 'serial_number': 'redacted', 'total_distance': 1080.38999910928, 'total_duration': 286175, 'total_co2_saved': 135049, 'position': {'latitude': redacted, 'longitude': redacted, 'accuracy': redacted, 'created_at': '2024-01-11T12:13:00.087+01:00', 'received_at': '2024-01-11T12:12:55.000+01:00', 'address': 'Hoge weg 10, 2322 Minderhout, België', 'source': 'bike', 'elevation': None, 'id': redacted, 'type': 'stolen', 'adjusted_accuracy': '6.075000017881395'}, 'trip_sharing': False, 'insurance_conditions': {'starts_at': '2019-07-01T17:53:27.064+02:00', 'min_trip_distance': 2.0, 'passed': True}, 'available_features': {'theft_alerts': 'locked', 'auto_unlock': 'available', 'crash_detection': 'available', 'trip_sharing': 'available', 'ride_mode': 'hidden', 'trip_analysis': 'available', 'safety_alerts': 'available', 'apple_health': 'available', 'strava': 'available', 'watch_app': 'available', 'connected_ride': 'locked'}, 'duration_modifier': 1.5, 'last_ride_mode': 'static_eu', 'autonomies': [{'ride_mode': 'adaptive_eu', 'full_battery_range': 78.0, 'calibrated': False}, {'ride_mode': 'static_eu', 'full_battery_range': 78.0, 'calibrated': True}, {'ride_mode': 'static_offroad', 'full_battery_range': 78.0, 'calibrated': False}, {'ride_mode': 'adaptive_eco_eu', 'full_battery_range': 97.5, 'calibrated': False}, {'ride_mode': 'adaptive_us', 'full_battery_range': 78.0, 'calibrated': False}, {'ride_mode': 'static_us', 'full_battery_range': 78.0, 'calibrated': False}, {'ride_mode': 'adaptive_eco_us', 'full_battery_range': 97.5, 'calibrated': False}, {'ride_mode': 'assistance_off', 'full_battery_range': 78.0, 'calibrated': False}], 'has_cowboy_connect': True, 'model': {'name': 'Cowboy 2', 'description': 'Cowboy 2'}, 'sku': {'code': 'CBA2590BK1-01', 'features': {'battery_autonomy': 60, 'available_sku_conversion': None, 'default_ble_passkey': '', 'battery_leds': 5, 'available_speeds': {'default': 28, 'offroad': 32}, 'displayed_speeds': {'default': 25, 'offroad': 30}, 'throttle_off_voltage': 0.65, 'has_wireless_charger': False, 'modbus_devices': [1, 4, 10]}, 'market': 'EU', 'color': 'Original Black', 'grade': 'No Grade', 'color_hex': '#0C0D0D'}, 'settings': {'theft_alerts': False, 'auto_unlock': True, 'crash_detection': False, 'led_brightness': 100, 'manual_unlock': 20, 'auto_lock': 5, 'max_speed': 32, 'brake_light_sensitivity': 10, 'smart_lock': True, 'default_ride_mode': None}, 'pending_settings': {}}
2024-01-11 15:24:37.521 DEBUG (MainThread) [custom_components.cowboy.coordinator] Finished fetching cowboy data in 0.421 seconds (success: True)
2024-01-11 15:24:37.858 DEBUG (MainThread) [custom_components.cowboy.coordinator] release data fetched: {'firmware': {'id': 5192, 'name': 'v4.16.4', 'status': 'testing', 'deployed_at': '2023-06-08T16:12:38.144+02:00', 'application_file_name': 'CowboyFW_A2-app-release-v4.16.4.zip', 'mandatory': False, 'comment': 'Connectivity improvements', 'url': 'https://s3-eu-west-2.amazonaws.com/cowboy.bike/releases/applications/000/005/192/original/CowboyFW_A2-app-release-v4.16.4.zip?1686233550', 'bike_tags': ['Dev', 'Staff', 'Beta-Batch1', 'Beta-Batch2', 'Beta-Batch3', 'Beta-Batch4', 'ForceEndTrips']}, 'battery': {'id': 4, 'battery_firmware_version': 52, 'battery_hardware_version': 12, 'status': 'deployed', 'deployed_at': '2020-11-25T20:55:28.105+01:00', 'application_file_name': 'H12_V52.bin', 'name': 'v52', 'comment': 'Battery lifetime increase', 'url': 'https://s3-eu-west-2.amazonaws.com/cowboy.bike/battery/releases/applications/000/000/004/original/H12_V52.bin?1586511617'}, 'controller': {'current_version': 4, 'latest_version': 4, 'comment': 'Performance improvements and bug fixes', 'registers': []}, 'cockpit': None, 'wireless_charger': None}
2024-01-11 15:24:37.858 DEBUG (MainThread) [custom_components.cowboy.coordinator] Finished fetching cowboy data in 0.338 seconds (success: True)

2024-01-11 15:24:37.859 INFO (MainThread) [homeassistant.components.sensor] Setting up cowboy.sensor
2024-01-11 15:24:37.859 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up cowboy.binary_sensor
2024-01-11 15:24:37.859 INFO (MainThread) [homeassistant.components.device_tracker] Setting up cowboy.device_tracker

2024-01-11 15:25:37.833 DEBUG (MainThread) [custom_components.cowboy.coordinator] bike data fetched: {'id': 1834, 'mac_address': 'redacted', 'stolen': False, 'firmware_version': 'v4.16.5', 'activated_at': '2019-07-01T17:53:27.064+02:00', 'passkey': 'redacted', 'nickname': 'vandenbogerd', 'crashed': False, 'seen_at': '2024-01-11T12:13:00.048+01:00', 'sku_code': 'CBA2590BK1-01', 'last_crash_started_at': '2023-12-17T03:26:35.573+01:00', 'autonomy': 78.0, 'battery_state_of_charge_updated_at': '2024-01-11T12:13:00.048+01:00', 'battery_state_of_charge': 12, 'pcb_battery_state_of_charge': 75.0, 'serial_number': 'redacted', 'total_distance': 1080.38999910928, 'total_duration': 286175, 'total_co2_saved': 135049, 'position': {'latitude': redacted, 'longitude': redacted, 'accuracy': redacted, 'created_at': '2024-01-11T12:13:00.087+01:00', 'received_at': '2024-01-11T12:12:55.000+01:00', 'address': 'Hoge weg 10, 2322 Minderhout, België', 'source': 'bike', 'elevation': None, 'id': redacted, 'type': 'stolen', 'adjusted_accuracy': '6.075000017881395'}, 'trip_sharing': False, 'insurance_conditions': {'starts_at': '2019-07-01T17:53:27.064+02:00', 'min_trip_distance': 2.0, 'passed': True}, 'available_features': {'theft_alerts': 'locked', 'auto_unlock': 'available', 'crash_detection': 'available', 'trip_sharing': 'available', 'ride_mode': 'hidden', 'trip_analysis': 'available', 'safety_alerts': 'available', 'apple_health': 'available', 'strava': 'available', 'watch_app': 'available', 'connected_ride': 'locked'}, 'duration_modifier': 1.5, 'last_ride_mode': 'static_eu', 'autonomies': [{'ride_mode': 'adaptive_eu', 'full_battery_range': 78.0, 'calibrated': False}, {'ride_mode': 'static_eu', 'full_battery_range': 78.0, 'calibrated': True}, {'ride_mode': 'static_offroad', 'full_battery_range': 78.0, 'calibrated': False}, {'ride_mode': 'adaptive_eco_eu', 'full_battery_range': 97.5, 'calibrated': False}, {'ride_mode': 'adaptive_us', 'full_battery_range': 78.0, 'calibrated': False}, {'ride_mode': 'static_us', 'full_battery_range': 78.0, 'calibrated': False}, {'ride_mode': 'adaptive_eco_us', 'full_battery_range': 97.5, 'calibrated': False}, {'ride_mode': 'assistance_off', 'full_battery_range': 78.0, 'calibrated': False}], 'has_cowboy_connect': True, 'model': {'name': 'Cowboy 2', 'description': 'Cowboy 2'}, 'sku': {'code': 'CBA2590BK1-01', 'features': {'battery_autonomy': 60, 'available_sku_conversion': None, 'default_ble_passkey': '', 'battery_leds': 5, 'available_speeds': {'default': 28, 'offroad': 32}, 'displayed_speeds': {'default': 25, 'offroad': 30}, 'throttle_off_voltage': 0.65, 'has_wireless_charger': False, 'modbus_devices': [1, 4, 10]}, 'market': 'EU', 'color': 'Original Black', 'grade': 'No Grade', 'color_hex': '#0C0D0D'}, 'settings': {'theft_alerts': False, 'auto_unlock': True, 'crash_detection': False, 'led_brightness': 100, 'manual_unlock': 20, 'auto_lock': 5, 'max_speed': 32, 'brake_light_sensitivity': 10, 'smart_lock': True, 'default_ride_mode': None}, 'pending_settings': {}}
2024-01-11 15:25:37.833 DEBUG (MainThread) [custom_components.cowboy.coordinator] Finished fetching cowboy data in 0.425 seconds (success: True)

2024-01-11 15:26:37.809 DEBUG (MainThread) [custom_components.cowboy.coordinator] bike data fetched: {'id': 1834, 'mac_address': 'redacted', 'stolen': False, 'firmware_version': 'v4.16.5', 'activated_at': '2019-07-01T17:53:27.064+02:00', 'passkey': 'redacted', 'nickname': 'vandenbogerd', 'crashed': False, 'seen_at': '2024-01-11T12:13:00.048+01:00', 'sku_code': 'CBA2590BK1-01', 'last_crash_started_at': '2023-12-17T03:26:35.573+01:00', 'autonomy': 78.0, 'battery_state_of_charge_updated_at': '2024-01-11T12:13:00.048+01:00', 'battery_state_of_charge': 12, 'pcb_battery_state_of_charge': 75.0, 'serial_number': 'redacted', 'total_distance': 1080.38999910928, 'total_duration': 286175, 'total_co2_saved': 135049, 'position': {'latitude': redacted, 'longitude': redacted, 'accuracy': redacted, 'created_at': '2024-01-11T12:13:00.087+01:00', 'received_at': '2024-01-11T12:12:55.000+01:00', 'address': 'Hoge weg 10, 2322 Minderhout, België', 'source': 'bike', 'elevation': None, 'id': redacted, 'type': 'stolen', 'adjusted_accuracy': '6.075000017881395'}, 'trip_sharing': False, 'insurance_conditions': {'starts_at': '2019-07-01T17:53:27.064+02:00', 'min_trip_distance': 2.0, 'passed': True}, 'available_features': {'theft_alerts': 'locked', 'auto_unlock': 'available', 'crash_detection': 'available', 'trip_sharing': 'available', 'ride_mode': 'hidden', 'trip_analysis': 'available', 'safety_alerts': 'available', 'apple_health': 'available', 'strava': 'available', 'watch_app': 'available', 'connected_ride': 'locked'}, 'duration_modifier': 1.5, 'last_ride_mode': 'static_eu', 'autonomies': [{'ride_mode': 'adaptive_eu', 'full_battery_range': 78.0, 'calibrated': False}, {'ride_mode': 'static_eu', 'full_battery_range': 78.0, 'calibrated': True}, {'ride_mode': 'static_offroad', 'full_battery_range': 78.0, 'calibrated': False}, {'ride_mode': 'adaptive_eco_eu', 'full_battery_range': 97.5, 'calibrated': False}, {'ride_mode': 'adaptive_us', 'full_battery_range': 78.0, 'calibrated': False}, {'ride_mode': 'static_us', 'full_battery_range': 78.0, 'calibrated': False}, {'ride_mode': 'adaptive_eco_us', 'full_battery_range': 97.5, 'calibrated': False}, {'ride_mode': 'assistance_off', 'full_battery_range': 78.0, 'calibrated': False}], 'has_cowboy_connect': True, 'model': {'name': 'Cowboy 2', 'description': 'Cowboy 2'}, 'sku': {'code': 'CBA2590BK1-01', 'features': {'battery_autonomy': 60, 'available_sku_conversion': None, 'default_ble_passkey': '', 'battery_leds': 5, 'available_speeds': {'default': 28, 'offroad': 32}, 'displayed_speeds': {'default': 25, 'offroad': 30}, 'throttle_off_voltage': 0.65, 'has_wireless_charger': False, 'modbus_devices': [1, 4, 10]}, 'market': 'EU', 'color': 'Original Black', 'grade': 'No Grade', 'color_hex': '#0C0D0D'}, 'settings': {'theft_alerts': False, 'auto_unlock': True, 'crash_detection': False, 'led_brightness': 100, 'manual_unlock': 20, 'auto_lock': 5, 'max_speed': 32, 'brake_light_sensitivity': 10, 'smart_lock': True, 'default_ride_mode': None}, 'pending_settings': {}}
2024-01-11 15:26:37.809 DEBUG (MainThread) [custom_components.cowboy.coordinator] Finished fetching cowboy data in 0.398 seconds (success: True)
elsbrock commented 9 months ago

Interesting! Looks like your bike is on a newer firmware (v4.16.5) than what's offered as last release (v4.16.4).

Currently the logic for the "update available" sensor is a simple check if the bike release equals the latest release. Ideally we can keep it that simple.

v4.16.4 is marked with status: "testing", so I think I'll just ignore these and set the sensor to "up-to-date" in case there's no other release.