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

Device class attribute is missing in MQTT discovery payload #2023

Closed
definitio opened this issue May 4, 2021 · 4 comments · Fixed by esphome/esphome#2092
Closed

Device class attribute is missing in MQTT discovery payload #2023

definitio opened this issue May 4, 2021 · 4 comments · Fixed by esphome/esphome#2092

Comments

@definitio
Copy link

definitio commented May 4, 2021

Operating environment/Installation (Hass.io/Docker/pip/etc.):

Arch Linux, Python 3.9, pip.

ESP (ESP32/ESP8266, Board/Sonoff):

ESP32

ESPHome version (latest production, beta, dev branch)

1.17.0

Affected component:

https://esphome.io/components/sensor/index.html

Description of problem:
Setting device_class doesn't work.

Problem-relevant YAML-configuration entries:

sensor:
  - platform: template
    name: $room illuminance
    state_topic: ${room}/sensor/illuminance
    device_class: illuminance
    lambda: 'return id(indoor_illuminance_raw).state;'
    update_interval: 10s
    filters:
      - sliding_window_moving_average:
          window_size: 6
          send_every: 6
          send_first_at: 6

Additional information and things you've tried:
Icon is also missing. It was there in the previous version.

@probot-esphome
Copy link

mqtt source
mqtt issues
mqtt recent changes
(message by IssueLinks)

@OttoWinter
Copy link
Member

Yeah the mqtt integration just hasn't added that feature yet. PRs to add this to MQTTSensorComponent are welcome!

@definitio
Copy link
Author

Fixed

@krconv
Copy link

krconv commented Jul 29, 2021

The fix for sensors is working great 🥳 ; just posted a fix for covers in esphome/esphome#2092

@github-actions github-actions bot locked and limited conversation to collaborators Nov 27, 2021
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.

3 participants