-
Hello again.
I have the following structure in inkscape for fp.svg:
In sensors.yaml I have the following code that works: - platform: template
sensors:
del_dneva:
friendly_name: "Del dneva"
value_template: >
{% set current_hour = strptime(states('sensor.time'), "%H:%M").hour %}
{% set sun_state = states('sun.sun') %}
{% if sun_state == "below_horizon" and current_hour < 22 %}
Noč
{% elif sun_state == "above_horizon" and current_hour < 6 %}
Jutro
{% elif '09:00' <= states('sensor.time') <= '11:45' %}
Dopoldan
{% elif '11:45' <= states('sensor.time') <= '12:15' %}
Poldne
{% elif '12:15' <= states('sensor.time') <= '19:00' %}
Popoldan
{% elif sun_state == "below_horizon" and current_hour < 16 %}
Večer
{% endif %} In floor plan card is configuration: config:
defaults:
hover_action: hover-info
tap_action: more-info
image: /local/img/fp/fp.svg
rules:
- element: del_dneva
entity: sensor.del_dneva
tap_action: false
hover_action: false
state_action:
action: call-service
service: floorplan.image_set
service_data: |
>
var imageName = '';
switch (entity.state) {
case 'Jutro': imageName ='jutro'; break;
case 'Dopoldan': imageName = 'dopoldan'; break;
case 'Poldne': imageName = 'poldne'; break;
case 'Popoldan': imageName = 'popoldan'; break;
case 'Večer': imageName = 'vecer'; break;
case 'Noč': imageName = 'noc'; break;
}
return '/local/img/fp/' + imageName + '.png'; Changing images depending on the part of the day works without a problem. There is also configuration on the floor plan card: - element: switch_sw_ho
entity: switch.sw_ho
state_action:
action: call-service
service: floorplan.class_set
service_data: entitystate-${entity.state}
tap_action:
action: call-service
service: homeassistant.toggle and - element: switch_covering_sw_ho
entity: switch.sw_ho
state_action:
action: call-service
service: floorplan.class_set
service_data: entitystate-${entity.state}
tap_action:
action: call-service
service: homeassistant.toggle
my fp.css file contain: @keyframes fade-in {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
svg, svg * {
pointer-events: all !important;
cursor: auto !important;
display: block !important;
margin: 0px !important;
max-height: 100vh !important;
width: auto !important;
padding-top: 50px !important;
padding-bottom: 50px !important;
}
svg path {
fill: inherit;
stroke: inherit;
stroke-width: inherit;
}
#switch_coverings {
display: none !important;
mix-blend-mode: lighten !important;
animation: 0.75s fade-in linear forwards !important;
}
#switch_coverings .entitystate-on {
display: block !important;
z-index: 100 !important;
}
#areas {
fill: none !important;
stroke: none !important;
stroke-width: 0 !important;
}
#areas .entitystate-on {
visibility: visible !important;
stroke-opacity: 1 !important;
stroke: #118cdd !important;
stroke-width: 3px !important;
}
And now the problem: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
There is no entitystate-off class so when that is called for by your rule nothing will happen. I also suggest removing all the # selectors as that is just complicating what should be a simple case of applying one of two css classes to your images. |
Beta Was this translation helpful? Give feedback.
-
Damned again!!!The mistake was that I was using: #switch-coverings {
visibility: hidden !important;
mix-blend-mode: lighten !important;
} it should be: #del_dneva {
visibility: visible !important;
opacity: 1 !important;
mix-blend-mode: lighten !important;
} mix-blend-mode was not in the right place in the css file mix-blend-mode: lighten !important;
} After this repair it is now working!!!! |
Beta Was this translation helpful? Give feedback.
Damned again!!!
The mistake was that I was using:
it should be:
mix-blend-mode was not in the right place in the css file
After this repair it is now working!!!!