Skip to content

Commit

Permalink
Merge pull request #98 from henricm/add-load-balancing-sensor
Browse files Browse the repository at this point in the history
feat: add sensor for load balancing
  • Loading branch information
argoyle authored Dec 4, 2021
2 parents 5aefd37 + 1457341 commit 2f5ebcb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
12 changes: 12 additions & 0 deletions custom_components/ferroamp/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1491,4 +1491,16 @@ def ehub_sensors(slug, interval, precision_battery, precision_current, precision
precision_current,
config_id,
),
ThreePhaseMinFerroampSensor(
"Available RMS current for load balancing",
slug,
"iavbl",
ELECTRIC_CURRENT_AMPERE,
"mdi:current-ac",
f"{slug}_{EHUB}",
EHUB_NAME,
interval,
precision_current,
config_id,
),
]
13 changes: 13 additions & 0 deletions tests/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,19 @@ async def test_setting_ehub_sensor_values_via_mqtt_message(hass, mqtt_mock):
'state_class': 'measurement',
'unit_of_measurement': 'A'
}

state = hass.states.get("sensor.ferroamp_available_rms_current_for_load_balancing")
assert state.state == "26"
assert state.attributes == {
'L1': 31.20,
'L2': 26.31,
'L3': 29.69,
'device_class': 'current',
'friendly_name': 'Available RMS current for load balancing',
'icon': 'mdi:current-ac',
'state_class': 'measurement',
'unit_of_measurement': 'A'
}

state = hass.states.get("sensor.ferroamp_available_three_phase_active_current_for_load_balancing")
assert state.state == "29"
Expand Down

0 comments on commit 2f5ebcb

Please sign in to comment.