core: Tractive integration: Live tracking or Tracker LED showing "Failed to call service switch/turn_off. 'pending'" when turning on/off

The problem

Recently my Tractive integration started showing error messages when turning on or off any of the available switches, namely:

  • Configuration\Live tracking
  • Configuration\Tracker buzzer
  • Configuration\Tracker LED

All of them shows “Failed to call service switch/turn_off. 'pending'” when toggling these switches. Read only sensors are working fine. I have completely removed the integration, removed the \config\custom_components\tractive folder, rebooted HA host system, rebooted the tracker (powered off and on) and added the integration back and still having the same. I can enable these switches in the Android app (except the buzzer which seems to be busted after a dive my dog took a year ago, the live tracking and LED is still working).

image

HAOS OVA (VMware) Core 2024.2.3 Supervisor 2024.02.0 Operating System 11.5 Frontend 20240207.1

And for whom it might concern the small amount of time on “minutes active today”, my dog is healing so she needs to rest. 😃

What version of Home Assistant Core has the issue?

2024.2.3

What was the last working version of Home Assistant Core?

2023.10.5

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Tractive

Link to integration documentation on our website

https://www.home-assistant.io/integrations/tractive

Diagnostics information

home-assistant_tractive_2024-02-23T22-19-17.674Z.log

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Highlights for diagnostic information/log attached


  File "/usr/src/homeassistant/homeassistant/components/device_automation/toggle_entity.py", line 123, in async_call_action_from_config
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 2279, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2316, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 892, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 962, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
    if result["pending"]:
       ~~~~~~^^^^^^^^^^^
KeyError: 'pending'

	Line  5141:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line  5184:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 12147:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 12190:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 12995:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 13038:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 14440:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 14483:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 15330:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 15373:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 16142:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 16185:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 16820:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 131, in async_turn_on
	Line 16850:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 131, in async_turn_on
	Line 16880:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 131, in async_turn_on
	Line 16910:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 16934:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 16955:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 17013:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 17056:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 17708:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 131, in async_turn_on
	Line 17760:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 17803:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 17899:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 18076:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 131, in async_turn_on
	Line 18470:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 18513:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 19642:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 19685:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 20361:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 20404:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 21233:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 21254:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 131, in async_turn_on
	Line 21290:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 131, in async_turn_on
	Line 21320:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 131, in async_turn_on
	Line 21359:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 21410:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 21456:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 21499:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 21535:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 21856:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 131, in async_turn_on
	Line 22081:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 22135:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 131, in async_turn_on
	Line 22217:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 22260:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 22386:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 22695:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 131, in async_turn_on
	Line 22941:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 23038:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 23081:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 23178: 2024-02-23 23:16:50.806 DEBUG (MainThread) [homeassistant.components.tractive] Received event: {'message': 'tracker_status', 'tracker_id': 'XMDZAIKM', 'tracker_state': 'OPERATIONAL', 'tracker_state_reason': 'POWER_SAVING', 'position': {'time': 1708725471, 'latlong': [47.437626, 19.098095], 'sensor_used': 'KNOWN_WIFI', 'accuracy': 30, 'altitude': 113, 'power_saving_zone_id': '65cfbebbb2e2e6db06cbdecd', 'time_rcvd': 1708725523}, 'hardware': {'time': 1708725471, 'battery_level': 89, 'temperature_state': 'NORMAL', 'power_saving_zone_id': '65cfbebbb2e2e6db06cbdecd', 'clip_mounted_state': False}, 'charging_state': 'NOT_CHARGING', 'battery_state': 'REGULAR', 'power_saving_zone_id': '65cfbebbb2e2e6db06cbdecd', 'prioritized_zone': {'_id': '65cfbebbb2e2e6db06cbdecd', 'type': 'POWER_SAVING', 'last_seen_at': 1708725471, 'entered_at': 1708708536}, 'led_control': {'active': False, 'timeout': 300, 'remaining': 0, 'pending': False, 'reconnecting': False}, 'buzzer_control': {'active': False, 'timeout': 300, 'remaining': 0, 'pending': False, 'reconnecting': False}, 'live_tracking': {'active': False, 'timeout': 3600, 'remaining': 0, 'pending': False, 'reconnecting': False}, 'pos_request': {'active': False, 'timeout': 300, 'remaining': 0, 'pending': False, 'reconnecting': False}}
	Line 23179: 2024-02-23 23:16:51.000 DEBUG (MainThread) [homeassistant.components.tractive] Received event: {'pet_id': '6419dd0ed02de4b3f70929cb', 'week_overview': [{'progress': 110, 'streak_after': True, 'local_day': 19, 'local_month': 2, 'local_year': 2024}, {'progress': 240, 'streak_after': True, 'local_day': 20, 'local_month': 2, 'local_year': 2024}, {'progress': 223, 'streak_after': True, 'local_day': 21, 'local_month': 2, 'local_year': 2024}, {'progress': 203, 'streak_after': True, 'local_day': 22, 'local_month': 2, 'local_year': 2024}, {'progress': 150, 'streak_after': False, 'local_day': 23, 'local_month': 2, 'local_year': 2024}, {'progress': 0, 'streak_after': False, 'local_day': 24, 'local_month': 2, 'local_year': 2024}, {'progress': 0, 'streak_after': False, 'local_day': 25, 'local_month': 2, 'local_year': 2024}], 'progress': {'achieved_minutes': 45, 'goal_minutes': 30, 'current_streak': 23}, 'hourly_distribution': [0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 2, 0, 0, 0, 0, 0, 0, 11, 16, 0, 0, 0, 0, 0], 'activity_distribution': [{'category': 'active', 'current': 45.0, 'average': 61.0}, {'category': 'calories', 'current': 854.0, 'average': 886.0}, {'category': 'resting', 'current': 22.1, 'average': 22.0}], 'sleep_distribution': [{'category': 'resting', 'current': 28.0, 'average': 27.0}, {'category': 'sleeping', 'current': 1296.0, 'average': 1294.0}], 'best_day': False, 'associated_data': ['SLEEP_OVERVIEW'], 'message': 'activity_update'}
	Line 23180: 2024-02-23 23:16:51.146 DEBUG (MainThread) [homeassistant.components.tractive] Received event: {'pet_id': '6419dd0ed02de4b3f70929cb', 'wellness': {'no_data_reason': 'TOO_LITTLE_USAGE', 'data_tomorrow': False, 'remaining_days_until_score': 5}, 'activity': {'hourly_distribution': [0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 2, 0, 0, 0, 0, 0, 0, 11, 16, 0, 0, 0, 0, 0], 'minutes_active': 45, 'minutes_rest': 28, 'minutes_goal': 30, 'calories': 854, 'average_minutes_active': 62, 'average_minutes_rest': 27, 'current_streak': 23, 'best_day': False}, 'sleep': {'minutes_night_sleep': 749, 'minutes_day_sleep': 546, 'sleep_phases': [{'time_offset': 0, 'time_span': 577, 'type': 'NIGHT'}, {'time_offset': 577, 'time_span': 32, 'type': 'OTHER'}, {'time_offset': 609, 'time_span': 452, 'type': 'DAY'}, {'time_offset': 1061, 'time_span': 44, 'type': 'OTHER'}, {'time_offset': 1105, 'time_span': 95, 'type': 'DAY'}, {'time_offset': 1200, 'time_span': 172, 'type': 'NIGHT'}, {'time_offset': 1372, 'time_span': 7, 'type': 'OTHER'}], 'sleep_phases_time_span': 1440}, 'bark': {'level': None, 'no_data_reason': 'NOT_SUPPORTED', 'intense_barking_alert_timestamp': None}, 'health_monitoring_status': [{'alert_type': 'ACTIVITY_DEGRADATION', 'alert_status': 'NOT_ENOUGH_DATA'}, {'alert_type': 'LONG_TERM_ACTIVITY_DEGRADATION', 'alert_status': 'MONITORED'}, {'alert_type': 'SLEEP_INTERRUPTIONS', 'alert_status': 'NOT_ENOUGH_DATA'}], 'associated_data': [], 'message': 'wellness_overview'}
	Line 23225:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 131, in async_turn_on
	Line 23738:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 23858:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 131, in async_turn_on
	Line 24026:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 24591:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 24634:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 25427:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 25470:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 26180:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 26226:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 26583:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 131, in async_turn_on
	Line 26679:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 26757:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 131, in async_turn_on
	Line 26829:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 26955:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 131, in async_turn_on
	Line 26982:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 27018:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 131, in async_turn_on
	Line 27054:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off
	Line 27087:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 131, in async_turn_on
	Line 27126:   File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 143, in async_turn_off


