Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95468

Picture Element and state icon change color

$
0
0

@jugla wrote:

Hello,
I’ve just found the picture-element https://www.home-assistant.io/lovelace/picture-elements/

I drawn my appartment plan , and I wanted to change the color of my PC depending on its state (whether it is on or not).
I have a device tracker that say “home” or “not_home”.

I don’t know how to do it in a easy way. What I have done is with a conditional element.
Here after the PC is call bonite and device tracker is managed by my freebox.
The PC icon comes green if at home and red if not

type: picture-elements
title: state of device (action=history)
elements:

  - type: conditional
    conditions:
      - entity: device_tracker.bonite_2
        state: home
    elements:
      - type: state-icon
        entity: device_tracker.bonite_2
        title: PC Windows
        style:
          top: 28%
          left: 34%
          '--paper-item-icon-color': green
  - type: conditional
    conditions:
      - entity: device_tracker.bonite_2
        state: not_home
    elements:
      - type: state-icon
        entity: device_tracker.bonite_2
        title: PC Windows
        style:
          top: 28%
          left: 34%
          '--paper-item-icon-color': red

image: /local/plan_home_N.jpg

I would like to use a template . For instance in '--paper-item-icon-color': red
But no way.

Any idea ?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 95468

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>