Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run pre-commit, removed not necessary imports #498

Merged
merged 2 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading