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

FYTA Error: Task exception was never retrieved - PLANT_STATUS[value], #114804

Closed
gerdschadler opened this issue Apr 4, 2024 · 3 comments · Fixed by #115134
Closed

FYTA Error: Task exception was never retrieved - PLANT_STATUS[value], #114804

gerdschadler opened this issue Apr 4, 2024 · 3 comments · Fixed by #115134

Comments

@gerdschadler
Copy link

The problem

I get the following Error Message:

Logger: homeassistant
Source: components/fyta/sensor.py:56
First occurred: April 3, 2024 at 22:36:03 (571 occurrences)
Last logged: 08:03:45

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1504, in _async_process_registry_update_or_remove
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1056, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1004, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 548, in state
value = self.native_value
^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/fyta/sensor.py", line 144, in native_value
return self.entity_description.value_fn(val)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/fyta/sensor.py", line 56, in
value_fn=lambda value: PLANT_STATUS[value],
~~~~~~~~~~~~^^^^^^^
KeyError: 0

What version of Home Assistant Core has the issue?

core-2024.4.0

What was the last working version of Home Assistant Core?

core-2024.4.0

What type of installation are you running?

Home Assistant Container

Integration causing the issue

FYTA

Link to integration documentation on our website

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

Diagnostics information

2024-04-03 22:36:03.202 ERROR (MainThread) [homeassistant.components.sensor] Error adding entity sensor.ornela_temperature_state for domain sensor with platform fyta
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 580, in _async_add_entities
await coro
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 881, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1334, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 998, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1119, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1056, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1004, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 548, in state
value = self.native_value
^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/fyta/sensor.py", line 144, in native_value
return self.entity_description.value_fn(val)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/fyta/sensor.py", line 56, in
value_fn=lambda value: PLANT_STATUS[value],
~~~~~~~~~~~~^^^^^^^
KeyError: 0

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Apr 4, 2024

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

Code owner commands

Code owners of fyta 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 fyta 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)


fyta documentation
fyta source
(message by IssueLinks)

@dontinelli
Copy link
Contributor

dontinelli commented Apr 4, 2024

Hi @gerdschadler
Seems that the conversion for plant status (from nominal value to string) does not work (FYTA-API reports back 0, but value should be from 1 to 5). Do the other sensors show correct values? And is this error for all plants or do some plants report a correct state value?

@gerdschadler
Copy link
Author

gerdschadler commented Apr 6, 2024

Hello @dontinelli
I think I have found the fault, the beams were all new and it seems to have taken up to a day for the sensor to report data.

Nevertheless, the "Plant State" does not seem to be correct. This is probably because the "status" is reported as "1", although the plant is shown as "Doing Great" in the app, this value is also reported by the API: "isDoingGreat": true.

Unfortunately I don't know what the "status" means, it would be cool if there was a sensor with "Doing Great" or "Need Help" or "Silent Plant"

"plants": [
    {
        "id": 42576,
        "nickname": "Ren",
        "scientific_name": "Euphorbia trigona",
        "common_name": "African Milktree",
        "status": 1,
        "plant_id": 197,
        "family_id": null,
        "is_shared": false,
        "owner": {},
        "peers": [],
        "wifi_status": 1,
        "thumb_path": "https://api.prod.fyta-app.de/user-plant/42576/thumb_path?timestamp=2024-04-03%2010%3A13%3A08",
        "origin_path": "https://api.prod.fyta-app.de/user-plant/42576/origin_path?timestamp=2024-04-03%2010%3A13%3A08",
        "plant_thumb_path": "https://s3.eu-central-1.amazonaws.com/de.fyta.prod.media/image/thumb/5011/thumb_1651708862928.jpeg",
        "plant_origin_path": "https://s3.eu-central-1.amazonaws.com/de.fyta.prod.media/image/origin/5011/origin_1651708861384.jpeg",
        "received_data_at": "2024-04-06 05:49:08",
        "temperature_optimal_hours": 0,
        "light_optimal_hours": 0,
        "eligibility": true,
        "temperature_status": 3,
        "light_status": 3,
        "moisture_status": 3,
        "salinity_status": 3,
        "nutrients_status": 3,
        "fertilisation": {
            "last_fertilised_at": "2024-02-04",
            "fertilise_at": "2024-08-12",
            "was_repotted": false
        },
        "notifications": {
            "light": true,
            "temperature": true,
            "water": true,
            "nutrition": true
        },
        "care_tips_count": 0,
        "has_remote_hub": false,
        "has_remote_sensor": false,
        "garden": {
            "id": 4323
        },
        "sensor": {
            "id": "FA:B0:89:82:32:0A",
            "has_sensor": true,
            "status": 1,
            "uuid_android": null,
            "uuid_ios": null,
            "version": "1.4.0",
            "is_battery_low": false,
            "received_data_at": "2024-04-06 05:49:08"
        },
        "hub": {
            "id": 6222,
            "hub_id": "34:B4:72:B1:13:D2",
            "hub_name": "Hub Loft",
            "version": "0.9.6",
            "status": 1,
            "received_data_at": "2024-04-06 05:49:08",
            "reached_hub_at": "2024-04-06 06:07:51"
        },
        "isDoingGreat": true

--- or
(for Need Help)
noOfbadge: 2
isBadge: true

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.

2 participants