Skip to content

Commit

Permalink
Merge pull request #498 from jwillemsen/jwi-ling
Browse files Browse the repository at this point in the history
Run pre-commit, removed not necessary imports
  • Loading branch information
CJNE authored Mar 13, 2024
2 parents 9912e40 + fd7de2e commit a1c4162
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 0 additions & 4 deletions custom_components/myenergi/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@

from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.device_registry import DeviceEntry
from pymyenergi.client import MyenergiClient
from pymyenergi.connection import Connection

from .const import DOMAIN

Expand All @@ -18,7 +15,6 @@ async def async_get_config_entry_diagnostics(
"""Return diagnostics for a config entry."""
data = {}
coordinator = hass.data[DOMAIN][entry.entry_id]
devices = []
# Don't cause a refresh when fetching devices
all_devices = await coordinator.client.get_devices("all", False)
for device in all_devices:
Expand Down
10 changes: 10 additions & 0 deletions custom_components/myenergi/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,16 @@ async def async_setup_entry(hass, entry, async_add_devices):

# Sensors common to Zapi and Eddi
if device.kind in [ZAPPI, EDDI]:
sensors.append(
MyenergiSensor(
coordinator,
device,
entry,
create_meta(
"Number of phases", "num_phases", ENTITY_CATEGORY_DIAGNOSTIC
),
)
)
sensors.append(
MyenergiSensor(
coordinator,
Expand Down
6 changes: 2 additions & 4 deletions tests/test_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ async def test_stop_boost(
assert mock_zappi_stop_boost.call_count == 1


async def test_unlock(
hass: HomeAssistant, mock_zappi_unlock: MagicMock
) -> None:
async def test_unlock(hass: HomeAssistant, mock_zappi_unlock: MagicMock) -> None:
"""Verify device information includes expected details."""

await setup_mock_myenergi_config_entry(hass)
Expand All @@ -109,4 +107,4 @@ async def test_unlock(
)
assert mock_zappi_unlock.call_count == 0
await hass.async_block_till_done()
assert mock_zappi_unlock.call_count == 1
assert mock_zappi_unlock.call_count == 1

0 comments on commit a1c4162

Please sign in to comment.