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

card_binary_sensor and card_binary_sensor_alert not displayed after HA Core 2023-11 #1398

Closed
wokkeltje13 opened this issue Nov 2, 2023 · 22 comments
Labels

Comments

@wokkeltje13
Copy link
Contributor

wokkeltje13 commented Nov 2, 2023

After 1.3.7 most of the issues are resolved since the HA 2023-1 upgrade but I still have issues with the binary sensor cards

image

This is my yaml code

- type: grid
  columns: 2
  square: false
  cards:
    - type: 'custom:button-card'
      template: card_binary_sensor_alert
      variables:
        ulm_card_binary_sensor_alert: true
        ulm_show_last_changed: true
        ulm_card_binary_sensor_alert_name: Bureau Buiten 1
      entity: binary_sensor.bureau_buiten_motion_sensor
    - type: 'custom:button-card'
      template: card_binary_sensor_alert
      variables:
        ulm_card_binary_sensor_alert: true
        ulm_show_last_changed: true
        ulm_card_binary_sensor_alert_name: Bureau Buiten 2
      entity: binary_sensor.bureau_buiten_2_motion_sensor_bureau
@wokkeltje13
Copy link
Contributor Author

setting ulm_show_last_changed to false solved the issue

@wokkeltje13 wokkeltje13 changed the title card_binary_sensor and card_binary_sensor_alert not displayed after HA Core 2023-11& card_binary_sensor and card_binary_sensor_alert not displayed after HA Core 2023-11 Nov 2, 2023
@pbartek20
Copy link

pbartek20 commented Nov 2, 2023

For me as well both mentioned cards are not working afer the update from 1.3.6 to 1.3.7 of Minimalist.
I'm still on core 10.5 so sorry that it not fits the full topic of this report.

But for me no error is visible only blank card. I tried as @wokkeltje13 suggested and changed ulm_show_last_changed to false but but still same. Looks like a problem on this cards in the new relase

code for one of my cards:

- type: horizontal-stack
    cards:
      - type: 'custom:button-card'
        template:
        - card_binary_sensor_alert
        variables:
          ulm_card_binary_sensor_alert_name: "Presence"
          ulm_card_binary_sensor_alert_icon: mdi:motion-sensor
          ulm_card_binary_sensor_alert: true
          ulm_show_last_changed: false
        entity: binary_sensor.presence_sensor_fp2_b4d2_presence_sensor_6
      - type: 'custom:button-card'
        template:
        - card_binary_sensor_alert
        variables:
          ulm_card_binary_sensor_alert_name: "Sofa"
          ulm_card_binary_sensor_alert_icon: mdi:sofa
          ulm_card_binary_sensor_alert: true
          ulm_show_last_changed: false
        entity: binary_sensor.presence_sensor_fp2_b4d2_presence_sensor_5

below screenshot how it look like:

issue_cards

@giannoug
Copy link

giannoug commented Nov 2, 2023

Same here after the core update:
image

Getting a lot of these in browser console:

button-card.js:425 ButtonCardJSTemplateError: TypeError: Cannot read properties of undefined (reading 'ulm_show_last_changed') in 'if (typeof(entity) !== 'undefined' && entity !== undefined){
    let device_class = entity.attribu...'
    at ti.eval (eval at _evalTemplate (button-card.js:425:9303), <anonymous>:10:18)
    at ti._evalTemplate (button-card.js:425:9389)
    at ti._getTemplateOrValue (button-card.js:425:9976)
    at button-card.js:425:9869
    at Array.forEach (<anonymous>)
    at ti._getTemplateOrValue (button-card.js:425:9846)
    at ti._objectEvalTemplate (button-card.js:425:9685)
    at ti.render (button-card.js:425:6853)
    at ti.update (button-card.js:1:19873)
    at ti.performUpdate (button-card.js:1:16761)

and

Uncaught (in promise) TypeError: e.setConfig is not a function
    at ti.render (button-card.js:425:7051)
    at ti.update (button-card.js:1:19873)
    at ti.performUpdate (button-card.js:1:16761)
    at ti._enqueueUpdate (button-card.js:1:16413)

@michaelsleen
Copy link

Same issue as @wokkeltje13 after updating UI Lovelace Minimalist to Version 1.3.7.

@tieskuh
Copy link
Contributor

tieskuh commented Nov 2, 2023

I have the same issue after updating minimalist to 1.3.7.

image

image

  - type: 'custom:button-card'
            template: card_binary_sensor
            variables:
              ulm_show_last_changed: true
              ulm_card_binary_sensor_name: Bewegingsmelder
            entity: binary_sensor.bewegingsmelder_garage_input_0_input

Downgrading to 1.3.6 solves the issue.

@billyjoebob999
Copy link

I was also having the same issue as @wokkeltje13. I did set ulm_show_last_changed to false and it did get the card working again but I noticed ulm_card_binary_sensor_name was no longer working. What ended up fixing both my issues was the following:

Change:
ulm_show_last_changed to ulm_show_last_alert_changed
ulm_card_binary_sensor_name to ulm_card_binary_sensor_alert_name

Looks like the documentation for the binary sensor card needs to be updated

https://ui-lovelace-minimalist.github.io/UI/usage/cards/card_binary_sensor/#description

@pbartek20
Copy link

@billyjoebob999

ulm_card_binary_sensor_alert_name - this I had alredy in my config since few months.
I tried ulm_show_last_changed to ulm_show_last_alert_changed either with true or false but still no luck.

