Closed Spartacus68 closed 6 months ago
Hello @Spartacus68
you need to define 1 state_map per value. If defined multiple time, only the first one is used.
use
type: custom:multiple-logbook-card
desc: true
entities:
- entity: binary_sensor.reed_input
state_map:
- icon: mdi:door-open
label: geöffnet
value: 'on'
- icon: mdi:door-closed
label: geschlossen
value: 'off'
- entity: binary_sensor.ir_input
state_map:
- icon: mdi:leak
value: 'on'
- icon: mdi:leak-off
value: 'off'
title: Haustür & Lichtschranke
From what I understand, you want to be able to customize the entity name, right ? When you talk about aliases, you mean assists aliases ? Can you create a separate issue for this.
@Spartacus68 did you have the time to test using the solution provided ?
@royto I checked this and yes, this is ok. But you can only change the icon OR the values, not both.
Means if I would like to change the icon and the value of an entity depending on its status, the only the first mapping (under state_map) will processed.
You can change both using provided configuration ... Did you test it ?
@royto: I checked it with my code, because your code is not working (syntax issue).
And I am not sure, if we are talking about the same thing. If you try to change the icon and the value of the SAME entity, then it does not work. In your examle, you are using two different entities (reed and ir) and then it works.
I update the configuration in the previous response (should be valid now)
To change both icon and label for the SAME entity, set it in the same state map:
...
state_map:
- icon: mdi:door-open
label: geöffnet
value: 'on'
...
ok! I have it, seems to be working now.
Is there also a way to overwrite the entity name? The entity is a reed-contact but it makes more sense to say that the door is open. In my case, I would like to overwrite the entity name (Haustür Reedkontakt) with "Haustür"!
sorry for the confusion at the beginning! Spartacus
I created a dedicated issue for this feature request. Closing this one as the problem is solved
@Spartacus68 You can already specify a custom label for entity using the label
option ...
type: custom:multiple-logbook-card
desc: true
entities:
- entity: binary_sensor.reed_input
label: 'Haustür'
state_map:
- icon: mdi:door-open
value: 'on'
- icon: mdi:door-closed
value: 'off'
- label: geschlossen
value: 'off'
- label: geöffnet
value: 'on'
- entity: binary_sensor.ir_input
state_map:
- icon: mdi:leak
value: 'on'
- icon: mdi:leak-off
value: 'off'
title: Haustür & Lichtschranke
@royto Hi, thank you very much! It works!
Describe the bug A clear and concise description of what the bug is. it is not possible to configure the lable-value and the icon-value in parallel
Expected behavior A clear and concise description of what you expected to happen. changen the lable of the device stat and the icon, depending on the state, also to overwrite the device name or to display the alias-name Screenshots If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
Card configuration Add your configuration here