Skip to content

Commit

Permalink
refactor: Binary sensors where suitable
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrapan committed Aug 15, 2024
1 parent 2d430e5 commit 92a52de
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 62 deletions.
37 changes: 6 additions & 31 deletions custom_components/solarman/inverter_definitions/deye_sg01hp3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Expand Down
37 changes: 6 additions & 31 deletions custom_components/solarman/inverter_definitions/deye_sg04lp3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 92a52de

Please sign in to comment.