That is exactly what I experienced. The card is changing the color of the on state, but doesnāt record that state of that color if you change to a second color. It appeared to me it grabs the logs from HA which does record light colors in the logbook.
One thought was to create a log of the sensor color then I think it would.
:)) I also feel like I have to achieve this, but Iāve already spent dozens of hours, searched the Internet far and wide and havenāt found anything.
Thatās why Iām looking for help on the forum.
The built-in āstate_mapā option maps colors from the state, itās a pity that you canāt map from the attribute state, that would be the end of the matter.
But if the card creator can map it via card-mod, itās certainly possible.
If a template sensor can record the color created and that is mapped, then you can reference that color. We are literally just one step removed from the data you want.
Iām going to test that theory because template sensor history hit the logbook
But in the templates sensor configuration there is no icon_color option.
If it was, that would be the end of the matter.
I donāt think history records the colors of the icons.
The colors are probably overwritten in the cards, but I donāt know
I have a sensor in my config that combines to attributes and that references a SVG. If the fan is going forward it uses one SVG and in reverse it uses another. The logbook is recording the entity pic.
the sensor yaml
sensor:
- platform: template
sensors:
fan_direction:
friendly_name: "Fan Direction"
unique_id: fan1
value_template: "{{ state_attr('fan.bedroom_fan', 'direction') }}"
fan_direction_speed:
friendly_name: "Fan Direction Speed"
unique_id: fan2
value_template: |
{% set direction = state_attr('fan.bedroom_fan', 'direction') %}
{% set speed = state_attr('fan.bedroom_fan', 'percentage') %}
{{[direction,speed]|join("")}}
entity_picture_template: >-
{% set direction = state_attr('fan.bedroom_fan', 'direction') %}
{% set path = "/local/animated/" %}
{% set speed = state_attr('fan.bedroom_fan', 'percentage') %}
{% set ext = ".svg"%}
{{[path,direction,speed,ext]|join("")}}
you could assign a pic to each app state and it will show in the log.
Which means we could use the actual app image for the log. Iāll put an example together. Iāve already done this for for a tv icon so it shows what app is in use.
The image on the TV would change to the app playing in one of my setups. That image would record in the logbook.
Iāll try it and see if it works, but itās still too complicated a solution.
I have to look for a solution how to map it via cardmod.
This is possible because the owner does it in this card by overwriting the color.
I just need to determine at what level of code (ha-card; state-badge; ha-state-icon; ha-svg etc.) it does it and how
Itās actually fairly simple with one sensor and images for the app modes. I have most of it already built, just need to find all the code. Iāll message you tomorrow.
@kosmaluk This is what your logbook will look like with entity pictures for android device. I created a template sensor that refers to the app_name and references a locally stored svg. This is a bit off topic so feel free to message me if you want to pursue this method.
Interesting solution. Iāll definitely think about it.
However, for me the best way is to use the simpler and faster card-mod (css) function.
I have a dozen or so logbook cards and it would be difficult to create records for each of them. New entities with different icons are constantly added to my folders, so I need to have a quick way to modify them.
I wrote to the card owner and he seems to be working on solving this issue now. I saw that he had a feature request on this topic, so I guess Iām not the first.
Hey, I am trying to figure this out, as I am developing a dashboard. I have a radiator, that has an attributes.hvac_action that gives the following values; heating, idle and cooling. The below code is not working, any pointers?