-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Dishwasher support * Update README with dishwasher
- Loading branch information
Showing
8 changed files
with
301 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"statusDWash": { | ||
"StatoWiFi": "1", | ||
"StatoDWash": "0", | ||
"CodiceErrore": "E0", | ||
"StartStop": "0", | ||
"Program": "P1", | ||
"OpzProg": "p", | ||
"DelayStart": "0", | ||
"RemTime": "12", | ||
"TreinUno": "0", | ||
"Eco": "0", | ||
"MetaCarico": "0", | ||
"ExtraDry": "0", | ||
"MissSalt": "0", | ||
"MissRinse": "0", | ||
"OpenDoor": "0", | ||
"Reset": "0", | ||
"FWver": "L1.12" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"statusDWash": { | ||
"StatoWiFi": "0", | ||
"StatoDWash": "2", | ||
"CodiceErrore": "E0", | ||
"StartStop": "0", | ||
"Program": "P2", | ||
"OpzProg": "m", | ||
"DelayStart": "0", | ||
"RemTime": "68", | ||
"TreinUno": "0", | ||
"Eco": "1", | ||
"MetaCarico": "0", | ||
"ExtraDry": "0", | ||
"MissSalt": "0", | ||
"MissRinse": "0", | ||
"OpenDoor": "0", | ||
"Reset": "0", | ||
"FWver": "L1.12" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
"""Tests for various sensors""" | ||
from pytest_homeassistant_custom_component.common import MockConfigEntry, load_fixture | ||
from pytest_homeassistant_custom_component.test_util.aiohttp import AiohttpClientMocker | ||
from homeassistant.core import HomeAssistant | ||
from homeassistant.helpers import entity_registry, device_registry | ||
|
||
from .common import init_integration | ||
|
||
|
||
async def test_main_sensor_idle(hass: HomeAssistant, aioclient_mock: AiohttpClientMocker): | ||
await init_integration(hass, aioclient_mock, load_fixture("dishwasher/idle.json")) | ||
|
||
state = hass.states.get("sensor.dishwasher") | ||
|
||
assert state | ||
assert state.state == "Idle" | ||
assert state.attributes == { | ||
"program": "P1+", | ||
"remaining_minutes": 0, | ||
"eco_mode": False, | ||
"door_open": False, | ||
"remote_control": True, | ||
"friendly_name": "Dishwasher", | ||
"icon": "mdi:glass-wine" | ||
} | ||
|
||
|
||
async def test_main_sensor_wash(hass: HomeAssistant, aioclient_mock: AiohttpClientMocker): | ||
await init_integration(hass, aioclient_mock, load_fixture("dishwasher/wash.json")) | ||
|
||
state = hass.states.get("sensor.dishwasher") | ||
|
||
assert state | ||
assert state.state == "Wash" | ||
assert state.attributes == { | ||
"program": "P2-", | ||
"remaining_minutes": 68, | ||
"eco_mode": True, | ||
"door_open": False, | ||
"remote_control": False, | ||
"friendly_name": "Dishwasher", | ||
"icon": "mdi:glass-wine" | ||
} | ||
|
||
|
||
async def test_remaining_time_sensor_idle(hass: HomeAssistant, aioclient_mock: AiohttpClientMocker): | ||
await init_integration(hass, aioclient_mock, load_fixture("dishwasher/idle.json")) | ||
|
||
state = hass.states.get("sensor.dishwasher_remaining_time") | ||
|
||
assert state | ||
assert state.state == "0" | ||
assert state.attributes == { | ||
"friendly_name": "Dishwasher remaining time", | ||
"icon": "mdi:progress-clock", | ||
"unit_of_measurement": "min", | ||
} | ||
|
||
|
||
async def test_remaining_time_sensor_wash(hass: HomeAssistant, aioclient_mock: AiohttpClientMocker): | ||
await init_integration(hass, aioclient_mock, load_fixture("dishwasher/wash.json")) | ||
|
||
state = hass.states.get("sensor.dishwasher_remaining_time") | ||
|
||
assert state | ||
assert state.state == "68" | ||
assert state.attributes == { | ||
"friendly_name": "Dishwasher remaining time", | ||
"icon": "mdi:progress-clock", | ||
"unit_of_measurement": "min", | ||
} | ||
|
||
|
||
async def test_main_sensor_device_info(hass: HomeAssistant, aioclient_mock: AiohttpClientMocker): | ||
await init_integration(hass, aioclient_mock, load_fixture("dishwasher/idle.json")) | ||
|
||
er = entity_registry.async_get(hass) | ||
dr = device_registry.async_get(hass) | ||
entry = er.async_get("sensor.dishwasher") | ||
device = dr.async_get(entry.device_id) | ||
|
||
assert device | ||
assert device.manufacturer == "Candy" | ||
assert device.name == "Dishwasher" | ||
assert device.suggested_area == "Kitchen" | ||
|
||
|
||
async def test_sensors_device_info(hass: HomeAssistant, aioclient_mock: AiohttpClientMocker): | ||
await init_integration(hass, aioclient_mock, load_fixture("dishwasher/idle.json")) | ||
|
||
er = entity_registry.async_get(hass) | ||
dr = device_registry.async_get(hass) | ||
|
||
main_sensor = er.async_get("sensor.dishwasher") | ||
time_sensor = er.async_get("sensor.dishwasher_remaining_time") | ||
|
||
main_device = dr.async_get(main_sensor.device_id) | ||
time_device = dr.async_get(time_sensor.device_id) | ||
|
||
assert main_device | ||
assert time_device | ||
assert main_device == time_device |