Open PhillipRt opened 1 year ago
Relates to #16
I do like the looks of the card.
However, this strategy auto generates a dashboard without requiring any special configuration. The area card you propose does require configuration, because the sensors to read the states from, can't be known on beforehand.
Also, I think you've created your own custom sensor binary_sensor.area_wohnzimmer
to show some states.
This custom sensor doesn't exist for any other user.
Can you propose any solutions for above arguments?
FYI... Did you give release alpha.1 a try? That release allows you to override the strategy's default behavior of an area card, which give the requested result, e.g.:
areas:
kitchen:
name: Chef's Place
icon: mdi:countertop
icon_color: green
order: 1
secondary: >-
🌡️{{ states('sensor.hue_motion_sensor_1_temperature') }}° 💧{{
states('sensor.rm4_pro_humidity') }}% ☀️{{
states('sensor.hue_motion_sensor_1_illuminance') }}lx
This feature is great ! Sending my config in case that can help anyone.
Create custom_templates
folder in your configuration directory and create dashboard.jinja
in that folder. Copy and paste the following in dashboard.jinja
. More info
{% macro count_light(entity_filter, area, icon) %}{% set var_count = expand(area_entities(area)| select('match', entity_filter)) | selectattr('state', 'eq', 'on') | list | count %}{% if var_count != 0 %}{{ icon }}{{ var_count }}{% endif %}{% endmacro %}
{% macro count_entity(entity_filter, entity_class, area, icon) %}{% set var_count = expand(area_entities(area)| select('match', entity_filter)) | rejectattr('attributes.device_class', 'undefined') | selectattr('attributes.device_class', 'eq', entity_class) | selectattr('state', 'eq', 'on') | list | count %}{% if var_count != 0 %}{{ icon }}{{ var_count }}{% endif %}{% endmacro %}
{% macro show_info(temp,hum,lux,area) %}
❄️{{ states(temp) | int }}° 💧{{states(hum) }}% ☀️{{states(lux) }}lx
{{ count_entity('binary_sensor.', 'window', area, '🪟') }} {{ count_entity('binary_sensor.', 'door', area, '🚪') }} {{ count_light('light.', area, '☀️') }}
{% endmacro %}
Then in the mushroom strategy.
areas:
garage:
name: Garage
icon: mdi:garage
icon_color: green
order: 2
multiline_secondary: true
secondary: >-
{% from 'dashboard.jinja' import show_info %} {{ show_info(
'sensor.motion_garage_temperature',
'sensor.netatmo_living_room_inside_humidity',
'sensor.motion_garage_illuminance_lux', 'Garage') }}
Taken over by #75.
Magic areas already creates aggration for a lot of entities. Using this would cut down on having 15 sensors for temperature etc in one area. For example areas could provide a lot more information then just be navigation buttons
(only focus on rooms and Wohnzimmer)
Room icon color is based on the lights if the room. Occupancy as the blue icon. Alerts icon in red color icon, like gas leak or water leak (not currently active). Temperature across all sensors in my area (medium is calculated by magic areas),humidity and light level. It also adds the information configured in the magic areas making this bright, occupied, extended (has been occupied for a while). Click navigates to the area, click and hold turns on the light.
Here is the code:
This is just a rough start but might interesting to build from to not make the dashboard lacking basic infromation. I do like this at a glace dashboard with no drilling down.
I am not sure if this is a road you want to go down but I am happy to contribute if this is a feature worth accepting