Add Venstar runtimes and battery sensors (#60414)
* Venstar: Add runtimes and battery sensors * Address review - replace classes with lambda functions * Clean up patch usage, make temperature_unit it's own function * Remove double define of entities
This commit is contained in:
parent
bf1cacf4b2
commit
dd4ede09c8
8 changed files with 124 additions and 45 deletions
|
@ -60,3 +60,7 @@ class VenstarColorTouchMock:
|
|||
def update_alerts(self):
|
||||
"""Mock update_alerts."""
|
||||
return True
|
||||
|
||||
def get_runtimes(self):
|
||||
"""Mock get runtimes."""
|
||||
return {}
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
{"runtimes":[{"ts":1637452800,"heat1":0,"heat2":0,"cool1":156,"cool2":0,"aux1":0,"aux2":0,"fc":0},{"ts":1637539200,"heat1":0,"heat2":0,"cool1":216,"cool2":0,"aux1":0,"aux2":0,"fc":0},{"ts":1637625600,"heat1":0,"heat2":0,"cool1":234,"cool2":0,"aux1":0,"aux2":0,"fc":0},{"ts":1637712000,"heat1":0,"heat2":0,"cool1":225,"cool2":0,"aux1":0,"aux2":0,"fc":0},{"ts":1637798400,"heat1":0,"heat2":0,"cool1":153,"cool2":0,"aux1":0,"aux2":0,"fc":0},{"ts":1637884800,"heat1":0,"heat2":0,"cool1":94,"cool2":0,"aux1":0,"aux2":0,"fc":0},{"ts":1637921499,"heat1":0,"heat2":0,"cool1":12,"cool2":0,"aux1":0,"aux2":0,"fc":0}]}
|
1
tests/components/venstar/fixtures/t2k_runtimes.json
Normal file
1
tests/components/venstar/fixtures/t2k_runtimes.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"runtimes":[{"ts":1637452800,"heat1":0,"heat2":0,"cool1":156,"cool2":0,"aux1":0,"aux2":0,"fc":0},{"ts":1637539200,"heat1":0,"heat2":0,"cool1":216,"cool2":0,"aux1":0,"aux2":0,"fc":0},{"ts":1637625600,"heat1":0,"heat2":0,"cool1":234,"cool2":0,"aux1":0,"aux2":0,"fc":0},{"ts":1637712000,"heat1":0,"heat2":0,"cool1":225,"cool2":0,"aux1":0,"aux2":0,"fc":0},{"ts":1637798400,"heat1":0,"heat2":0,"cool1":153,"cool2":0,"aux1":0,"aux2":0,"fc":0},{"ts":1637884800,"heat1":0,"heat2":0,"cool1":94,"cool2":0,"aux1":0,"aux2":0,"fc":0},{"ts":1637921489,"heat1":0,"heat2":0,"cool1":12,"cool2":0,"aux1":0,"aux2":0,"fc":0}]}
|
|
@ -20,7 +20,7 @@ EXPECTED_BASE_SUPPORTED_FEATURES = (
|
|||
async def test_colortouch(hass):
|
||||
"""Test interfacing with a venstar colortouch with attached humidifier."""
|
||||
|
||||
with patch("homeassistant.components.onewire.sensor.asyncio.sleep"):
|
||||
with patch("homeassistant.components.venstar.VENSTAR_SLEEP", new=0):
|
||||
await async_init_integration(hass)
|
||||
|
||||
state = hass.states.get("climate.colortouch")
|
||||
|
@ -56,7 +56,7 @@ async def test_colortouch(hass):
|
|||
async def test_t2000(hass):
|
||||
"""Test interfacing with a venstar T2000 presently turned off."""
|
||||
|
||||
with patch("homeassistant.components.onewire.sensor.asyncio.sleep"):
|
||||
with patch("homeassistant.components.venstar.VENSTAR_SLEEP", new=0):
|
||||
await async_init_integration(hass)
|
||||
|
||||
state = hass.states.get("climate.t2000")
|
||||
|
|
|
@ -37,7 +37,11 @@ async def test_setup_entry(hass: HomeAssistant):
|
|||
"homeassistant.components.venstar.VenstarColorTouch.update_alerts",
|
||||
new=VenstarColorTouchMock.update_alerts,
|
||||
), patch(
|
||||
"homeassistant.components.onewire.sensor.asyncio.sleep"
|
||||
"homeassistant.components.venstar.VenstarColorTouch.get_runtimes",
|
||||
new=VenstarColorTouchMock.get_runtimes,
|
||||
), patch(
|
||||
"homeassistant.components.venstar.VENSTAR_SLEEP",
|
||||
new=0,
|
||||
):
|
||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
@ -72,6 +76,9 @@ async def test_setup_entry_exception(hass: HomeAssistant):
|
|||
), patch(
|
||||
"homeassistant.components.venstar.VenstarColorTouch.update_alerts",
|
||||
new=VenstarColorTouchMock.update_alerts,
|
||||
), patch(
|
||||
"homeassistant.components.venstar.VenstarColorTouch.get_runtimes",
|
||||
new=VenstarColorTouchMock.get_runtimes,
|
||||
):
|
||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue