From 92a52de232fffb769fe77b50835d405f5c4e7264 Mon Sep 17 00:00:00 2001 From: David Rapan Date: Thu, 15 Aug 2024 02:39:45 +0200 Subject: [PATCH] refactor: Binary sensors where suitable --- .../inverter_definitions/deye_sg01hp3.yaml | 37 +++---------------- .../inverter_definitions/deye_sg04lp3.yaml | 37 +++---------------- 2 files changed, 12 insertions(+), 62 deletions(-) diff --git a/custom_components/solarman/inverter_definitions/deye_sg01hp3.yaml b/custom_components/solarman/inverter_definitions/deye_sg01hp3.yaml index 354a009..3913e01 100644 --- a/custom_components/solarman/inverter_definitions/deye_sg01hp3.yaml +++ b/custom_components/solarman/inverter_definitions/deye_sg01hp3.yaml @@ -570,33 +570,15 @@ parameters: min: 0 max: 100 - - name: "SmartLoad State" + - name: "SmartLoad" update_interval: 30 - class: "enum" + class: "binary_sensor" state_class: "" uom: "" - scale: 1 rule: 1 registers: [0x0228] + bitmask: 0x8 icon: "mdi:lightning-bolt-circle" - options: ["Off", "On"] - lookup: - - key: 0x0001 - value: "Off" - - key: 0x0004 - value: "Off" - - key: 0x0005 - value: "Off" - - key: 0x0008 - value: "On" - - key: 0x0009 - value: "On" - - key: 0x000C - value: "Off" - - key: 0x000D - value: "On" - - key: "default" - value: "On" - group: Work Mode items: @@ -1512,22 +1494,15 @@ parameters: - group: State items: - # Device - Power state On/Off - - name: "Device Power State" + # Device - Power On/Off + - name: "Device Power" update_interval: 30 - class: "enum" + class: "binary_sensor" state_class: "" uom: "" - scale: 1 rule: 1 registers: [0x0227] icon: "mdi:lightning-bolt-circle" - options: ["Off", "On"] - lookup: - - key: 0x0000 - value: "Off" - - key: 0x0001 - value: "On" # Device - AC Relay state - name: "Device Relay State" diff --git a/custom_components/solarman/inverter_definitions/deye_sg04lp3.yaml b/custom_components/solarman/inverter_definitions/deye_sg04lp3.yaml index b75f061..1f2ce02 100644 --- a/custom_components/solarman/inverter_definitions/deye_sg04lp3.yaml +++ b/custom_components/solarman/inverter_definitions/deye_sg04lp3.yaml @@ -576,33 +576,15 @@ parameters: min: 0 max: 100 - - name: "SmartLoad State" + - name: "SmartLoad" update_interval: 30 - class: "enum" + class: "binary_sensor" state_class: "" uom: "" - scale: 1 rule: 1 registers: [0x0228] + bitmask: 0x8 icon: "mdi:lightning-bolt-circle" - options: ["Off", "On"] - lookup: - - key: 0x0001 - value: "Off" - - key: 0x0004 - value: "Off" - - key: 0x0005 - value: "Off" - - key: 0x0008 - value: "On" - - key: 0x0009 - value: "On" - - key: 0x000C - value: "Off" - - key: 0x000D - value: "On" - - key: "default" - value: "On" - group: Work Mode items: @@ -1520,22 +1502,15 @@ parameters: - group: State items: - # Device - Power state On/Off - - name: "Device Power State" + # Device - Power On/Off + - name: "Device Power" update_interval: 30 - class: "enum" + class: "binary_sensor" state_class: "" uom: "" - scale: 1 rule: 1 registers: [0x0227] icon: "mdi:lightning-bolt-circle" - options: ["Off", "On"] - lookup: - - key: 0x0000 - value: "Off" - - key: 0x0001 - value: "On" # Device - AC Relay state - name: "Device Relay State"