Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
firstof9 committed Nov 19, 2024
1 parent 4b1081f commit 0c726e6
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
4 changes: 2 additions & 2 deletions custom_components/openevse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def parse_sensors(self) -> None:
"Could not update status for %s",
number,
)
data.update(_sensor)
data.update(_sensor)

Check warning on line 417 in custom_components/openevse/__init__.py

View check run for this annotation

Codecov / codecov/patch

custom_components/openevse/__init__.py#L417

Added line #L417 was not covered by tests
for light in LIGHT_TYPES: # pylint: disable=consider-using-dict-items
_sensor = {}
try:
Expand Down Expand Up @@ -480,7 +480,7 @@ async def async_parse_sensors(self) -> None:
"Could not update status for %s",
number,
)
data.update(_sensor)
data.update(_sensor)
_LOGGER.debug("DEBUG: %s", data)
self._data.update(data)

Expand Down
4 changes: 3 additions & 1 deletion custom_components/openevse/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ def available(self) -> bool:
attributes = ("charge_mode", "divert_active")
if set(attributes).issubset(data.keys()) and self._type == "max_current_soft":
if data["divert_active"] and data["charge_mode"] == "eco":
_LOGGER.debug("Disabling %s due to PV Divert being active.", self._attr_name)
_LOGGER.debug(
"Disabling %s due to PV Divert being active.", self._attr_name
)
return False
return self.coordinator.last_update_success

Expand Down
4 changes: 3 additions & 1 deletion custom_components/openevse/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ def available(self) -> bool:
attributes = ("charge_mode", "divert_active")
if set(attributes).issubset(data.keys()) and self._type == "max_current_soft":
if data["divert_active"] and data["charge_mode"] == "eco":
_LOGGER.debug("Disabling %s due to PV Divert being active.", self._attr_name)
_LOGGER.debug(
"Disabling %s due to PV Divert being active.", self._attr_name
)
return False
return self.coordinator.last_update_success

Expand Down
6 changes: 3 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_charger(mock_aioclient):
status=200,
body='{"properties":{"state":"disabled","charge_current":28,"max_current":23,"auto_release":false},"claims":{"state":65540,"charge_current":65537,"max_current":65548}}',
repeat=True,
)
)
return main.OpenEVSE(TEST_TLD)


Expand Down Expand Up @@ -155,7 +155,7 @@ def test_charger_bad_serial(mock_aioclient):
status=200,
body='{"properties":{"state":"disabled","charge_current":28,"max_current":23,"auto_release":false},"claims":{"state":65540,"charge_current":65537,"max_current":65548}}',
repeat=True,
)
)
return main.OpenEVSE(TEST_TLD)


Expand Down Expand Up @@ -196,7 +196,7 @@ def test_charger_bad_post(mock_aioclient):
status=200,
body='{"properties":{"state":"disabled","charge_current":28,"max_current":23,"auto_release":false},"claims":{"state":65540,"charge_current":65537,"max_current":65548}}',
repeat=True,
)
)
return main.OpenEVSE(TEST_TLD)


Expand Down
9 changes: 6 additions & 3 deletions tests/test_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,11 @@ async def test_number(
updated_data = coordinator._data
coordinator.async_set_updated_data(updated_data)
await hass.async_block_till_done()

state = hass.states.get(entity_id)
assert state
assert state.state == 'unavailable'
assert "Disabling openevse Charge Rate due to PV Divert being active." in caplog.text
assert state.state == "unavailable"
assert (
"Disabling openevse Charge Rate due to PV Divert being active."
in caplog.text
)

0 comments on commit 0c726e6

Please sign in to comment.