diff --git a/homeassistant/components/victron_ble/sensor.py b/homeassistant/components/victron_ble/sensor.py index 244f8150d77..0b5916b23ca 100644 --- a/homeassistant/components/victron_ble/sensor.py +++ b/homeassistant/components/victron_ble/sensor.py @@ -243,6 +243,12 @@ SENSOR_DESCRIPTIONS = { native_unit_of_measurement=UnitOfElectricPotential.VOLT, state_class=SensorStateClass.MEASUREMENT, ), + Keys.CHARGE_STATE: VictronBLESensorEntityDescription( + key=Keys.CHARGE_STATE, + device_class=SensorDeviceClass.ENUM, + translation_key="charge_state", + options=DEVICE_STATE_OPTIONS, + ), Keys.CHARGER_ERROR: VictronBLESensorEntityDescription( key=Keys.CHARGER_ERROR, device_class=SensorDeviceClass.ENUM, diff --git a/homeassistant/components/victron_ble/strings.json b/homeassistant/components/victron_ble/strings.json index 25967f4f8e4..1553d373213 100644 --- a/homeassistant/components/victron_ble/strings.json +++ b/homeassistant/components/victron_ble/strings.json @@ -87,6 +87,28 @@ "cell_voltage": { "name": "Cell {cell} voltage" }, + "charge_state": { + "name": "Charge state", + "state": { + "absorption": "[%key:component::victron_ble::entity::sensor::device_state::state::absorption%]", + "active": "[%key:component::victron_ble::entity::sensor::device_state::state::active%]", + "battery_safe": "[%key:component::victron_ble::entity::sensor::device_state::state::battery_safe%]", + "bulk": "[%key:component::victron_ble::entity::sensor::device_state::state::bulk%]", + "equalize_manual": "[%key:component::victron_ble::entity::sensor::device_state::state::equalize_manual%]", + "external_control": "[%key:component::victron_ble::entity::sensor::device_state::state::external_control%]", + "fault": "[%key:component::victron_ble::entity::sensor::device_state::state::fault%]", + "float": "[%key:component::victron_ble::entity::sensor::device_state::state::float%]", + "inverting": "[%key:component::victron_ble::entity::sensor::device_state::state::inverting%]", + "low_power": "[%key:component::victron_ble::entity::sensor::device_state::state::low_power%]", + "not_available": "[%key:component::victron_ble::entity::sensor::device_state::state::not_available%]", + "off": "[%key:common::state::off%]", + "power_supply": "[%key:component::victron_ble::entity::sensor::device_state::state::power_supply%]", + "recondition": "[%key:component::victron_ble::entity::sensor::device_state::state::recondition%]", + "repeated_absorption": "[%key:component::victron_ble::entity::sensor::device_state::state::repeated_absorption%]", + "starting_up": "[%key:component::victron_ble::entity::sensor::device_state::state::starting_up%]", + "storage": "[%key:component::victron_ble::entity::sensor::device_state::state::storage%]" + } + }, "charger_error": { "name": "Charger error", "state": { diff --git a/tests/components/victron_ble/snapshots/test_sensor.ambr b/tests/components/victron_ble/snapshots/test_sensor.ambr index f66d6a3833c..c7f9edcca82 100644 --- a/tests/components/victron_ble/snapshots/test_sensor.ambr +++ b/tests/components/victron_ble/snapshots/test_sensor.ambr @@ -1153,6 +1153,95 @@ 'state': '13.88', }) # --- +# name: test_sensors[solar_charger][sensor.solar_charger_charge_state-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'options': list([ + 'off', + 'low_power', + 'fault', + 'bulk', + 'absorption', + 'float', + 'storage', + 'equalize_manual', + 'inverting', + 'power_supply', + 'starting_up', + 'repeated_absorption', + 'recondition', + 'battery_safe', + 'active', + 'external_control', + 'not_available', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.solar_charger_charge_state', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Charge state', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Charge state', + 'platform': 'victron_ble', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'charge_state', + 'unique_id': '01:02:03:04:05:11-charge_state', + 'unit_of_measurement': None, + }) +# --- +# name: test_sensors[solar_charger][sensor.solar_charger_charge_state-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'enum', + 'friendly_name': 'Solar Charger Charge state', + 'options': list([ + 'off', + 'low_power', + 'fault', + 'bulk', + 'absorption', + 'float', + 'storage', + 'equalize_manual', + 'inverting', + 'power_supply', + 'starting_up', + 'repeated_absorption', + 'recondition', + 'battery_safe', + 'active', + 'external_control', + 'not_available', + ]), + }), + 'context': , + 'entity_id': 'sensor.solar_charger_charge_state', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'absorption', + }) +# --- # name: test_sensors[solar_charger][sensor.solar_charger_external_device_load-entry] EntityRegistryEntrySnapshot({ 'aliases': set({