I'm still on 10.5 core not sure if this is relevant for me why it is not working. It stopped working for me after 1.3.7 update

@wokkeltje13
Copy link
Contributor Author

wokkeltje13 commented Nov 2, 2023

I was also having the same issue as @wokkeltje13. I did set ulm_show_last_changed to false and it did get the card working again but I noticed ulm_card_binary_sensor_name was no longer working. What ended up fixing both my issues was the following:

Change: ulm_show_last_changed to ulm_show_last_alert_changed ulm_card_binary_sensor_name to ulm_card_binary_sensor_alert_name

Looks like the documentation for the binary sensor card needs to be updated

https://ui-lovelace-minimalist.github.io/UI/usage/cards/card_binary_sensor/#description

Can't find any traces of ulm_show_last_alert_changed in the card. Have same result even if I change the variable to something random. My issue only appears with ulm_show_last_changed: true,
ulm_card_binary_sensor_alert_name is an old change that was already fixed before my issues appear (2023-11 and 1.3.7)

@billyjoebob999
Copy link

Sorry for not being clear. Didn't mean to imply that ulm_card_binary_sensor_alert_name was part of the fix. Not sure why the custom name stopped working after I commented out ulm_show_last_changed: true and not before since it sounds like this changed a while back.

Updating the card with ulm_show_last_alert_changed: true is what got everything working for me.

Here is the code i'm using incase it helps.

  - type: 'custom:button-card'
    template: card_binary_sensor_alert
    variables:
      ulm_card_binary_sensor_alert_name: Front door
      ulm_card_binary_sensor_alert: true
      ulm_show_last_alert_changed: true
    entity: binary_sensor.front_door

image

While writing this I realized I'm using the binary_sensor_alert card and was referencing the binary_sensor card. Apologies there.

@basbruss
Copy link
Collaborator

basbruss commented Nov 2, 2023

But it's not working as it is supposed, to cause ulm_show_last_alert_changed does not exist in the source code. So it shows the normal state

@basbruss
Copy link
Collaborator

basbruss commented Nov 2, 2023

I found the source of the problem

[[[
let vars = variables;
if(variables.ulm_outlet_power_enable_popup) {
vars.ulm_custom_popup = {
'template': 'popup_power_outlet_stats',
'popup_variables': {
'ulm_popup_power_outlet_sensor1': variables.ulm_popup_power_outlet_sensor1,
'ulm_popup_power_outlet_sensor2': variables.ulm_popup_power_outlet_sensor2,
'ulm_popup_power_outlet_graph_sensor': variables.ulm_popup_power_outlet_graph_sensor
}
};
}
return vars;
]]]
, but do not have a solution ready without adding breaking changes for now

@pbartek20
Copy link

pbartek20 commented Nov 2, 2023

After I updated to core 11.0 it started working same as @wokkeltje13 mentioned when ulm_show_last_changed is set to false. When set to true card does not work. On 10.5 was not working for both true and false. Also reloading the UI Minimalist & all yaml config from HA not helped. Only after full HA system reboot and setting state to false card is working.

@wokkeltje13
Copy link
Contributor Author

I found the source of the problem

[[[
let vars = variables;
if(variables.ulm_outlet_power_enable_popup) {
vars.ulm_custom_popup = {
'template': 'popup_power_outlet_stats',
'popup_variables': {
'ulm_popup_power_outlet_sensor1': variables.ulm_popup_power_outlet_sensor1,
'ulm_popup_power_outlet_sensor2': variables.ulm_popup_power_outlet_sensor2,
'ulm_popup_power_outlet_graph_sensor': variables.ulm_popup_power_outlet_graph_sensor
}
};
}
return vars;
]]]

, but do not have a solution ready without adding breaking changes for now

What will be the breaking change? Currently it is already broken.

@brendanlees
Copy link

Can also confirm same issues noted by @wokkeltje13 after updating to 1.3.7 & core 11.0 - cards on ulm_show_last_changed: true are now blank or intermittenly show the same errors shown by @tieskuh unless rolling back versions.

@wokkeltje13
Copy link
Contributor Author

Any idea how and when this issue can be solved without a rollback?
Things we can do to test?

@spammads
Copy link

spammads commented Nov 6, 2023

Same here. Would appreciate a fix.

@johnmoxon
Copy link

Same issue, have applied, workaround as below, but now missing any value for last_changed, so will look forward to the fix 👍

ulm_show_last_alert_changed: true
ulm_show_last_changed: false
ulm_card_binary_sensor_alert: true

@basbruss
Copy link
Collaborator

basbruss commented Nov 7, 2023

Should be fixed with release https://github.com/UI-Lovelace-Minimalist/UI/releases/tag/v1.3.8

Note the breaking change to the card configs to apply the fix 😉

@spammads
Copy link

spammads commented Nov 7, 2023

Applied the fix. Lgtm. Thanks!

@wokkeltje13
Copy link
Contributor Author

Tnx, fixed the issue

@basbruss basbruss closed this as completed Nov 7, 2023
@AneeshBhatnagar
Copy link
Contributor

Thanks for this fix! I just hit this issue after the upgrade, but glad I could find the fix here

@DoctorMod
Copy link

This issue also seems to affect generic cards when you have an entity with a device class of timestamp as well, e.g. the in-built uptime sensor. I've done some debugging and it looks like it's an issue with the translation code with the helpers.relativeTime function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.