From aedddd4475dcd3c10f3e12e11e86e373236cf8ba Mon Sep 17 00:00:00 2001 From: Ryan Horiguchi Date: Thu, 12 Dec 2024 01:04:16 +0100 Subject: [PATCH] Remove myStrom buttons from HS --- .../headless/server/home-assistant/README.md | 8 -- .../server/home-assistant/discord.nix | 5 - .../server/home-assistant/lovelace.nix | 6 - .../server/home-assistant/mystrom.nix | 116 ------------------ secrets.nix | Bin 4818 -> 4725 bytes 5 files changed, 135 deletions(-) delete mode 100644 configuration/devices/headless/server/home-assistant/mystrom.nix diff --git a/configuration/devices/headless/server/home-assistant/README.md b/configuration/devices/headless/server/home-assistant/README.md index e589171c..93856587 100644 --- a/configuration/devices/headless/server/home-assistant/README.md +++ b/configuration/devices/headless/server/home-assistant/README.md @@ -30,14 +30,6 @@ - Delete all areas - `Settings` -> `Areas & zones` -> `Areas` -## Configure myStrom buttons - -- `curl -d "single=post://XXLPitu-Server.local:8123/api/webhook/mystrom_button_blue" "http://myStrom-Button-E9DACB.local/api/v1/device/F4CFA2E9DACB"` -- `curl -d "single=post://XXLPitu-Server.local:8123/api/webhook/mystrom_button_gray" "http://myStrom-Button-E9DA8E.local/api/v1/device/F4CFA2E9DA8E"` -- `curl -d "single=post://XXLPitu-Server.local:8123/api/webhook/mystrom_button_orange" "http://myStrom-Button-E9DAD9.local/api/v1/device/F4CFA2E9DAD9"` -- `curl -d "single=post://XXLPitu-Server.local:8123/api/webhook/mystrom_button_purple" "http://myStrom-Button-E9D761.local/api/v1/device/F4CFA2E9D761"` -- `curl -d "single=post://XXLPitu-Server.local:8123/api/webhook/mystrom_button_white" "http://myStrom-Button-F8CB7A.local/api/v1/device/CC50E3F8CB7A"` - ## Shelly Configure: diff --git a/configuration/devices/headless/server/home-assistant/discord.nix b/configuration/devices/headless/server/home-assistant/discord.nix index ffd079fd..95c52842 100644 --- a/configuration/devices/headless/server/home-assistant/discord.nix +++ b/configuration/devices/headless/server/home-assistant/discord.nix @@ -42,11 +42,6 @@ "sensor.entrance_dimmer_switch_battery" "sensor.entrance_h_t_gen3_battery" "sensor.living_room_dimmer_switch_battery" - "sensor.mystrom_button_blue_battery" - "sensor.mystrom_button_gray_battery" - "sensor.mystrom_button_orange_battery" - "sensor.mystrom_button_purple_battery" - "sensor.mystrom_button_white_battery" "sensor.reduit_parasoll_battery" "sensor.valve_blue_battery" "sensor.valve_green_battery" diff --git a/configuration/devices/headless/server/home-assistant/lovelace.nix b/configuration/devices/headless/server/home-assistant/lovelace.nix index 434d75f5..4f6f64a6 100644 --- a/configuration/devices/headless/server/home-assistant/lovelace.nix +++ b/configuration/devices/headless/server/home-assistant/lovelace.nix @@ -396,12 +396,6 @@ in { title = "Battery"; bulk_rename = [ - # myStrom buttons - { from = " battery"; } - { - from = "myStrom button "; - } - # Netatmo valves { from = " Battery"; } { diff --git a/configuration/devices/headless/server/home-assistant/mystrom.nix b/configuration/devices/headless/server/home-assistant/mystrom.nix deleted file mode 100644 index 6dabd61c..00000000 --- a/configuration/devices/headless/server/home-assistant/mystrom.nix +++ /dev/null @@ -1,116 +0,0 @@ -{ pkgs, secrets, ... }: -let - apiUrl = "https://mystrom.ch/api"; - - getVoltageScript = id: - pkgs.writers.writePython3 "mystrom_get_voltage_${id}.py" { libraries = [ pkgs.python3Packages.requests ]; } '' - import json - - import requests - - response = requests.post('${apiUrl}/auth', params={ - 'email': '${secrets.mystrom.email}', - 'password': '${secrets.mystrom.password}' - }) - - response = requests.get( - url='${apiUrl}/devices', - headers={'Auth-Token': json.loads(response.content)['authToken']} - ) - - match = next(filter( - lambda device: device['id'] == '${id}', - json.loads(response.content)['devices'] - )) - - print(match['voltage']) - ''; - - createButtonBatterySensors = map (button: { - sensor = { - name = button.name; - scan_interval = 60 * 60; - command = getVoltageScript button.id; - value_template = let - maxVoltage = "4300"; - minVoltage = "3700"; - in "{{ (((value | float) * 1000 - ${minVoltage}) * 100 / (${maxVoltage} - ${minVoltage})) | round }}"; - unit_of_measurement = "%"; - device_class = "battery"; - state_class = "measurement"; - }; - }); -in { - services.home-assistant.config = { - command_line = createButtonBatterySensors [ - { - name = "myStrom button blue battery"; - id = "F4CFA2E9DACB"; - } - { - name = "myStrom button gray battery"; - id = "F4CFA2E9DA8E"; - } - { - name = "myStrom button orange battery"; - id = "F4CFA2E9DAD9"; - } - { - name = "myStrom button purple battery"; - id = "F4CFA2E9D761"; - } - { - name = "myStrom button white battery"; - id = "CC50E3F8CB7A"; - } - ]; - - automation = [ - { - alias = "Placeholder myStrom orange"; - trigger = [{ - platform = "webhook"; - webhook_id = "mystrom_button_orange"; - local_only = true; - }]; - action = [ ]; - } - { - alias = "Placeholder myStrom purple"; - trigger = [{ - platform = "webhook"; - webhook_id = "mystrom_button_purple"; - local_only = true; - }]; - action = [ ]; - } - { - alias = "Placeholder myStrom blue"; - trigger = [{ - platform = "webhook"; - webhook_id = "mystrom_button_blue"; - local_only = true; - }]; - action = [ ]; - } - { - alias = "Placeholder myStrom gray"; - trigger = [{ - platform = "webhook"; - webhook_id = "mystrom_button_gray"; - local_only = true; - }]; - action = [ ]; - } - { - alias = "Placeholder myStrom white"; - trigger = [{ - platform = "webhook"; - webhook_id = "mystrom_button_white"; - local_only = true; - }]; - action = [ ]; - } - ]; - }; -} diff --git a/secrets.nix b/secrets.nix index 752c525ad3c5b514dc8da8a02d12e47ef553d596..ed1506edfc1d7d9b5fb36ecf93147144e1862ef7 100755 GIT binary patch literal 4725 zcmV-*5{m5rM@dveQdv+`0FI$OC5!5>E%yd(5Pi~ROiFs585e)Q(eXpB;1nKFl>8+4 z$x+urQ9sUMr##hx*$mFZUcb#s`1)g`*ZqII+*cMN$)r8D-~1RdFaP;4 zM-d1`w*xd1 zz>~+$kM)XI!wJsw)_yc)N$Ww*La5r{tq|VDwDAL987Bt(HVN0)U54kI!Qnh#XmG43 zKGV5^z+HCK(yTJ`N%L^O)=rIjTq?D?~EqY&*as&R_bbzOa zHCAD#XL4c(Rr4$co;z?3?jNQ#niit!9eRo>QPw&XCk-;iZRCY=9ipyFGQUOu}p#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