Skip to content

Commit 15fe170

Browse files
committed
v1.0.2: Update custom_components/solarmanager/sensor.py
1 parent d08cdf3 commit 15fe170

1 file changed

Lines changed: 32 additions & 16 deletions

File tree

custom_components/solarmanager/sensor.py

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,38 @@ class SolarManagerSensorDescription(SensorEntityDescription):
167167
state_class=SensorStateClass.MEASUREMENT,
168168
icon="mdi:shield-solar",
169169
),
170+
SolarManagerSensorDescription(
171+
key="gridFeedIn",
172+
name="Daily Grid Feed-In",
173+
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
174+
device_class=SensorDeviceClass.ENERGY,
175+
state_class=SensorStateClass.TOTAL_INCREASING,
176+
icon="mdi:transmission-tower-export",
177+
),
178+
SolarManagerSensorDescription(
179+
key="gridPurchase",
180+
name="Daily Grid Purchase",
181+
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
182+
device_class=SensorDeviceClass.ENERGY,
183+
state_class=SensorStateClass.TOTAL_INCREASING,
184+
icon="mdi:transmission-tower-import",
185+
),
186+
SolarManagerSensorDescription(
187+
key="batteryDischarged",
188+
name="Daily Battery Discharged",
189+
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
190+
device_class=SensorDeviceClass.ENERGY,
191+
state_class=SensorStateClass.TOTAL_INCREASING,
192+
icon="mdi:battery-minus",
193+
),
194+
SolarManagerSensorDescription(
195+
key="batteryCharged",
196+
name="Daily Battery Charged",
197+
native_unit_of_measurement=UnitOfEnergy.WATT_HOUR,
198+
device_class=SensorDeviceClass.ENERGY,
199+
state_class=SensorStateClass.TOTAL_INCREASING,
200+
icon="mdi:battery-plus",
201+
),
170202
)
171203

172204
# ---------------------------------------------------------------------------
@@ -366,22 +398,6 @@ def _build_device_sensor_entities(
366398
)
367399
)
368400

369-
# Switch state
370-
if "switchState" in sensor:
371-
entities.append(
372-
SolarManagerDevicePowerSensor(
373-
coord, sensor_id, "switchState",
374-
SolarManagerSensorDescription(
375-
key=f"{sensor_id}_switch_state",
376-
name=f"{sensor_name} Switch State",
377-
native_unit_of_measurement=None,
378-
state_class=SensorStateClass.MEASUREMENT,
379-
icon="mdi:toggle-switch",
380-
),
381-
device_info,
382-
)
383-
)
384-
385401
# Consumed last 24h
386402
if "consumedForLast24h" in sensor:
387403
entities.append(

0 commit comments

Comments
 (0)