Update services.yaml for nuheat (#29133)
* update services.yaml for nuheat * update tests * black formatting
This commit is contained in:
parent
fdf0793fdd
commit
ef21fd2536
4 changed files with 19 additions and 16 deletions
|
@ -9,6 +9,7 @@ set_aux_heat:
|
|||
aux_heat:
|
||||
description: New value of axillary heater.
|
||||
example: true
|
||||
|
||||
set_preset_mode:
|
||||
description: Set preset mode for climate device.
|
||||
fields:
|
||||
|
@ -18,6 +19,7 @@ set_preset_mode:
|
|||
preset_mode:
|
||||
description: New value of preset mode
|
||||
example: 'away'
|
||||
|
||||
set_temperature:
|
||||
description: Set target temperature of climate device.
|
||||
fields:
|
||||
|
@ -36,6 +38,7 @@ set_temperature:
|
|||
hvac_mode:
|
||||
description: HVAC operation mode to set temperature to.
|
||||
example: 'heat'
|
||||
|
||||
set_humidity:
|
||||
description: Set target humidity of climate device.
|
||||
fields:
|
||||
|
@ -45,6 +48,7 @@ set_humidity:
|
|||
humidity:
|
||||
description: New target humidity for climate device.
|
||||
example: 60
|
||||
|
||||
set_fan_mode:
|
||||
description: Set fan operation for climate device.
|
||||
fields:
|
||||
|
@ -54,6 +58,7 @@ set_fan_mode:
|
|||
fan_mode:
|
||||
description: New value of fan mode.
|
||||
example: On Low
|
||||
|
||||
set_hvac_mode:
|
||||
description: Set HVAC operation mode for climate device.
|
||||
fields:
|
||||
|
@ -63,6 +68,7 @@ set_hvac_mode:
|
|||
hvac_mode:
|
||||
description: New value of operation mode.
|
||||
example: heat
|
||||
|
||||
set_swing_mode:
|
||||
description: Set swing operation for climate device.
|
||||
fields:
|
||||
|
@ -72,13 +78,6 @@ set_swing_mode:
|
|||
swing_mode:
|
||||
description: New value of swing mode.
|
||||
|
||||
nuheat_resume_program:
|
||||
description: Resume the programmed schedule.
|
||||
fields:
|
||||
entity_id:
|
||||
description: Name(s) of entities to change.
|
||||
example: 'climate.kitchen'
|
||||
|
||||
turn_on:
|
||||
description: Turn climate device on.
|
||||
fields:
|
||||
|
|
|
@ -22,7 +22,7 @@ from homeassistant.const import (
|
|||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
from . import DOMAIN as NUHEAT_DOMAIN
|
||||
from . import DOMAIN
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -52,7 +52,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
return
|
||||
|
||||
temperature_unit = hass.config.units.temperature_unit
|
||||
api, serial_numbers = hass.data[NUHEAT_DOMAIN]
|
||||
api, serial_numbers = hass.data[DOMAIN]
|
||||
thermostats = [
|
||||
NuHeatThermostat(api, serial_number, temperature_unit)
|
||||
for serial_number in serial_numbers
|
||||
|
@ -75,7 +75,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||
thermostat.schedule_update_ha_state(True)
|
||||
|
||||
hass.services.register(
|
||||
NUHEAT_DOMAIN,
|
||||
DOMAIN,
|
||||
SERVICE_RESUME_PROGRAM,
|
||||
resume_program_set_service,
|
||||
schema=RESUME_PROGRAM_SCHEMA,
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
resume_program:
|
||||
description: Resume the programmed schedule.
|
||||
fields:
|
||||
entity_id:
|
||||
description: Name(s) of entities to change.
|
||||
example: 'climate.kitchen'
|
|
@ -67,7 +67,7 @@ class TestNuHeat(unittest.TestCase):
|
|||
thermostat = mocked_thermostat(self.api, "12345", "F")
|
||||
thermostats = [thermostat]
|
||||
|
||||
self.hass.data[nuheat.NUHEAT_DOMAIN] = (self.api, ["12345"])
|
||||
self.hass.data[nuheat.DOMAIN] = (self.api, ["12345"])
|
||||
|
||||
config = {}
|
||||
add_entities = Mock()
|
||||
|
@ -85,12 +85,12 @@ class TestNuHeat(unittest.TestCase):
|
|||
thermostat.schedule_update_ha_state = Mock()
|
||||
thermostat.entity_id = "climate.master_bathroom"
|
||||
|
||||
self.hass.data[nuheat.NUHEAT_DOMAIN] = (self.api, ["12345"])
|
||||
self.hass.data[nuheat.DOMAIN] = (self.api, ["12345"])
|
||||
nuheat.setup_platform(self.hass, {}, Mock(), {})
|
||||
|
||||
# Explicit entity
|
||||
self.hass.services.call(
|
||||
nuheat.NUHEAT_DOMAIN,
|
||||
nuheat.DOMAIN,
|
||||
nuheat.SERVICE_RESUME_PROGRAM,
|
||||
{"entity_id": "climate.master_bathroom"},
|
||||
True,
|
||||
|
@ -103,9 +103,7 @@ class TestNuHeat(unittest.TestCase):
|
|||
thermostat.schedule_update_ha_state.reset_mock()
|
||||
|
||||
# All entities
|
||||
self.hass.services.call(
|
||||
nuheat.NUHEAT_DOMAIN, nuheat.SERVICE_RESUME_PROGRAM, {}, True
|
||||
)
|
||||
self.hass.services.call(nuheat.DOMAIN, nuheat.SERVICE_RESUME_PROGRAM, {}, True)
|
||||
|
||||
thermostat.resume_program.assert_called_with()
|
||||
thermostat.schedule_update_ha_state.assert_called_with(True)
|
||||
|
|
Loading…
Add table
Reference in a new issue