]> git.giorgioravera.it Git - homeassistant.git/commitdiff
Added automation selector
authorGiorgio Ravera <giorgio.ravera@gmail.com>
Tue, 11 Jan 2022 21:26:02 +0000 (22:26 +0100)
committerGiorgio Ravera <giorgio.ravera@gmail.com>
Mon, 21 Feb 2022 20:53:25 +0000 (21:53 +0100)
.storage/lovelace.lovelace_settings
input_select/automation_selector.yaml [new file with mode: 0644]

index 61800d526453c0eab5dadbb56216ee7933458687..5e12413a791203ddc30de7e9b4893dd85f1c4aa5 100644 (file)
                                 {
                                     "entities": [
                                         {
-                                            "entity": "automation.startup_restart_on_error"
+                                            "entity": "automation.home_assistant_startup_restart_on_error"
                                         },
                                         {
                                             "entity": "automation.modalita_vacanza_gestione_tapparelle"
                                         },
                                         {
-                                            "entity": "automation.startup_google_sync"
+                                            "entity": "automation.home_assistant_startup_google_sync"
                                         },
                                         {
                                             "entity": "automation.risveglio_giorgio"
                             "hours_to_show": 6
                         }
                     ]
+                },
+                {
+                    "title": "Automazioni",
+                    "path": "automations",
+                    "icon": "mdi:cogs",
+                    "type": "panel",
+                    "badges": [],
+                    "cards": [
+                        {
+                            "type": "custom:layout-card",
+                            "layout_type": "custom:grid-layout",
+                            "layout": {
+                                "grid-template-columns": "100px auto"
+                            },
+                            "cards": [
+                                {
+                                    "type": "vertical-stack",
+                                    "cards": [
+                                        {
+                                            "type": "custom:button-card",
+                                            "template": "generic_themed_input_select",
+                                            "entity": "input_select.automation_selector",
+                                            "variables": {
+                                                "value_select": "Allarmi"
+                                            },
+                                            "icon": "mdi:alarm"
+                                        },
+                                        {
+                                            "type": "custom:button-card",
+                                            "template": "generic_themed_input_select",
+                                            "entity": "input_select.automation_selector",
+                                            "variables": {
+                                                "value_select": "Guardia"
+                                            },
+                                            "icon": "mdi:shield-home"
+                                        },
+                                        {
+                                            "type": "custom:button-card",
+                                            "template": "generic_themed_input_select",
+                                            "entity": "input_select.automation_selector",
+                                            "variables": {
+                                                "value_select": "Home Assistant"
+                                            },
+                                            "icon": "mdi:home-assistant"
+                                        },
+                                        {
+                                            "type": "custom:button-card",
+                                            "template": "generic_themed_input_select",
+                                            "entity": "input_select.automation_selector",
+                                            "variables": {
+                                                "value_select": "Luci"
+                                            },
+                                            "icon": "mdi:lightbulb"
+                                        },
+                                        {
+                                            "type": "custom:button-card",
+                                            "template": "generic_themed_input_select",
+                                            "entity": "input_select.automation_selector",
+                                            "variables": {
+                                                "value_select": "Termosifoni"
+                                            },
+                                            "icon": "mdi:radiator"
+                                        },
+                                        {
+                                            "type": "custom:button-card",
+                                            "template": "generic_themed_input_select",
+                                            "entity": "input_select.automation_selector",
+                                            "variables": {
+                                                "value_select": "Shelly"
+                                            },
+                                            "icon": "mdi:alpha-s-box"
+                                        },
+                                        {
+                                            "type": "custom:button-card",
+                                            "template": "generic_themed_input_select",
+                                            "entity": "input_select.automation_selector",
+                                            "variables": {
+                                                "value_select": "Vacanza"
+                                            },
+                                            "icon": "mdi:airplane"
+                                        },
+                                        {
+                                            "type": "custom:button-card",
+                                            "template": "generic_themed_input_select",
+                                            "entity": "input_select.automation_selector",
+                                            "variables": {
+                                                "value_select": "Zigbee2MQTT"
+                                            },
+                                            "icon": "mdi:zigbee"
+                                        }
+                                    ]
+                                },
+                                {
+                                    "type": "custom:auto-entities",
+                                    "show_icon": false,
+                                    "show_header_toggle": true,
+                                    "card": {
+                                        "type": "entities",
+                                        "title": "Automazioni",
+                                        "state_color": true
+                                    },
+                                    "filter": {
+                                        "template": "[ {% for auto in states.automation %}\n    {% if states['input_select.automation_selector'].state.upper().replace(\" \",\"_\") in auto.entity_id.upper() %}\n      {'entity': '{{ auto.entity_id }}', 'secondary_info': 'last-triggered'},\n    {% endif %}\n  {% endfor %} ]\n"
+                                    },
+                                    "sort": {
+                                        "method": "name",
+                                        "reverse": false
+                                    }
+                                }
+                            ]
+                        }
+                    ]
+                }
+            ],
+            "button_card_templates": {
+                "generic_themed_input_select": {
+                    "color_type": "icon",
+                    "variables": {
+                        "value_select": ""
+                    },
+                    "show_name": true,
+                    "name": "[[[ return variables.value_select ]]]\n",
+                    "styles": {
+                        "card": [
+                            {
+                                "font-size": "11pt"
+                            },
+                            {
+                                "color": "var(--primary-text-color)"
+                            },
+                            {
+                                "background": "linear-gradient(var(--secondary-background-color), var(--primary-background-color))"
+                            },
+                            {
+                                "border": "rgba(115, 115, 115, 0.75) 0.5px solid"
+                            },
+                            {
+                                "border-radius": "0.8vw"
+                            },
+                            {
+                                "box-shadow": "none"
+                            },
+                            {
+                                "transition": "0.5s"
+                            },
+                            {
+                                "height": "95px"
+                            },
+                            {
+                                "border-color": "[[[\n  if (variables.value_select && entity.state==variables.value_select)\n    return 'DeepSkyBlue'\n]]]                    \n"
+                            }
+                        ],
+                        "name": [
+                            {
+                                "font-size": "11px"
+                            }
+                        ],
+                        "icon": [
+                            {
+                                "width": "30px"
+                            },
+                            {
+                                "color": "[[[\n  if (variables.value_select && entity.state==variables.value_select)\n    return 'var(--switch-checked-button-color)'\n  else\n    return 'lightgray'\n]]]            \n"
+                            }
+                        ]
+                    },
+                    "hold_action": {
+                        "action": "more-info"
+                    },
+                    "tap_action": {
+                        "action": "call-service",
+                        "service": "input_select.select_option",
+                        "service_data": {
+                            "entity_id": "[[[ return entity.entity_id ]]]",
+                            "option": "[[[ return variables.value_select ]]]"
+                        }
+                    }
                 }
-            ]
+            }
         }
     }
 }
\ No newline at end of file
diff --git a/input_select/automation_selector.yaml b/input_select/automation_selector.yaml
new file mode 100644 (file)
index 0000000..2b5ea19
--- /dev/null
@@ -0,0 +1,17 @@
+######################################################################
+# Input Select: Automation Selector for lovelace panel
+######################################################################
+
+automation_selector:
+  name: Selettore Automazioni
+  options:
+    - Allarmi
+    - Luci
+    - Guardia
+    - Home Assistant
+    - Termosifoni
+    - Shelly
+    - Vacanza
+    - Zigbee2MQTT
+  initial: Luci
+  icon: mdi:cogs