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

home/not_home instead of Home/Away and Binary sensor only returning on/off #5683

Closed
3 tasks done
SeLLeRoNe opened this issue May 1, 2020 · 39 comments · Fixed by home-assistant/core#35032
Closed
3 tasks done
Labels
Bug Current Bug in UI - Extra Attention

Comments

@SeLLeRoNe
Copy link

SeLLeRoNe commented May 1, 2020

Checklist

  • I have updated to the latest available Home Assistant version.
  • I have cleared the cache of my browser.
  • 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

@SeLLeRoNe SeLLeRoNe added the Bug Current Bug in UI - Extra Attention label May 1, 2020
@bramkragten
Copy link
Member

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

Works fine here:
image

@SeLLeRoNe
Copy link
Author

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

@SeLLeRoNe
Copy link
Author

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

@bramkragten
Copy link
Member

A panel view doesn't have an _addCard function.

@bramkragten
Copy link
Member

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

@SeLLeRoNe
Copy link
Author

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

@SeLLeRoNe
Copy link
Author

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

@Mariusthvdb
Copy link
Contributor

Mariusthvdb commented May 1, 2020

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

@bramkragten
Copy link
Member

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...

@Mariusthvdb
Copy link
Contributor

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

@SeLLeRoNe
Copy link
Author

SeLLeRoNe commented May 1, 2020

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

@Mariusthvdb
Copy link
Contributor

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

@SeLLeRoNe
Copy link
Author

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

@bramkragten
Copy link
Member

bramkragten commented May 1, 2020

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

@Mariusthvdb
Copy link
Contributor

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

@SeLLeRoNe
Copy link
Author

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

@bramkragten
Copy link
Member

bramkragten commented May 1, 2020

What is variable for component?

@SeLLeRoNe
Copy link
Author

@bramkragten
Copy link
Member

That is the problem, can you try disabling it?

@SeLLeRoNe
Copy link
Author

Sure

@SeLLeRoNe
Copy link
Author

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).

@Mariusthvdb
Copy link
Contributor

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

@SeLLeRoNe
Copy link
Author

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

Damn!

@SeLLeRoNe
Copy link
Author

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

@Mariusthvdb
Copy link
Contributor

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?

@SeLLeRoNe
Copy link
Author

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!

@SeLLeRoNe
Copy link
Author

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

@Mariusthvdb
Copy link
Contributor

@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..

@SeLLeRoNe
Copy link
Author

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

@Mariusthvdb
Copy link
Contributor

Mariusthvdb commented May 1, 2020

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

@SeLLeRoNe
Copy link
Author

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.

@Mariusthvdb
Copy link
Contributor

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

@SeLLeRoNe
Copy link
Author

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

@Mariusthvdb
Copy link
Contributor

Mariusthvdb commented May 1, 2020

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...

@Mariusthvdb
Copy link
Contributor

@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!

@SeLLeRoNe
Copy link
Author

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.

@balloob
Copy link
Member

balloob commented May 1, 2020

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

@balloob
Copy link
Member

balloob commented May 1, 2020

Fix here home-assistant/core#35032

@Mariusthvdb
Copy link
Contributor

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

@github-actions github-actions bot locked and limited conversation to collaborators Jul 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Current Bug in UI - Extra Attention
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants