Frontend: home/not_home instead of Home/Away and Binary sensor only returning on/off

Created on 1 May 2020  路  39Comments  路  Source: home-assistant/frontend

Checklist

  • [x] I have updated to the latest available Home Assistant version.
  • [x] I have cleared the cache of my browser.
  • [x] I have tried a different browser to see if it is related to my browser.

The problem

Since the update to 0.109.0 (up until 0.109.2) all my UI card that have to deal with binary sensor or "person" are returning "miss-translated" values.
All the "Home" fields are now showing as "home"
All the "Away" fields are now showing as "not_home"
The Door/Window binary sensor is showing on/off instead of open/closed
The Leak binary sensor is showing on/off insteadf of wet/dry (not sure if it was "wet")
And so on

Expected behavior

States in the UI should be show in a more "human friendly" way (as they were previous 0.109.0)

Steps to reproduce

1.Add a device_tracker and a binary sensor
2. Create a smple view
3. Open the view on Lovelace

Environment

  • Home Assistant release with the issue: 0.109.0+
  • Last working Home Assistant release (if known): 0.108.9
  • Browser and browser version: Chrome 81.0.4044.129
  • Operating system: Windows 10

State of relevant entities

image

image

Test View used:

title: Test
icon: mdi:tune
panel: true
path: test
cards:
  - type: glance
    columns: 2
    show_state: true
    entities:
      - name: Andrea
        entity: person.andrea_iannucci
        tap_action:
          action: none
      - name: Window Status
        entity: binary_sensor.living_room_window
        tap_action:
          action: none

Version 0.108.9
image

Version 0.109.2:
image

Problem-relevant configuration


Javascript errors shown in your browser console/inspector

translations-mixin.ts:182 Uncaught (in promise) {code: "unknown_error", message: "Unknown error"}
_loadHassTranslations @ paper-ripple.js:356
async function (async)
_loadHassTranslations @ paper-ripple.js:356
value @ home-assistant.ts:42
initializeHass @ paper-ripple.js:356
value @ home-assistant.ts:42
async function (async)
value @ home-assistant.ts:42
value @ home-assistant.ts:42
performUpdate @ app.573b4877.js:2
_enqueueUpdate @ app.573b4877.js:2
async function (async)
_enqueueUpdate @ app.573b4877.js:2
_requestUpdate @ app.573b4877.js:2
initialize @ app.573b4877.js:2
initialize @ app.573b4877.js:2
A @ app.573b4877.js:2
V @ app.573b4877.js:2
F @ paper-ripple.js:356
(anonymous) @ paper-ripple.js:356
(anonymous) @ paper-ripple.js:356
(anonymous) @ paper-ripple.js:356
(anonymous) @ paper-ripple.js:356
(anonymous) @ paper-ripple.js:356
(anonymous) @ paper-ripple.js:356
(anonymous) @ paper-ripple.js:356
(anonymous) @ paper-ripple.js:356
(anonymous) @ paper-ripple.js:356
(anonymous) @ paper-ripple.js:356
(anonymous) @ paper-ripple.js:356
(anonymous) @ paper-ripple.js:356
(anonymous) @ paper-ripple.js:356
se @ paper-ripple.js:356
r @ home-assistant-main.ts:151
(anonymous) @ home-assistant.ts:42
i @ app.573b4877.js:2
(anonymous) @ app.573b4877.js:2
(anonymous) @ app.573b4877.js:2

Uncaught (in promise) TypeError: Object(...)(...)._addCard is not a function
    at card-tools.js:1
    at new Promise (<anonymous>)
    at Module.<anonymous> (card-tools.js:1)
    at r (card-tools.js:1)
    at card-tools.js:1
    at card-tools.js:1

Additional information

bug

Most helpful comment

All 39 comments

You have an error with card-tools, you probably use custom cards and not just the config you posted.

Works fine here:
image

Yes I do use custom cards elsewhere, but not on that view.. that view was actually done as a test to show the issue without custom cards

I was surprised of the card-tool error too, but there is no custom-card, the one I posted it's literally the whole view file

@thomasloven do you think that the card-tool might be miss-behaving somehow here?

