Add more sensors to SmartTub integration (#46839)

This commit is contained in:
Matt Zimmerman
2021-02-21 17:40:23 -10:00
committed by GitHub
parent 8330940996
commit 12c4db076c
3 changed files with 69 additions and 9 deletions
+18
View File
@@ -47,6 +47,24 @@ def mock_spa():
"water": {"temperature": 38},
"heater": "ON",
"state": "NORMAL",
"primaryFiltration": {
"cycle": 1,
"duration": 4,
"lastUpdated": "2021-01-20T11:38:57.014Z",
"mode": "NORMAL",
"startHour": 2,
"status": "INACTIVE",
},
"secondaryFiltration": {
"lastUpdated": "2020-07-09T19:39:52.961Z",
"mode": "AWAY",
"status": "INACTIVE",
},
"flowSwitch": "OPEN",
"ozone": "OFF",
"uv": "OFF",
"blowoutCycle": "INACTIVE",
"cleanupCycle": "INACTIVE",
}
return mock_spa
+22 -2
View File
@@ -3,8 +3,8 @@
from . import trigger_update
async def test_state_update(spa, setup_entry, hass, smarttub_api):
"""Test the state entity."""
async def test_sensors(spa, setup_entry, hass, smarttub_api):
"""Test the sensors."""
entity_id = f"sensor.{spa.brand}_{spa.model}_state"
state = hass.states.get(entity_id)
@@ -16,3 +16,23 @@ async def test_state_update(spa, setup_entry, hass, smarttub_api):
state = hass.states.get(entity_id)
assert state is not None
assert state.state == "bad"
entity_id = f"sensor.{spa.brand}_{spa.model}_flow_switch"
state = hass.states.get(entity_id)
assert state is not None
assert state.state == "open"
entity_id = f"sensor.{spa.brand}_{spa.model}_ozone"
state = hass.states.get(entity_id)
assert state is not None
assert state.state == "off"
entity_id = f"sensor.{spa.brand}_{spa.model}_blowout_cycle"
state = hass.states.get(entity_id)
assert state is not None
assert state.state == "inactive"
entity_id = f"sensor.{spa.brand}_{spa.model}_cleanup_cycle"
state = hass.states.get(entity_id)
assert state is not None
assert state.state == "inactive"