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

Fix state display for binary_sensor entity with device_class #74

Merged
merged 2 commits into from
Jun 9, 2020

Conversation

sebr
Copy link
Contributor

@sebr sebr commented May 1, 2020

Since upgrading to HA 0.109, binary_sensor entities with a device_class have stopped showing the device specific state when used with multiple-entity row. Perhaps this is a result of the localization changes to lovelace.

In the following screenshot, you can see the same entity used in both multiple-entity-row as well as a standard entities card.

Screen Shot 2020-05-01 at 2 40 35 pm

This change uses the same logic as compute_state_display.ts which is used with the core entity displays in Lovelace.

The logic in entityStateValue() is a fair bit more complicated than what is used in compute_state_display.ts - I've updated the code to be more consistent with it. This also now fixes the state value for other types of entities which support the device_class attribute, such as cover.

Fixes #73

@mycanaletto
Copy link

Hello,
What solution do you suggest to work around this problem?

@sebr
Copy link
Contributor Author

sebr commented May 1, 2020

You can apply this patch directly to your downloaded version of the plugin @mycanaletto

@mycanaletto
Copy link

Howto ? Or I wait the next release ...?

@sebr
Copy link
Contributor Author

sebr commented May 6, 2020

ping @benct - maybe you haven't seen this :)

@benct
Copy link
Owner

benct commented May 6, 2020

Great stuff! I haven't had much time to look at any of my lovelace plugins lately, but I will try to do so as soon as I can.

The over-complicated entityStateValue() is already based entirely on compute_state_display.ts, but I see they have simplified it at some point after my shameless copy (you can see the similarity if you look at the history of their version) 😅

@benct benct self-assigned this May 6, 2020
@benct benct added the enhancement New feature or request label May 6, 2020
@benct benct merged commit 0fca179 into benct:master Jun 9, 2020
@benct
Copy link
Owner

benct commented Jun 9, 2020

Sorry for the delay, will try to get a new release out today.

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

Successfully merging this pull request may close these issues.

HA 109.0 - State is not correct
3 participants