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

Feature: Enable state remapping per included group #233

Open
scyto opened this issue Mar 11, 2021 · 4 comments
Open

Feature: Enable state remapping per included group #233

scyto opened this issue Mar 11, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@scyto
Copy link

scyto commented Mar 11, 2021

Is your feature request related to a problem? Please describe.
I am using filters to create a dynamic card.
I have two types of device - one where off = battery dead and one where on = battery dead (this is actually an attribute called heartbeat, which i can't rename, thanks insteon!)

I would like to apply opposite state mappings for these two groups

Describe the solution you'd like
I would like to be able to do something like this:

type: 'custom:battery-state-card'
title: Battery Low
sort_by_level: dsc
filter:
  include:
    - name: entity_id
      value: 'heartbeat'
      state_map:
        - from: 'on'
          to: 0
        - from: 'off'
          to: 100
    - name: entity_id
      value: 'inverse-heartbeat'
      state_map:
        - from: 'on'
          to: 100
        - from: 'off'
          to: 0

Additional context

@scyto scyto added the enhancement New feature or request label Mar 11, 2021
@scyto scyto changed the title Feature: Enable state remapping with included groups Feature: Enable state remapping per included groups Mar 11, 2021
@scyto scyto changed the title Feature: Enable state remapping per included groups Feature: Enable state remapping per included group Mar 11, 2021
@maxwroc
Copy link
Owner

maxwroc commented Dec 21, 2021

I agree it might be useful but unfortunatelly can be quite hard/impossible to implement with the current way how card code works.

I will think about this little bit more hence I will keep this issue open for a bit more but I think I will have to close it later. Sorry

@scyto
Copy link
Author

scyto commented Dec 21, 2021

Thanks for considering it, appreciate it.
I guess the easiest way is to just make a second card for these devices :-) especially as it is dynamic card.

@maxwroc
Copy link
Owner

maxwroc commented Oct 24, 2023

I think that we could solve it in the following way. Instead of applying state-map to a group we can apply it conditionally. This way the solution will be more generic - useful in other cases too (e.g. when someone wants the same functionality but don't want to have groups).

The setting can be something like:

state_map:
  - from: "on"
    to: 100
    condition: "{entity_id|contains(inverse)}"

@stijnb1234
Copy link

Agree that's useful, now I have to specify all the 'same' entities by hand.

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

No branches or pull requests

3 participants