home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.8k stars 30.89k forks source link

Device class customization no longer being applied #10667

Closed fanaticDavid closed 6 years ago

fanaticDavid commented 7 years ago

Home Assistant release (hass --version): 0.58.0

Python release (python3 --version): 3.6.3

Component/platform: Binary Sensor

Description of problem: I use device classes (as described here) to customize how the on/off state of some binary sensors is shown in the UI. Prior to Home Assistant 0.58.0, this was working just fine. Since 0.58.0, the device class is ignored and the state of binary sensors is simply shown as on or off.

Expected: Device classes for binary sensors need to change the visual representation of the on/off states as they did in Home Assistant 0.57.x and older.

Problem-relevant configuration.yaml entries and steps to reproduce: In customize.yaml:

binary_sensor.living_area_door_sensor:
  device_class: opening
binary_sensor.bedroom_multi_sensor:
  device_class: motion

In the UI:

schermafbeelding 2017-11-19 om 02 03 16

Additional info: Previously, the state of the door sensor would show as open or closed, and the state of the motion sensor would show as detected or clear.

MartinHjelmare commented 7 years ago

I think this is a frontend issue. I don't believe anything significant has changed in the backend in this context.

fanaticDavid commented 7 years ago

Ok so...thanks to a comment in #10666, I found out this issue occurs when no language is selected. Once a language is chosen, the device classes are applied again.

It does seem I can only select a language when I access my Home Assistant instance via the related ip address and port directly. When I access Home Assistant through my nginx reverse proxy and change the language, nothing happens. This worked fine in version 0.57.x.

In the Home Assistant log, I found this:

2017-11-19 22:11:41 WARNING (MainThread) [aiohttp.websocket] websocket connection is closing.

I'm not sure if this was triggered by changing the language through the nginx reverse proxy. The timing is right, but the warning is only shown once when I tried to set the language several times.

MartinHjelmare commented 7 years ago

Definitely sounds like a frontend issue.

fanaticDavid commented 6 years ago

Fixed after selecting a language. With the release of Home Assistant 0.58.1, the chosen language is now remembered as well.