Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while setting up tractive platform for switch/sensor/device_tracker #118051

Closed
Kokahontas13 opened this issue May 24, 2024 · 10 comments · Fixed by #118467
Closed

Error while setting up tractive platform for switch/sensor/device_tracker #118051

Kokahontas13 opened this issue May 24, 2024 · 10 comments · Fixed by #118467

Comments

@Kokahontas13
Copy link

The problem

The tractive integration seems to be broken after the latest update to core-2024.5.4

Error logs:

Error while setting up tractive platform for device_tracker
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 356, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/usr/src/homeassistant/homeassistant/components/tractive/device_tracker.py", line 32, in async_setup_entry
    entities = [TractiveDeviceTracker(client, item) for item in trackables]
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tractive/device_tracker.py", line 52, in __init__
    self._latitude: float = item.pos_report["latlong"][0]
                            ~~~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'latlong'
Error while setting up tractive platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 356, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/usr/src/homeassistant/homeassistant/components/tractive/sensor.py", line 193, in async_setup_entry
    TractiveSensor(client, item, description)
  File "/usr/src/homeassistant/homeassistant/components/tractive/sensor.py", line 70, in __init__
    f"{description.signal_prefix}-{item.tracker_details['_id']}"
                                   ~~~~~~~~~~~~~~~~~~~~^^^^^^^
KeyError: '_id'
Error while setting up tractive platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 356, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 69, in async_setup_entry
    TractiveSwitch(client, item, description)
  File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 93, in __init__
    f"{TRACKER_SWITCH_STATUS_UPDATED}-{item.tracker_details['_id']}",
                                       ~~~~~~~~~~~~~~~~~~~~^^^^^^^
KeyError: '_id'

What version of Home Assistant Core has the issue?

2024.5.4

What was the last working version of Home Assistant Core?

2024.5.0

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

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Error while setting up tractive platform for device_tracker
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 356, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/usr/src/homeassistant/homeassistant/components/tractive/device_tracker.py", line 32, in async_setup_entry
    entities = [TractiveDeviceTracker(client, item) for item in trackables]
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tractive/device_tracker.py", line 52, in __init__
    self._latitude: float = item.pos_report["latlong"][0]
                            ~~~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'latlong'
Error while setting up tractive platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 356, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/usr/src/homeassistant/homeassistant/components/tractive/sensor.py", line 193, in async_setup_entry
    TractiveSensor(client, item, description)
  File "/usr/src/homeassistant/homeassistant/components/tractive/sensor.py", line 70, in __init__
    f"{description.signal_prefix}-{item.tracker_details['_id']}"
                                   ~~~~~~~~~~~~~~~~~~~~^^^^^^^
KeyError: '_id'
Error while setting up tractive platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 356, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 69, in async_setup_entry
    TractiveSwitch(client, item, description)
  File "/usr/src/homeassistant/homeassistant/components/tractive/switch.py", line 93, in __init__
    f"{TRACKER_SWITCH_STATUS_UPDATED}-{item.tracker_details['_id']}",
                                       ~~~~~~~~~~~~~~~~~~~~^^^^^^^
KeyError: '_id'


### Additional information

_No response_
@home-assistant
Copy link

Hey there @Danielhiversen, @zhulik, @bieniu, mind taking a look at this issue as it has been labeled with an integration (tractive) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of tractive can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign tractive Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


tractive documentation
tractive source
(message by IssueLinks)

@bieniu
Copy link
Member

bieniu commented May 24, 2024

Please attach diagnostics file and a debug log for Tractive integration.

@Kokahontas13
Copy link
Author

Kokahontas13 commented May 24, 2024

@Kokahontas13
Copy link
Author

i restarted the integration a few times and then suddenly it worked. So my error is fixed (for now) but maybe you still want to look into it. If not, you can close this ticket

@bieniu
Copy link
Member

bieniu commented May 24, 2024

I suspect that the Tractive API returned incorrect data but… the integration should be protected from such situations. Let's leave the issue open.

@AboveColin
Copy link

Got the exact same issue over here!
Core 2024.5.1
Supervisor 2024.05.1
Operating System 12.2

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 356, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/usr/src/homeassistant/homeassistant/components/tractive/device_tracker.py", line 32, in async_setup_entry
    entities = [TractiveDeviceTracker(client, item) for item in trackables]
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tractive/device_tracker.py", line 52, in __init__
    self._latitude: float = item.pos_report["latlong"][0]
                            ~~~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'latlong' 

@Kokahontas13
Copy link
Author

yes, for me it is also present again

@bieniu
Copy link
Member

bieniu commented May 29, 2024

Debug log?

@Kokahontas13
Copy link
Author

@bieniu
Copy link
Member

bieniu commented May 29, 2024

This log is cut off, I'm interested in the part before the errors occurred

@github-actions github-actions bot locked and limited conversation to collaborators Jun 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants