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

ValueError: could not convert string to float: 'None' -Google Assistant #78805

Closed
Anto79-ops opened this issue Sep 20, 2022 · 8 comments
Closed

Comments

@Anto79-ops
Copy link

The problem

Hi

recently, this message has been flooding my logs, several times an hour

I use Nabu Casa to manage my entities to Google Assistant.

Sounds like one of my temperature sensors is none, and it doesn't like it. Maybe it does not handle none properly?

Logger: homeassistant
Source: components/google_assistant/trait.py:848
First occurred: 9:26:38 PM (3 occurrences)
Last logged: 9:32:52 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/google_assistant/report_state.py", line 75, in async_entity_state_listener
    entity_data = entity.query_serialize()
  File "/usr/src/homeassistant/homeassistant/components/google_assistant/helpers.py", line 663, in query_serialize
    deep_update(attrs, trt.query_attributes())
  File "/usr/src/homeassistant/homeassistant/components/google_assistant/trait.py", line 848, in query_attributes
    temp = round(temp_util.convert(float(current_temp), unit, TEMP_CELSIUS), 1)
ValueError: could not convert string to float: 'None'

What version of Home Assistant Core has the issue?

Home Assistant 2022.9.5 (and earlier)

What was the last working version of Home Assistant Core?

unknown

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Google Assistant

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@probot-home-assistant
Copy link

google_assistant documentation
google_assistant source
(message by IssueLinks)

@probot-home-assistant
Copy link

Hey there @home-assistant/cloud, mind taking a look at this issue as it has been labeled with an integration (google_assistant) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@balloob
Copy link
Member

balloob commented Sep 20, 2022

Looks like an integration is pushing the wrong info to the state machine. What integration provides this?

@Anto79-ops
Copy link
Author

Anto79-ops commented Sep 21, 2022

@balloob and @emontnemery thanks, put the logs on debug, it could be an Mqtt integration for a windchill sensor

new_state=<state sensor.windchill_2=None

below. If you can confirm, I can let the developer know.

2022-09-21 09:23:48.983 INFO (MainThread) [homeassistant.components.mqtt.mixins] Ignoring unchanged update for: sensor.windchill_2
2022-09-21 09:23:48.987 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.windchill_2, old_state=<state sensor.windchill_2=unavailable; state_class=measurement, unit_of_measurement=°C, device_class=temperature, friendly_name=windchill @ 2022-09-20T15:50:22.811041-06:00>, new_state=<state sensor.windchill_2=None; state_class=measurement, unit_of_measurement=°C, device_class=temperature, friendly_name=windchill @ 2022-09-21T09:23:48.987651-06:00>>
2022-09-21 09:23:48.991 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/google_assistant/report_state.py", line 75, in async_entity_state_listener
    entity_data = entity.query_serialize()
  File "/usr/src/homeassistant/homeassistant/components/google_assistant/helpers.py", line 663, in query_serialize
    deep_update(attrs, trt.query_attributes())
  File "/usr/src/homeassistant/homeassistant/components/google_assistant/trait.py", line 848, in query_attributes
    temp = round(temp_util.convert(float(current_temp), unit, TEMP_CELSIUS), 1)
ValueError: could not convert string to float: 'None'

@bachya
Copy link
Contributor

bachya commented Sep 21, 2022

Thanks for looping me in, @Anto79-ops – I think it's safe to assume this value is coming from ecowitt2mqtt.

As we've previously discussed, wind chill is only defined in situations when both (a) the temperature is at or below 50°F and (b) the wind speed is above 3mph. When these conditions are not met, the wind chill value is undefined (which is why ecowitt2mqtt uses None in that case).

@balloob FYI, when ^^^ occurs, we mark the entity in MQTT Discovery as unavailable:

CleanShot 2022-09-21 at 15 45 22

CleanShot 2022-09-21 at 15 50 17

I wouldn't expect an unavailable entity to be pushed to Google (and throw this error); am I wrong there?

@balloob
Copy link
Member

balloob commented Sep 22, 2022

the problem here is that the state is set to None and not unavailable or unknown. None is not a valid value.

@bachya
Copy link
Contributor

bachya commented Sep 22, 2022

I didn't realize that we had to explicitly pass unavailable or unknown – I thought translation occurred somewhere internally. Nevertheless, good to know. @Anto79-ops, this will require an update to ecowitt2mqtt. I'm going to close this issue and create one over there. Thanks!

@Anto79-ops
Copy link
Author

Thanks all. You all make troubleshooting so enjoyable!

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

No branches or pull requests

4 participants