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

min_max not exposing device_class #78979

Closed
aamcrae opened this issue Sep 23, 2022 · 7 comments
Closed

min_max not exposing device_class #78979

aamcrae opened this issue Sep 23, 2022 · 7 comments

Comments

@aamcrae
Copy link
Contributor

aamcrae commented Sep 23, 2022

The problem

In homeassistant/components/google_assistant/trait.py a check is made for the sensor device class so that the sensor can be matched to an appropriate Google Assistant sensor type.

For min_max sensors, it doesn't appear as though this attribute is exposed, and so no min_max based sensors
can be exported or synced with Google Assistant.
Presumably the device_class should be inherited from one of the child sensors.

What version of Home Assistant Core has the issue?

2022.9.1

What was the last working version of Home Assistant Core?

Not known

What type of installation are you running?

Home Assistant Container

Integration causing the issue

min_max

Link to integration documentation on our website

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

Diagnostics information

config_entry-google_assistant-821d371e09089be29be4406bfeeb5e1b.json.txt

The debug dump shows the sensor in the entity_config list, but nothing in the sync list.

Example YAML snippet

sensor:
  - platform: min_max
    type: mean
    name: Wine Cellar temperature
    round_digits: 1
    entity_ids:
      - sensor.wine_cellar_1_temperature
      - sensor.wine_cellar_2_temperature

google_assistant:
...
  report_state: true
  expose_by_default: false
  exposed_domains:
    - sensor
    - switch
  entity_config:
    sensor.wine_cellar_temperature:
      name: Wine Cellar temperature
      expose: true
      room: Wine Cellar
    switch.0x00158d000353d160:
      name: Switch
      expose: true
      room: Downstairs

Anything in the logs that might be useful for us?

No response

Additional information

No response

@homeassistant
Copy link
Contributor

min_max documentation
min_max source
(message by IssueLinks)


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

@aamcrae
Copy link
Contributor Author

aamcrae commented Sep 23, 2022

I am happy to try and fix this, and provide a suggested patch, but I'm new to HA so might take me a while to figure it out.

@aamcrae
Copy link
Contributor Author

aamcrae commented Sep 23, 2022

Also confirming that when one of the source temperature sensors is used, Google Assistant sees the sensor fine.

@aamcrae
Copy link
Contributor Author

aamcrae commented Sep 23, 2022

A workaround is to add the device_class via 'customize'.

@fabaff
Copy link
Member

fabaff commented Oct 2, 2022

I'm not using google_assistant thus I don't know if I got the issue right. Would it be sufficient to add device_class from the observed sensors to min_max?

@aamcrae
Copy link
Contributor Author

aamcrae commented Oct 2, 2022

Yes, that I think would be the right fix. The code that I pointed to in trait.py uses device_class to match against the Google Assistant types. Without device_class being set, no corresponding Google Assistant device type will be matched, so these sensors will never be exposable to Google Assistant.
Thanks!

@github-actions
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Dec 31, 2022
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 7, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Feb 6, 2023
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

3 participants