From aca80a4b8f84cc79b359cb94ff69d5afee1133f8 Mon Sep 17 00:00:00 2001 From: Giorgio Ravera Date: Sat, 13 Jun 2020 12:00:46 +0200 Subject: [PATCH] Replaced Shelly1 for living room with ShellyDimmer --- light/sala.yaml | 21 +++++++++++++++++---- scripts/shelly.yaml | 4 ++-- shell_scripts/shelly_upgrade.sh | 6 +++--- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/light/sala.yaml b/light/sala.yaml index aed62f5b..44c057c9 100644 --- a/light/sala.yaml +++ b/light/sala.yaml @@ -3,11 +3,24 @@ ###################################################################### - platform: mqtt + schema: template name: Luce Sala - command_topic: "shellies/shelly1-C426F9/relay/0/command" - state_topic: "shellies/shelly1-C426F9/relay/0" - payload_on: "on" - payload_off: "off" + state_topic: "shellies/shellydimmer-D3EA58/light/0/status" + state_template: > + {% if value_json.ison %} + on + {% else %} + off + {% endif %} + command_topic: "shellies/shellydimmer-D3EA58/light/0/set" + command_on_template: > + {"turn": "on" + {% if brightness is defined %} + , "brightness": {{ brightness | float | multiply(0.3922) | round(0) }} + {% endif %} + } + command_off_template: '{ "turn" : "off" }' + brightness_template: "{{ value_json.brightness | float | multiply(2.55) | round(0) }}" retain: false qos: 0 optimistic: false diff --git a/scripts/shelly.yaml b/scripts/shelly.yaml index 3eceb6a4..a976e428 100644 --- a/scripts/shelly.yaml +++ b/scripts/shelly.yaml @@ -42,10 +42,10 @@ shelly_upgrade: topic: 'shellies/shelly1-93B27D/command' payload: 'update_fw' - # Shelly 1 Luce Sala + # Shelly Dimmer Luce Sala - service: mqtt.publish data: - topic: 'shellies/shelly1-C426F9/command' + topic: 'shellies/shellydimmer-D3EA58/command' payload: 'update_fw' # Shelly 2.5 Luci Bagno diff --git a/shell_scripts/shelly_upgrade.sh b/shell_scripts/shelly_upgrade.sh index 7b0b5cb9..3a1c1d6b 100755 --- a/shell_scripts/shelly_upgrade.sh +++ b/shell_scripts/shelly_upgrade.sh @@ -11,11 +11,11 @@ SHELLY_ID=( shellyswitch-559C49 shelly1-24D1EE shelly1-93B27D - shelly1-C426F9 + shellydimmer-D3EA58 shellyswitch25-7457D8 shelly1-59E18C - shellydimmer-D46CF2 - shelly1-C423C8 + shellydimmer-D46CF2 + shelly1-C423C8 shellybulb-BC8610 shellyem-B9E1A0 shellyplug-s-7A31CB -- 2.47.3