mirror of
https://github.com/home-assistant/core.git
synced 2026-02-14 23:28:42 +00:00
Add charge state to Victron BLE (#162593)
Co-authored-by: Graham Crockford <badgerwithagun@users.noreply.github.com> Co-authored-by: Joostlek <joostlek@outlook.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'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': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Charge state',
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.ENUM: 'enum'>,
|
||||
'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': <ANY>,
|
||||
'entity_id': 'sensor.solar_charger_charge_state',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'absorption',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[solar_charger][sensor.solar_charger_external_device_load-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
|
||||
Reference in New Issue
Block a user