diff --git a/custom_components/myenergi/diagnostics.py b/custom_components/myenergi/diagnostics.py index 63364d4..3680e00 100644 --- a/custom_components/myenergi/diagnostics.py +++ b/custom_components/myenergi/diagnostics.py @@ -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 @@ -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: diff --git a/custom_components/myenergi/sensor.py b/custom_components/myenergi/sensor.py index 577bdb4..f215fa2 100644 --- a/custom_components/myenergi/sensor.py +++ b/custom_components/myenergi/sensor.py @@ -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, diff --git a/tests/test_services.py b/tests/test_services.py index 0d6671f..3d689b8 100644 --- a/tests/test_services.py +++ b/tests/test_services.py @@ -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) @@ -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 \ No newline at end of file + assert mock_zappi_unlock.call_count == 1