Skip to content

Commit

Permalink
fix: Custom BatterySensor only when missing registers property
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrapan committed Aug 16, 2024
1 parent 75a6809 commit 8750600
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/solarman/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def _create_sensor(coordinator, sensor, battery_nominal_voltage, battery_life_cy
match sensor["artificial"]:
case "interval":
return SolarmanIntervalSensor(coordinator, sensor)
elif sensor["name"] in ("Battery SOH", "Battery State", "Today Battery Life Cycles", "Total Battery Life Cycles"):
elif not "registers" in sensor and sensor["name"] in ("Battery SOH", "Battery State", "Today Battery Life Cycles", "Total Battery Life Cycles"):
return SolarmanBatterySensor(coordinator, sensor, battery_nominal_voltage, battery_life_cycle_rating)

return SolarmanSensor(coordinator, sensor, battery_nominal_voltage, battery_life_cycle_rating)
Expand Down

0 comments on commit 8750600

Please sign in to comment.