From 5109e5686e3417347bfaa2f15bd2f37c49d3912f Mon Sep 17 00:00:00 2001 From: Giorgio Ravera Date: Thu, 13 Jun 2019 15:55:44 +0200 Subject: [PATCH] Changed from binary input to switch Car Unlock --- automation/car.yaml | 72 ---------------------------- components/google_assistant/car.yaml | 2 +- input_boolean/car.yaml | 8 ---- switch/car.yaml | 22 +++++++++ 4 files changed, 23 insertions(+), 81 deletions(-) delete mode 100644 automation/car.yaml delete mode 100644 input_boolean/car.yaml create mode 100644 switch/car.yaml diff --git a/automation/car.yaml b/automation/car.yaml deleted file mode 100644 index 19bf9083..00000000 --- a/automation/car.yaml +++ /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 - diff --git a/components/google_assistant/car.yaml b/components/google_assistant/car.yaml index 014f51bf..9c8522d1 100644 --- a/components/google_assistant/car.yaml +++ b/components/google_assistant/car.yaml @@ -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 index 95ca552b..00000000 --- a/input_boolean/car.yaml +++ /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 index 00000000..953aa350 --- /dev/null +++ b/switch/car.yaml @@ -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 %} -- 2.47.3