Skip to content

Commit

Permalink
refactor: Added Grid prefix for Export Surplus
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrapan committed Jul 18, 2024
1 parent 0549e54 commit 709df97
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ parameters:
step: 0.1
icon: "mdi:battery"

- name: "Zero Export power"
- name: "Grid Zero Export power"
class: "power"
state_class: "measurement"
uom: "W"
Expand Down Expand Up @@ -389,7 +389,8 @@ parameters:

- group: Work Mode
items:
- name: Export Surplus
- name: Grid Export Surplus
alt: Solar Sell
update_interval: 30
class: "switch"
state_class: ""
Expand Down Expand Up @@ -1363,6 +1364,7 @@ parameters:

# Grid - The power is S16bit (low 16 bits) + S16bit (high 16 bits)
- name: "Grid Power"
desciption: Combined power of all three phases
realtime:
class: "measurement"
state_class: "measurement"
Expand Down Expand Up @@ -1610,6 +1612,7 @@ parameters:

# Load - The Power is S16bit (low 16 bits) + S16bit (high 16 bits)
- name: "Load Power"
desciption: Combined power of all three phases
realtime:
class: "power"
state_class: "measurement"
Expand Down Expand Up @@ -1679,6 +1682,7 @@ parameters:

# SmartLoad/Generator - The Power is S16bit (low 16 bits) + S16bit (high 16 bits)
- name: "SmartLoad Power"
desciption: Combined power of all three phases
realtime:
class: "power"
state_class: "measurement"
Expand All @@ -1691,6 +1695,7 @@ parameters:
items:
# PV - The combined power of Input 1 & 2 & 3 & 4 (L:1W, H:10W)
- name: "PV Power"
desciption: Combined power of all inputs
realtime:
class: "power"
state_class: "measurement"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ parameters:
step: 0.1
icon: "mdi:battery"

- name: "Zero Export power"
- name: "Grid Zero Export power"
class: "power"
state_class: "measurement"
uom: "W"
Expand Down Expand Up @@ -395,7 +395,8 @@ parameters:

- group: Work Mode
items:
- name: Export Surplus
- name: Grid Export Surplus
alt: Solar Sell
update_interval: 30
class: "switch"
state_class: ""
Expand Down Expand Up @@ -1369,6 +1370,7 @@ parameters:

# Grid - The power is S16bit (low 16 bits) + S16bit (high 16 bits)
- name: "Grid Power"
desciption: Combined power of all three phases
realtime:
class: "measurement"
state_class: "measurement"
Expand Down Expand Up @@ -1611,6 +1613,7 @@ parameters:

# Load - The Power is S16bit (low 16 bits) + S16bit (high 16 bits)
- name: "Load Power"
desciption: Combined power of all three phases
realtime:
class: "power"
state_class: "measurement"
Expand Down Expand Up @@ -1680,6 +1683,7 @@ parameters:

# SmartLoad/Generator - The Power is S16bit (low 16 bits) + S16bit (high 16 bits)
- name: "SmartLoad Power"
desciption: Combined power of all three phases
realtime:
class: "power"
state_class: "measurement"
Expand All @@ -1692,6 +1696,7 @@ parameters:
items:
# PV - The combined power of Input 1 & 2 & 3 & 4 (L:1W, H:10W)
- name: "PV Power"
desciption: Combined power of all inputs
realtime:
class: "power"
state_class: "measurement"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ parameters:
step: 0.1
icon: "mdi:battery"

- name: "Zero Export power"
- name: "Grid Zero Export power"
class: "power"
state_class: "measurement"
uom: "W"
Expand Down Expand Up @@ -397,7 +397,8 @@ parameters:

- group: Work Mode
items:
- name: Export Surplus
- name: Grid Export Surplus
alt: Solar Sell
update_interval: 30
class: "switch"
state_class: ""
Expand Down Expand Up @@ -1381,6 +1382,7 @@ parameters:

# Grid - The power is S16bit (low 16 bits) + S16bit (high 16 bits)
- name: "Grid Power"
desciption: Combined power of all three phases
realtime:
class: "measurement"
state_class: "measurement"
Expand All @@ -1392,6 +1394,7 @@ parameters:

# Grid - The inverted power is S16bit (low 16 bits) + S16bit (high 16 bits)
- name: "Grid Power ∇"
desciption: Combined power of all three phases
entity_id: "grid_power_inverted"
realtime:
class: "measurement"
Expand Down Expand Up @@ -1636,6 +1639,7 @@ parameters:

# Load - The Power is S16bit (low 16 bits) + S16bit (high 16 bits)
- name: "Load Power"
desciption: Combined power of all three phases
realtime:
class: "power"
state_class: "measurement"
Expand Down Expand Up @@ -1705,6 +1709,7 @@ parameters:

# SmartLoad/Generator - The Power is S16bit (low 16 bits) + S16bit (high 16 bits)
- name: "SmartLoad Power"
desciption: Combined power of all three phases
realtime:
class: "power"
state_class: "measurement"
Expand All @@ -1717,6 +1722,7 @@ parameters:
items:
# PV - The combined power of Input 1 & 2 & 3 & 4 (L:1W, H:10W)
- name: "PV Power"
desciption: Combined power of all inputs
realtime:
class: "power"
state_class: "measurement"
Expand Down
6 changes: 6 additions & 0 deletions custom_components/solarman/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ def __init__(self, coordinator, sensor, battery_nominal_voltage, battery_life_cy
if "unit_of_measurement" in sensor and (unit_of_measurement := sensor["unit_of_measurement"]):
self._attr_unit_of_measurement = unit_of_measurement

if "alt" in sensor and (alt := sensor["alt"]):
self._attr_extra_state_attributes = self._attr_extra_state_attributes | { "Alt Name": alt }

if "description" in sensor and (description := sensor["description"]):
self._attr_extra_state_attributes = self._attr_extra_state_attributes | { "description": description }

if "options" in sensor and (options := sensor["options"]):
self._attr_options = options
self._attr_extra_state_attributes = self._attr_extra_state_attributes | { "options": options }
Expand Down

0 comments on commit 709df97

Please sign in to comment.