]> git.giorgioravera.it Git - homeassistant.git/commitdiff
Changed from binary input to switch Car Unlock
authorGiorgio Ravera <giorgio.ravera@gmail.com>
Thu, 13 Jun 2019 13:55:44 +0000 (15:55 +0200)
committerGiorgio Ravera <giorgio.ravera@gmail.com>
Thu, 13 Jun 2019 13:55:44 +0000 (15:55 +0200)
automation/car.yaml [deleted file]
components/google_assistant/car.yaml
input_boolean/car.yaml [deleted file]
switch/car.yaml [new file with mode: 0644]

diff --git a/automation/car.yaml b/automation/car.yaml
deleted file mode 100644 (file)
index 19bf908..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-######################################################################
-# Car: FF590MR lock/unlock Button Management
-######################################################################
-
-- alias: "FF590MR Pulsante Blocca Vettura"
-  initial_state: 'on'
-
-  trigger:
-    - platform: state
-      entity_id: lock.ff590mr_lock
-      to: 'locked'
-    - platform: homeassistant
-      event: start
-
-  condition:
-    - condition: state
-      entity_id: lock.ff590mr_lock
-      state: 'locked'
-
-  action:
-    - service: input_boolean.turn_on
-      data_template:
-        entity_id: input_boolean.ff590mr_lock
-
-- alias: "FF590MR Pulsante Sblocca Vettura"
-  initial_state: 'on'
-
-  trigger:
-    - platform: state
-      entity_id: lock.ff590mr_lock
-      to: 'unlocked'
-    - platform: homeassistant
-      event: start
-
-  condition:
-    - condition: state
-      entity_id: lock.ff590mr_lock
-      state: 'unlocked'
-
-  action:
-    - service: input_boolean.turn_off
-      data_template:
-        entity_id: input_boolean.ff590mr_lock
-
-######################################################################
-# Car: FF590MR lock/unlock
-######################################################################
-
-- alias: "FF590MR Blocca Vettura"
-  initial_state: 'on'
-
-  trigger:
-    - platform: state
-      entity_id: input_boolean.ff590mr_lock
-      to: 'on'
-
-  action:
-    - service: lock.lock
-      entity_id: lock.ff590mr_lock
-- alias: "FF590MR Sblocca Vettura"
-  initial_state: 'on'
-
-  trigger:
-    - platform: state
-      entity_id: input_boolean.ff590mr_lock
-      to: 'off'
-
-  action:
-    - service: lock.unlock
-      entity_id: lock.ff590mr_lock
index 014f51bf2e45184d1571cf482fbb336bb9774077..9c8522d1941b8fdcd6480e9ce29e992925f9bf81 100644 (file)
@@ -2,7 +2,7 @@
 # Google Assistant: Car
 ######################################################################
 
-input_boolean.ff590mr_lock:
+switch.ff590mr_lock:
   name: Blocco Auto
   room: Generale
   expose: true
diff --git a/input_boolean/car.yaml b/input_boolean/car.yaml
deleted file mode 100644 (file)
index 95ca552..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-######################################################################
-# Inputs: Lock
-######################################################################
-
-ff590mr_lock:
-  name: Blocco Auto
-  icon: mdi:lock
-
diff --git a/switch/car.yaml b/switch/car.yaml
new file mode 100644 (file)
index 0000000..953aa35
--- /dev/null
@@ -0,0 +1,22 @@
+######################################################################
+# Switch: Lock
+######################################################################
+
+- platform: template
+  switches:
+    ff590mr_lock:
+      friendly_name: Blocco Auto
+      entity_id: lock.ff590mr_lock
+      value_template: "{{ is_state('lock.ff590mr_lock', 'locked') }}"
+      turn_on:
+        - service: lock.lock
+          entity_id: lock.ff590mr_lock
+      turn_off:
+      - service: lock.unlock
+        entity_id: lock.ff590mr_lock      
+      icon_template: >-
+        {% if is_state('lock.ff590mr_lock', 'locked') %}
+          mdi:lock
+        {% else %}
+          mdi:lock-open
+        {% endif %}