Thought I would add my solution to this as I never got this version to work.
Mine is a bit hacky but it works. NB If the “hand” is outside the clock face then they are in a place i have not set up a condition for.
Using a little MS paint and PowerPoint I made three pictures. The clock face (Weasley clock.png), and 2 Clock hands with Cartonified faces as png files (E%20clock%20hand3.png and A%20clock%20hand3.png) and uploaded them to the “/local/images/” folder.
Then using a combination of:
I made my version which, while a work in progress, does work.
It rotates the “hands” of the “clock” to pont at a location name based off the zones i have set up in home assistant.
- Picture Element Card (with CardMods applied)
The code below contains 2 sensors which modify the location of the hands. How this done is shown in the next section of code.
type: picture-elements
card_mod:
style: |
ha-card {
--my-transform-style: {{states('sensor.locationclocka')}};
--my-transform-style2: {{states('sensor.locationclocke')}};
}
elements:
- type: image
image: /local/images/A%20clock%20hand3.png
style:
top: 100%
left: 85%
transform: var(--my-transform-style)
- type: image
image: /local/images/E%20clock%20hand3.png
style:
top: 100%
left: 85%
transform: var(--my-transform-style2)
image: /local/images/Weasley clock.png
- Template sensor - helper
Is a sensor which output contains text detailing how i want the position of the “clock hand” to be changed in the picture element card.
Each Person has their own “hand”, and because i don’t want them to overlap when people are in the same position each.
These Translations and rotations are specific to the pictures I used so will have to be tweaked, at laborious extent, for ech individual and picture.
(i have edited the below slightly to anonymize this as much as possible)
Person 1 ‘sensor.locationclocka’
translate(-280%,-105%) rotate(-0.03turn)
{% elif states('person.person1') == 'Town centre' %}
translate(-280%,-105%) rotate(0.14turn)
{% elif states('person.person1') == 'Work' %}
translate(-280%,-105%) rotate(0.3turn)
{% elif states('person.person1') == 'not_home' %}
{% if states('sensor.home_aperson1_direction_of_travel') == 'stationary' %}
translate(100%,-120%) rotate(-0.1turn)
{% else %}
translate(-280%,-105%) rotate(0.47turn)
{% endif %}
{% elif states('person.person1') == 'Sister in laws house' %}
translate(-280%,-105%) rotate(0.64turn)
{% elif states('person.person1') == 'Mother in laws house' %}
translate(-280%,-105%) rotate(0.80turn)
{% endif %}
person 2 ‘sensor.locationclocke’
{% if states('person.Person2') == 'home' %}
translate(-278%,-110%)rotate(0.03turn)
{% elif states('person.Person2') == 'Town centre' %}
translate(-278%,-110%) rotate(0.20turn)
{% elif states('person.Person2') == 'word' %}
translate(-278%,-110%) rotate(0.36turn)
{% elif states('person.Person2') == 'not_home' %}
{% if states('sensor.home_Person2_direction_of_travel') == 'stationary' %}
translate(-650%,-130%) rotate(0.1turn)
{% else %}
translate(-278%,-110%) rotate(0.53turn)
{% endif %}
{% elif states('person.Person2') == 'Sisters House' %}
translate(-278%,-110%) rotate(0.70turn)
{% elif states('person.Person2') == 'Mothers house' %}
translate(-278%,-110%) rotate(0.86turn)
{% endif %}
Hope this helps/inspires someone.