I really love CH and the things it does! I’m struggling with two issues though:
-
Is it possible to use
media_query
for the sameuser_agent
in order to have two different configs depending on whether I’m holding my tablet in portrait or landscape mode (my tablet has a 1920x1200 resolution)? -
I can’t seem to find a way to use two user_agents for one config. Is
user_agent: Windows, X705L
not enough?
Here is my current setup
custom_header:
active_tab_color: var(--state-icon-active-color)
background: var(--app-header-background-color)
editor_warnings: false
elements_color: var(--app-header-text-color)
exceptions:
- conditions:
user_agent: Windows
config:
button_text:
options: >-
{{ hours24 }}:{{ minutesLZ }} <div style='display:inline-block;
height:24px; width:24px; vertical-align:bottom;'><ha-icon
icon='mdi:weather-{% if is_state("weather.gismeteo", "partlycloudy")
-%}partly-cloudy{%- else -%}{{ states('weather.gismeteo')}}{%- endif
%}'></ha-icon></div> {{ states('sensor.temperature_38') }}°
default_tab: FLOORPLAN
header_text: >-
<style>ha-icon {display:inline-block; float:left} #flipper
{color:#999;} #flip {height:24px;overflow:hidden;} #flip > div > div
{color:#99h;height:24px;margin-bottom:24px;display:inline-block;}
#flip div:first-child {animation: show 10s linear infinite;}
@keyframes show { 0% {margin-top:-144px;} 5% {margin-top:-96px;} 33%
{margin-top:-96px;} 38% {margin-top:-48px;} 66% {margin-top:-48px;}
76% {margin-top:0px;} 100% {margin-top:0px;}} #flipper p
{position:fixed;color:#999; } </style> <div><ha-icon icon='{% if
is_state("switch.sonoff_1000b19f94_2", "on") %}mdi:water{% else
%}mdi:water-off{% endif %}' style='color:{% if
is_state("switch.sonoff_1000b19f94_2", "on") %}green{% else %}#800{%
endif %}'</ha-icon></div><div><ha-icon icon='{% if
is_state("switch.sonoff_1000b19f94_3", "on") %}mdi:water{% else
%}mdi:water-off{% endif %}' style='color:{% if
is_state("switch.sonoff_1000b19f94_3", "on") %}green{% else %}#800{%
endif %}'</ha-icon></div><div><ha-icon icon='{% if
is_state("switch.sonoff_1000b19f94_4", "on") %}mdi:water{% else
%}mdi:water-off{% endif %}' style='color:{% if
is_state("switch.sonoff_1000b19f94_4", "on") %}green{% else %}#800{%
endif %}'</ha-icon></div><div id=flipper><div id=flip><div> <div>
{{states('counter.count_espresso')}} coffees
today</div></div><div><div> Last 48h rain:
{{float(states('sensor.total_48h_precipitation'))}}
mm</div></div><div><div> Sonoff 2 was ON for {{
float(states('sensor.sonoff_2_on')) * 60 }} minutes
</div></div><div><div> {{states('counter.count_espresso')}} coffees
today</div></div><div><div>
hide_tabs: '1,2'
- conditions:
user_agent: VOG-L29
config:
button_text:
options: >-
<div style='display:inline-block; height:24px; width:24px;
vertical-align:bottom;'><ha-icon icon='mdi:weather-{% if
is_state("weather.gismeteo", "partlycloudy") -%}partly-cloudy{%-
else -%}{{ states('weather.gismeteo')}}{%- endif
%}'></ha-icon></div> {{ states('sensor.temperature_38') }}°
default_tab: FLOOR1
header_text: >-
<div> <div style='display:inline-block'> <ha-icon icon='{% if
is_state("switch.sonoff_1000b19f94_2", "on") %}mdi:water{% else
%}mdi:water-off{% endif %}' style='color:{% if
is_state("switch.sonoff_1000b19f94_2", "on") %}green{% else %}#800{%
endif %}'</ha-icon> </div> <div style='display:inline-block'> <ha-icon
icon='{% if is_state("switch.sonoff_1000b19f94_3", "on") %}mdi:water{%
else %}mdi:water-off{% endif %}' style='color:{% if
is_state("switch.sonoff_1000b19f94_3", "on") %}green{% else %}#800{%
endif %}'</ha-icon> </div> <div style='display:inline-block'> <ha-icon
icon='{% if is_state("switch.sonoff_1000b19f94_4", "on") %}mdi:water{%
else %}mdi:water-off{% endif %}' style='color:{% if
is_state("switch.sonoff_1000b19f94_4", "on") %}green{% else %}#800{%
endif %}'</ha-icon> </div>
hide_tabs: '0,6'
- conditions:
user_agent: X705L
config:
button_text:
options: >-
{{ hours24 }}:{{ minutesLZ }} <div style='display:inline-block;
height:24px; width:24px; vertical-align:bottom;'><ha-icon
icon='mdi:weather-{% if is_state("weather.gismeteo", "partlycloudy")
-%}partly-cloudy{%- else -%}{{ states('weather.gismeteo')}}{%- endif
%}'></ha-icon></div> {{ states('sensor.temperature_38')
}}°
default_tab: FLOORPLAN
header_text: >-
<style>ha-icon {display:inline-block; float:left} #flipper
{color:#999;} #flip {height:24px;overflow:hidden;} #flip > div > div
{color:#99h;height:24px;margin-bottom:24px;display:inline-block;}
#flip div:first-child {animation: show 10s linear infinite;}
@keyframes show { 0% {margin-top:-144px;} 5% {margin-top:-96px;} 33%
{margin-top:-96px;} 38% {margin-top:-48px;} 66% {margin-top:-48px;}
76% {margin-top:0px;} 100% {margin-top:0px;}} #flipper p
{position:fixed;color:#999; } </style> <div><ha-icon icon='{% if
is_state("switch.sonoff_1000b19f94_2", "on") %}mdi:water{% else
%}mdi:water-off{% endif %}' style='color:{% if
is_state("switch.sonoff_1000b19f94_2", "on") %}green{% else %}#800{%
endif %}'</ha-icon></div><div><ha-icon icon='{% if
is_state("switch.sonoff_1000b19f94_3", "on") %}mdi:water{% else
%}mdi:water-off{% endif %}' style='color:{% if
is_state("switch.sonoff_1000b19f94_3", "on") %}green{% else %}#800{%
endif %}'</ha-icon></div><div><ha-icon icon='{% if
is_state("switch.sonoff_1000b19f94_4", "on") %}mdi:water{% else
%}mdi:water-off{% endif %}' style='color:{% if
is_state("switch.sonoff_1000b19f94_4", "on") %}green{% else %}#800{%
endif %}'</ha-icon></div><div id=flipper><div id=flip><div> <div>
{{states('counter.count_espresso')}} coffees
today</div></div><div><div> Last 48h rain:
{{float(states('sensor.total_48h_precipitation'))}}
mm</div></div><div><div> Sonoff 2 was ON for {{
float(states('sensor.sonoff_2_on')) * 60 }} minutes
</div></div><div><div> {{states('counter.count_espresso')}} coffees
today</div></div><div><div>
hide_tabs: '1,2'
footer_mode: true
menu_dropdown: true
shadow: false
split_mode: true
tab_indicator_color: var(--state-icon-active-color)