A panel view doesn't have an _addCard function.

Can you check the logs of the backend for the translations-mixin.ts:182 Uncaught (in promise) {code: "unknown_error", message: "Unknown error"} error?

Nothing related in the home-assistant.log
Or did you mean a different log?

Oh I think I got what you mean for backend.
Nothing similar to translation, but maybe this?

Log Details (ERROR)
Logger: frontend.js.latest.202004271
Source: components/system_log/__init__.py:209
First occurred: 1:42:01 PM (4 occurrences)
Last logged: 1:42:01 PM

https://URL/frontend_latest/chunk.12bbeb31a3fa2f85823e.js:1441:318 Uncaught TypeError: Cannot read property 'replaceChild' of null

Seeing the same in regular cards:

https://community.home-assistant.io/t/0-109-new-integrations-page-and-weather-card-frontend-lost-weight/191097/238?u=mariusthvdb
sorry, that was a wrong link, shoaled have this picture:

Schermafbeelding 2020-05-01 om 10 03 21

all devices show like this, on regular core cards, no custom cards involved:

  - type: entities
    title: iMacs
    show_header_toggle: false
    entities:
      - device_tracker.imac_xx_lan
      - device_tracker.imac_xx_wifi
      - device_tracker.imac_x_lan
      - device_tracker.imac_x_wifi
      - device_tracker.imac_xxx_lan
      - device_tracker.imac_xxx_wifi

Custom cards need updating: https://developers.home-assistant.io/blog/2020/04/23/frontend-translations

Other than that I'm not able to reproduce this...

could this be related:

2020-05-01 11:56:37 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.2725615952] Error handling message: Unknown error
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 20, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/frontend/__init__.py", line 550, in websocket_get_translations
    msg.get("config_flow"),
  File "/usr/src/homeassistant/homeassistant/helpers/translation.py", line 329, in async_get_translations
    resources = flatten(resource_func(results[0], components, category))
  File "/usr/src/homeassistant/homeassistant/helpers/translation.py", line 127, in merge_resources
    new_value = translation_strings[component].get(category)
KeyError: 'variable'

since you speak of translations, it is the only thing I the logs I can see. rather a lot of it I must admit

I saw that too now:

2020-05-01 13:57:50 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.139663710907088] Error handling message: Unknown error
Traceback (most recent call last):
  File "/home/ha/homeassistant/lib/python3.7/site-packages/homeassistant/components/websocket_api/decorators.py", line 20, in _handle_async_response
    await func(hass, connection, msg)
  File "/home/ha/homeassistant/lib/python3.7/site-packages/homeassistant/components/frontend/__init__.py", line 550, in websocket_get_translations
    msg.get("config_flow"),
  File "/home/ha/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/translation.py", line 329, in async_get_translations
    resources = flatten(resource_func(results[0], components, category))
  File "/home/ha/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/translation.py", line 127, in merge_resources
    new_value = translation_strings[component].get(category)
KeyError: 'variable'

To provide the whole config bit, in the configuration.yaml I got this:

    lovelace-test-card:
      mode: yaml
      filename: dashboard_test_card.yaml
      title: Test
      icon: mdi:tune
      show_in_sidebar: true
      require_admin: true

The dashboard file is:

---
# This is actually just a bootstrap for my Lovelace configuration.
# It loads all resources for Lovelace dynamically from subfolders
# inside the `lovelace/resources` directory.
#
# Views are actually include one by one, this to guarentee the order of
# the tabs of the view in the UI.
#
title: Test Card
views:
  - !include lovelace/views/test_card.yaml

And the view file:

title: Test
icon: mdi:tune
panel: true
path: test-card
cards:
  - type: glance
    columns: 2
    show_state: true
    entities:
      - name: Andrea
        entity: person.andrea_iannucci
        tap_action:
          action: none
      - name: Window Status
        entity: binary_sensor.living_room_window
        tap_action:
          action: none

yes, and I now see that all binary_sensors show lower on/off also. as OP . Must admit this is a HA instance in English, have another one in Dutch which seems so show alright. a 3d instance hasn't got device_trackers, and only 1 binary_sensor.updater which also shows correctly, in English.

