Some improvements to floorplan code. Split lights and other things

This commit is contained in:
Thomas Lovén 2019-08-05 12:23:06 +02:00
parent 093527c3cd
commit 252ee7e485
2 changed files with 33 additions and 27 deletions

View File

@ -3,17 +3,35 @@ image: !file /local/images/Bottenvåning.png
elements: elements:
{% macro lamp(entity, x, y) -%} {% macro lamp(entity, x, y) -%}
{% if not no_light %}
- entity: {{entity}} - entity: {{entity}}
style: { left: {{x}}%, top: {{y}}% } style: { left: {{x}}%, top: {{y}}% }
type: state-icon type: state-icon
tap_action: { action: toggle } tap_action: { action: toggle }
{% endif %}
{%- endmacro %} {%- endmacro %}
{% macro dimlamp(entity, x, y) -%} {% macro dimlamp(entity, x, y) -%}
{% if not no_light %}
- entity: {{entity}} - entity: {{entity}}
style: { left: {{x}}%, top: {{y}}% } style: { left: {{x}}%, top: {{y}}% }
type: state-icon type: state-icon
tap_action: { action: toggle } tap_action: { action: toggle }
hold_action: { action: more-info } hold_action: { action: more-info }
{% endif %}
{%- endmacro %}
{% macro icon(entity, x, y) -%}
{% if not no_other %}
- entity: {{entity}}
style: { left: {{x}}%, top: {{y}}% }
type: state-icon
{% endif %}
{%- endmacro %}
{% macro badge(entity, x, y) -%}
{% if not no_other %}
- entity: {{entity}}
style: { left: {{x}}%, top: {{y}}% }
type: state-badge
{% endif %}
{%- endmacro %} {%- endmacro %}
# Kontoret # Kontoret
@ -27,46 +45,35 @@ elements:
# Stora hallen # Stora hallen
{{ dimlamp('light.stora_hallen', 43, 70) }} {{ dimlamp('light.stora_hallen', 43, 70) }}
{{ lamp('light.trappbelysning', 49, 61) }} {{ lamp('light.trappbelysning', 49, 61) }}
- type: state-icon {{ icon('binary_sensor.hall_ytterdorr', 43, 87) }}
entity: binary_sensor.framdorr {{ badge('sensor.temperatursensor_atelje_1_0', 55, 54) }}
style: { left: 43%, top: 87% }
- type: state-badge
entity: sensor.temperatursensor_atelje_1_0
style: { left: 55%, top: 54% }
# Köket # Köket
{{ dimlamp('light.taklampa_koket', 32, 76) }} {{ dimlamp('light.taklampa_koket', 32, 76) }}
{{ lamp('light.koksfonster', 22, 87) }} {{ lamp('light.koksfonster', 22, 87) }}
{{ lamp('light.koksfonster', 28, 87) }} {{ lamp('light.koksfonster', 28, 87) }}
- type: state-icon {{ icon('switch.kaffebryggare', 16, 84) }}
entity: switch.kaffebryggare
tap_action: { action: toggle }
style: { left: 16%, top: 84% }
# Vardagsrummet # Vardagsrummet
{{ dimlamp('light.vardagsrum', 60, 30) }} {{ dimlamp('light.vardagsrum', 60, 30) }}
{{ dimlamp('light.takflakt', 43, 30) }} {{ dimlamp('light.takflakt', 43, 30) }}
{{ lamp('light.bokhylla', 55, 45) }} {{ lamp('light.bokhylla', 55, 45) }}
{{ lamp('light.deko_vardagsrum', 49, 15) }} {{ lamp('light.deko_vardagsrum', 49, 15) }}
- type: state-badge {{ badge('sensor.vardagsrum_0', 40, 36) }}
entity: sensor.vardagsrum_0 {{ icon('binary_sensor.vardagsrum_ytterdorr', 38, 12) }}
style: { left: 40%, top: 36% }
# Sovrum # Sovrum
{{ dimlamp('light.sovrum', 81, 30) }} {{ dimlamp('light.sovrum', 81, 30) }}
{{ icon('binary_sensor.sovrum_ytterdorr', 78, 12) }}
# Tvättstuga # Tvättstuga
{{ lamp('light.skotbord', 21, 15) }} {{ lamp('light.skotbord', 21, 15) }}
- type: state-badge {{ icon('binary_sensor.tvattstuga_ytterdorr', 13, 24) }}
entity: sensor.badrum_temp
style: { left: 27%, top: 35% } # # Badrum
- type: state-badge {{ badge('sensor.badrum_temp', 27, 30) }}
entity: sensor.badrum_humidity {{ badge('sensor.badrum_humidity', 27, 40) }}
style: { left: 27%, top: 40% } {{ icon('switch.ventilation', 27, 20) }}
- type: state-icon
entity: switch.ventilation
tap_action: { action: toggle }
style: { left: 30%, top: 30% }
# Utomhus # Utomhus
{{ dimlamp('light.baksida', 35, 5) }} {{ dimlamp('light.baksida', 35, 5) }}
@ -81,6 +88,4 @@ elements:
{{ dimlamp('light.fasad_6', 97, 70) }} {{ dimlamp('light.fasad_6', 97, 70) }}
{{ dimlamp('light.fasad_7', 92, 30) }} {{ dimlamp('light.fasad_7', 92, 30) }}
{{ dimlamp('light.fasad_8', 97, 30) }} {{ dimlamp('light.fasad_8', 97, 30) }}
- type: state-badge {{ badge('sensor.elmatare_0', 5, 55) }}
entity: sensor.elmatare_0
style: { left: 5%, top: 55% }

View File

@ -1,7 +1,8 @@
title: Diverse title: Diverse
icon: mdi:home-assistant icon: mdi:home-assistant
cards: cards:
- !include floorplan.yaml - !include floorplan.yaml {"no_other":"true"}
- !include floorplan.yaml {"no_light":"true"}
- !include coffee_card.yaml - !include coffee_card.yaml
- !include temperatures_card.yaml - !include temperatures_card.yaml
- !include power_card.yaml - !include power_card.yaml