Skip to content

Commit

Permalink
do not let highest and lowest cell be a voltage class. Add device cla…
Browse files Browse the repository at this point in the history
…ss for capacity. (dreadnought#38)
  • Loading branch information
jgimbel authored Jan 2, 2023
1 parent e1c5041 commit a4a2ad4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bin/daly-bms-cli
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def build_mqtt_hass_config_discovery(base):
if 'soc_percent' in base:
hass_config_data["device_class"] = 'battery'
hass_config_data["unit_of_measurement"] = '%'
elif 'voltage' in base:
elif 'voltage' in base and not ('lowest_cell' in base or 'highest_cell' in base):
hass_config_data["device_class"] = 'voltage'
hass_config_data["unit_of_measurement"] = 'V'
elif 'current' in base:
Expand All @@ -110,6 +110,9 @@ def build_mqtt_hass_config_discovery(base):
elif 'temperatures' in base:
hass_config_data["device_class"] = 'temperature'
hass_config_data["unit_of_measurement"] = '°C'
elif 'capacity' in 'base':
hass_config_data["device_class"] = 'energy'
hass_config_data["unit_of_measurement"] = 'Ah'
else:
pass

Expand Down

0 comments on commit a4a2ad4

Please sign in to comment.