My floor plan example: #411
Replies: 5 comments 2 replies
-
Inkscape tricks & tips
Why XML Editor
Save the work file as normal.
select a different file from the one you are working in !!!! |
Beta Was this translation helpful? Give feedback.
-
Changing the background image based on the time of day, which I don't use!!!If anyone doesn't like the blackout overlay with opacity???
- 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 %}
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'; Be careful! The images are not the same size as the images in zip filel!Enjoy |
Beta Was this translation helpful? Give feedback.
-
Let's go into more detail
card_mod: //HACS add on card
style: |
:host { //element in HTML (DOM) from HA "https://www.w3schools.com/jsref/dom_obj_all.asp"
position: absolute !important; //position of page "https://www.w3schools.com/css/css_positioning.asp" and "https://www.w3schools.com/css/css_important.asp"
heigh: auto; //heigh of the object "https://www.w3schools.com/cssref/pr_dim_height.php"
max-width: 18vw !important; //max-width of the object "https://www.w3schools.com/cssref/pr_dim_max-width.php"
z-index: 10 !important; //setting the height of an object above other objects (layer) "https://www.w3schools.com/cssref/pr_pos_z-index.php" THIS PLACES THE ELEMENTS ABOVE ALL OTHERS!!!!!
}
- type: custom:webrtc-camera //HACS add on card
card_mod:
style: |
:host {
position: absolute !important;
heigh: auto;
max-width: 18vw !important;
top: 100px !important; //The position of the object from the top "https://www.w3schools.com/cssref/pr_pos_top.php"
left: 40px !important; //Position of the object from the left "https://www.w3schools.com/cssref/pr_pos_left.php"
z-index: 10 !important;
}
url: rtsp://192.168.1.42:8554/Jedilnica //the path to the camera or server that stream video from the camera
mode: webrtc
muted: true //sound muted
- type: custom:floorplan-card
panel: true
full_height: true
config:
defaults:
hover_action: hover-info
tap_action: more-info
image: /local/img/fp/fp.svg
stylesheet: /local/img/fp/fp.css
rules:
- element: background //Sunlight opacity function (special sensor described above)
entity: sensor.povprecje_zatemnitve_doma
tap_action: false
hover_action: false
state_action:
action: call-service
service: floorplan.style_set
service_data: |
> return `opacity: ${entity.state};`
svg, svg * {
cursor: auto !important; // read it: "https://www.w3schools.com/cssref/pr_class_cursor.php"
margin: 0px !important; // read it: "https://www.w3schools.com/css/css_margin.asp"
max-height: 100vh !important;
width: auto !important;
padding-top: 220px !important; //read it: "https://www.w3schools.com/css/css_padding.asp"
padding-bottom: 220px !important;
z-index: 0; //is the lowest level/layer in this layout
}
svg path { //setting for borders/line of rooms from SVG
fill: inherit; ; //read it: "https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill"
stroke: inherit; //read it: "https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Fills_and_Strokes"
stroke-width: 0px !important; //read it: "https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-width"
}
#background {
display: block !important; //read it: "https://www.w3schools.com/cssref/pr_class_display.php"
z-index: 1; //is top above svg, svg * for 1 layer
}
- entity: switch.sw_st
element: room.sw_st
- entity: switch.sw_vh
element: room.sw_vh
- entity: switch.sw_mi
element: room.sw_mi
- entity: switch.sw_gr
element: room.sw_gr
- entity: switch.sw_ho
element: room.sw_ho
- entity: switch.sw_sp
element: room.sw_sp
- entity: switch.sw_na
element: room.sw_na
- entity: switch.sw_di
element: room.sw_di
- entity: switch.sw_je
element: room.sw_je
- entity: switch.sw_sh
element: room.sw_sh
- entity: switch.sw_ku
element: room.sw_ku
- entity: switch.sw_ko
element: room.sw_ko
- entity: switch.sw_ko
element: room.sw_ko
state_action:
action: call-service
service: floorplan.class_set
service_data: switch-${entity.state}
tap_action:
action: call-service
service: homeassistant.toggle
#rooms image { //default for images of rooms that are illuminated (does not display)
display: none; //does not display any views
mix-blend-mode: lighten; //this setting is important for the overlap between images "https://www.w3schools.com/cssref/pr_mix-blend-mode.php"
animation: 0.75s fade-in linear forwards; //for a nice transition between picture exchanges "https://www.w3schools.com/css/css3_animations.asp"
}
@keyframes fade-in { //animation that makes the image go from opacity 0 (hidden) to opacity 1 (full view) "https://www.w3schools.com/css/css3_animations.asp"
from {
opacity: 0;
}
to {
opacity: 1;
}
}
#rooms image.switch-on { //what happens when the switch/light is turned on, or click on the room
display: block !important; //Shows a image
opacity: 1;; //opacity is not active
z-index: 5 !important; //is top above background for 4 layer
}
- entities:
- switch.sw_st
- switch.sw_vh
- switch.sw_mi
- switch.sw_gr
- switch.sw_ho
- switch.sw_sp
- switch.sw_na
- switch.sw_di
- switch.sw_je
- switch.sw_sh
- switch.sw_ku
- switch.sw_ko
tap_action:
action: call-service
service: homeassistant.toggle
state_action:
action: call-service
service: floorplan.class_set
service_data: switch-${entity.state}
#areas { //it shows nothing/hide
fill: none;
stroke: none;
}
#areas .switch-on {
stroke: red !important;
stroke-width: 15px !important;
stroke-opacity: 1;
z-index: 6; //is top above rooms image.switch-on for 1 layer
} |
Beta Was this translation helpful? Give feedback.
-
Other problems I encountered:#396 #397 #401 #403 #404 #406 #410 #412 #413 #414 #415 #416 #419 #420 #446 #448 #465 #466 it is not tied to the floor planhttps://github.com/Trzinka/Home-Assistant-SOLVED---Calculate-cost-for-individual-device-cost-kWh |
Beta Was this translation helpful? Give feedback.
-
That's all for now!! |
Beta Was this translation helpful? Give feedback.
-
My native language is slovenian!
Updated 05.10.2024 - Contains:
Here is the zip file of the files I currently use.
20241005.zip
fp.svg file is optimize
view using file 20240830.zip:
Current view:
On PC:
On tablet:
On phone:
Here is the zip file of the files I used which contains the other add-on cards in addition to the floor plan card. 20240216.zip
fp.svg file is optimize
view using file 20240216.zip:
My PNG files! In Inkscape I use the link to the files (they are not included in the SVG file)
The images of the view below will be changed during my upgrade, but the essence will remain! The zip file will contain the latest settings!!
Thanks to everyone from the group who helped me!!!!
Beta Was this translation helpful? Give feedback.
All reactions