My production system is in trouble... 109.1

I have tried:
English
Italian
Spanish
German

All of them have the same issue to me.
Sorry, I don't speak Dutch so I couldn't test that xD

Can you guys post a list of your loaded integrations? Either from /developer-tools/info or by running in the console while selecting <home-assistant>: $0.hass.config.components

developer-tools/info is not very easy to copy (might be a good idea to add a copy to clipboard button there..., hint hint ;-) ) and the console doesn't work, but I have my own sensor:

Schermafbeelding 2020-05-01 om 15 06 27

airvisual
alarm_control_panel
alert
api
auth
automation
binary_sensor
breaking_changes
browser_mod
calendar
camera
cast
climate
config
conversation
coronavirus
device_automation
device_tracker
favicon
ffmpeg
fontawesome
frontend
gdacs
geo_location
glances
google_assistant
group
hacs
history
homeassistant
http
input_boolean
input_datetime
input_number
input_select
input_text
intent
life360
light
logbook
logbook_cache
logger
lovelace
map
media_player
mobile_app
mqtt
notify
onboarding
panel_iframe
persistent_notification
person
pi_hole
proximity
python_script
recorder
scene
script
search
sensor
shell_command
shopping_list
simpleicons
speedtestdotnet
spotify
ssdp
sun
switch
system_health
system_log
telegram_bot
timer
tts
updater
utility_meter
variable
wake_on_lan
weather
webhook
websocket_api
wwlln
zigbee2mqtt_networkmap
zone

What is variable for component?

That is the problem, can you try disabling it?

Sure

Actually now from HACS it is named "var" instead of "variable".
Checking latest version from HACS (I didn't had it via HACS.. it wasn't there when I started using HACS actually).

in my case it is https://github.com/rogro82/hass-variables, ill disable it for testing right now.

That's it, using the latest version (which change variable.py into var/_init_.py) did it!

Damn!

@Mariusthvdb try to rename that variable folder inside custom_components to var and restart HA... probably it will fix yours too!

That is the problem, can you try disabling it?

why would you say that is the cause of the issue? apparently we use different integrations, could they both be the cause for the identical issue?

If that works, I would open an issue to that project to change the name maybe
@bramkragten thanks a lot for your time and help... I wouldn't ever had figure that out on my own!

I think it's the "variable" name causing HA to try to use that instead of an internal component.

@Mariusthvdb try to rename that variable folder inside custom_components to var and restart HA... probably it will fix yours too!

this is the only CC I have which is not in a dedicated folder, but directly in custom/components..

But the git repo you ponted to have it in a folder and the py file is _init_.py as new standard (from quite some time now, so that might be it

yes, I had the init and the other files there, (it has been a long standing CC) and now moved those to /custom_components/var now I checked it again... ;-)

why would this now all of a sudden cause havoc? @bramkragten , it has been functioning perfectly for almost 3 years, on each and every Ha version, and this error was never there.

btw: solved!

Schermafbeelding 2020-05-01 om 15 24 08

I have the feeling something has changed in the translation which uses something like either a variable.py file or something that caused HA to get confused.

my CC variable stopped working now I have it in its dedicated folder....

Are you using the latest update?
It might be worth maybe to switch to the one present in HACS?

think this can be closed here, Ill sort my Variable stuff in the repo, while giving it another restart right now.

Would like to understand though why this was the cause, and if we can use the /variable folder or not, cause if I use /var, the integration wont work/initialize...

@SeLLeRoNe
just so you know, and for reference:
Ive now filed the CC in the custom_components/variable folder (tried /var before because of your issue/suggestion, which didn't work) and the CC is working just like before again.

And, my device_trackers, and binary_sensors all show correctly now.

so 1+1 = 3 ;-0

thanks Andrea and Bram!

Before it was variable.py correct?
If so that's the issue, once you move in a subfolder and ithe filename is _init_py it no longer cause conflict.

hmm we are supposed to guard for that and still support single file custom components. Testing it now.

got to say, you're a magician. very impressed thx!

Was this page helpful?
0 / 5 - 0 ratings