### Additional information

Last year since **before** we had the "too many requests" issue with Tractive integration it was working fine, since then these switches worked most of the time if the integration was reloaded beforehand and any of the aforementioned switches were used right after. This year I have noticed (around mid January) this new issue with an additional errmsg mentoned in problem description.

About this issue

  • Original URL
  • State: closed
  • Created 4 months ago
  • Comments: 29 (13 by maintainers)

Most upvoted comments

Do you think power saving setting on tracker might interfere with the intergation? I have Wifi based powersaving enabled.

I checked my trackers and indeed when power saving is active, the LED/live tracking/buzzer switches don’t work. API Tractive returns timeout information. This is not something we can fix in the integration, it needs to be fixed in the aiotractive backend library if it is even possible to fix it considering that Tractive doesn’t provide any documentation for the API. When power saving is not active, I see no problem with turning the switches on/off.

I don’t see any problems here

2024-03-23 13:31:11.159 DEBUG (MainThread) [custom_components.tractive.switch] Result: {'active': False, 'started_at': None, 'timeout': 300, 'remaining': 0, 'pending': True}

The problem you described in the open post doesn’t occur, the issue should be closed. If you experience another problem you should open a new issue.

Bad bot, let’s keep this open until after the weekend when I would have some time to recheck.

I got a similar idea, but disabled it instead, for a week would do I guess.

Message ID: @.***>

although it’s a bit wierd, because when I enable the Tracker LED toggle it instantly toggles off than after a few seconds it toggles on

I also noticed this behavior. I will try to fix this.

Yes, I was using such automations which reloads the whole integration if it failed to report back in certain amount of time, I needed them previously for the issues we had last year but forgot about them, but in the latest version it causes problems apparently.

The automation basically did the following: Home Assistant Core Integration: Reload config entry targeting the Tracker device entity I have disabled that one and now the integration works; although it’s a bit wierd, because when I enable the Tracker LED toggle it instantly toggles off than after a few seconds it toggles on; but I cna live with that.

Thank you for your work and time, we can consider this one resolved.

Do you use some kind of automation (Node Red flow) that forces the Tractive entity state to update or repeatedly changes the state of the switch entity? Or do you use another solution (custom app/component/service) that use Tractive API?