2016-08-19 07:17:28 +00:00
|
|
|
"""The tests for the generic_thermostat."""
|
|
|
|
import datetime
|
2021-01-01 21:31:56 +00:00
|
|
|
from unittest.mock import patch
|
Climate 1.0 (#23899)
* Climate 1.0 / part 1/2/3
* fix flake
* Lint
* Update Google Assistant
* ambiclimate to climate 1.0 (#24911)
* Fix Alexa
* Lint
* Migrate zhong_hong
* Migrate tuya
* Migrate honeywell to new climate schema (#24257)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* Fix PRESET can be None
* apply PR#23913 from dev
* remove EU component, etc.
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* apply PR#23913 from dev
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* delint, move debug code
* away preset now working
* code tidy-up
* code tidy-up 2
* code tidy-up 3
* address issues #18932, #15063
* address issues #18932, #15063 - 2/2
* refactor MODE_AUTO to MODE_HEAT_COOL and use F not C
* add low/high to set_temp
* add low/high to set_temp 2
* add low/high to set_temp - delint
* run HA scripts
* port changes from PR #24402
* manual rebase
* manual rebase 2
* delint
* minor change
* remove SUPPORT_HVAC_ACTION
* Migrate radiotherm
* Convert touchline
* Migrate flexit
* Migrate nuheat
* Migrate maxcube
* Fix names maxcube const
* Migrate proliphix
* Migrate heatmiser
* Migrate fritzbox
* Migrate opentherm_gw
* Migrate venstar
* Migrate daikin
* Migrate modbus
* Fix elif
* Migrate Homematic IP Cloud to climate-1.0 (#24913)
* hmip climate fix
* Update hvac_mode and preset_mode
* fix lint
* Fix lint
* Migrate generic_thermostat
* Migrate incomfort to new climate schema (#24915)
* initial commit
* Update climate.py
* Migrate eq3btsmart
* Lint
* cleanup PRESET_MANUAL
* Migrate ecobee
* No conditional features
* KNX: Migrate climate component to new climate platform (#24931)
* Migrate climate component
* Remove unused code
* Corrected line length
* Lint
* Lint
* fix tests
* Fix value
* Migrate geniushub to new climate schema (#24191)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* delinted
* delinted
* use latest client
* clean up mappings
* clean up mappings
* add duration to set_temperature
* add duration to set_temperature
* manual rebase
* tweak
* fix regression
* small fix
* fix rebase mixup
* address comments
* finish refactor
* fix regression
* tweak type hints
* delint
* manual rebase
* WIP: Fixes for honeywell migration to climate-1.0 (#24938)
* add type hints
* code tidy-up
* Fixes for incomfort migration to climate-1.0 (#24936)
* delint type hints
* no async unless await
* revert: no async unless await
* revert: no async unless await 2
* delint
* fix typo
* Fix homekit_controller on climate-1.0 (#24948)
* Fix tests on climate-1.0 branch
* As part of climate-1.0, make state return the heating-cooling.current characteristic
* Fixes from review
* lint
* Fix imports
* Migrate stibel_eltron
* Fix lint
* Migrate coolmaster to climate 1.0 (#24967)
* Migrate coolmaster to climate 1.0
* fix lint errors
* More lint fixes
* Fix demo to work with UI
* Migrate spider
* Demo update
* Updated frontend to 20190705.0
* Fix boost mode (#24980)
* Prepare Netatmo for climate 1.0 (#24973)
* Migration Netatmo
* Address comments
* Update climate.py
* Migrate ephember
* Migrate Sensibo
* Implemented review comments (#24942)
* Migrate ESPHome
* Migrate MQTT
* Migrate Nest
* Migrate melissa
* Initial/partial migration of ST
* Migrate ST
* Remove Away mode (#24995)
* Migrate evohome, cache access tokens (#24491)
* add water_heater, add storage - initial commit
* add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
* Add Broker, Water Heater & Refactor
add missing code
desiderata
* update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
* bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
* support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
* store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
* update CODEOWNERS
* fix regression
* fix requirements
* migrate to climate-1.0
* tweaking
* de-lint
* TCS working? & delint
* tweaking
* TCS code finalised
* remove available() logic
* refactor _switchpoints()
* tidy up switchpoint code
* tweak
* teaking device_state_attributes
* some refactoring
* move PRESET_CUSTOM back to evohome
* move CONF_ACCESS_TOKEN_EXPIRES CONF_REFRESH_TOKEN back to evohome
* refactor SP code and dt conversion
* delinted
* delinted
* remove water_heater
* fix regression
* Migrate homekit
* Cleanup away mode
* Fix tests
* add helpers
* fix tests melissa
* Fix nehueat
* fix zwave
* add more tests
* fix deconz
* Fix climate test emulate_hue
* fix tests
* fix dyson tests
* fix demo with new layout
* fix honeywell
* Switch homekit_controller to use HVAC_MODE_HEAT_COOL instead of HVAC_MODE_AUTO (#25009)
* Lint
* PyLint
* Pylint
* fix fritzbox tests
* Fix google
* Fix all tests
* Fix lint
* Fix auto for homekit like controler
* Fix lint
* fix lint
2019-07-08 12:00:24 +00:00
|
|
|
|
2023-05-24 18:17:28 +00:00
|
|
|
from freezegun import freeze_time
|
Climate 1.0 (#23899)
* Climate 1.0 / part 1/2/3
* fix flake
* Lint
* Update Google Assistant
* ambiclimate to climate 1.0 (#24911)
* Fix Alexa
* Lint
* Migrate zhong_hong
* Migrate tuya
* Migrate honeywell to new climate schema (#24257)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* Fix PRESET can be None
* apply PR#23913 from dev
* remove EU component, etc.
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* apply PR#23913 from dev
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* delint, move debug code
* away preset now working
* code tidy-up
* code tidy-up 2
* code tidy-up 3
* address issues #18932, #15063
* address issues #18932, #15063 - 2/2
* refactor MODE_AUTO to MODE_HEAT_COOL and use F not C
* add low/high to set_temp
* add low/high to set_temp 2
* add low/high to set_temp - delint
* run HA scripts
* port changes from PR #24402
* manual rebase
* manual rebase 2
* delint
* minor change
* remove SUPPORT_HVAC_ACTION
* Migrate radiotherm
* Convert touchline
* Migrate flexit
* Migrate nuheat
* Migrate maxcube
* Fix names maxcube const
* Migrate proliphix
* Migrate heatmiser
* Migrate fritzbox
* Migrate opentherm_gw
* Migrate venstar
* Migrate daikin
* Migrate modbus
* Fix elif
* Migrate Homematic IP Cloud to climate-1.0 (#24913)
* hmip climate fix
* Update hvac_mode and preset_mode
* fix lint
* Fix lint
* Migrate generic_thermostat
* Migrate incomfort to new climate schema (#24915)
* initial commit
* Update climate.py
* Migrate eq3btsmart
* Lint
* cleanup PRESET_MANUAL
* Migrate ecobee
* No conditional features
* KNX: Migrate climate component to new climate platform (#24931)
* Migrate climate component
* Remove unused code
* Corrected line length
* Lint
* Lint
* fix tests
* Fix value
* Migrate geniushub to new climate schema (#24191)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* delinted
* delinted
* use latest client
* clean up mappings
* clean up mappings
* add duration to set_temperature
* add duration to set_temperature
* manual rebase
* tweak
* fix regression
* small fix
* fix rebase mixup
* address comments
* finish refactor
* fix regression
* tweak type hints
* delint
* manual rebase
* WIP: Fixes for honeywell migration to climate-1.0 (#24938)
* add type hints
* code tidy-up
* Fixes for incomfort migration to climate-1.0 (#24936)
* delint type hints
* no async unless await
* revert: no async unless await
* revert: no async unless await 2
* delint
* fix typo
* Fix homekit_controller on climate-1.0 (#24948)
* Fix tests on climate-1.0 branch
* As part of climate-1.0, make state return the heating-cooling.current characteristic
* Fixes from review
* lint
* Fix imports
* Migrate stibel_eltron
* Fix lint
* Migrate coolmaster to climate 1.0 (#24967)
* Migrate coolmaster to climate 1.0
* fix lint errors
* More lint fixes
* Fix demo to work with UI
* Migrate spider
* Demo update
* Updated frontend to 20190705.0
* Fix boost mode (#24980)
* Prepare Netatmo for climate 1.0 (#24973)
* Migration Netatmo
* Address comments
* Update climate.py
* Migrate ephember
* Migrate Sensibo
* Implemented review comments (#24942)
* Migrate ESPHome
* Migrate MQTT
* Migrate Nest
* Migrate melissa
* Initial/partial migration of ST
* Migrate ST
* Remove Away mode (#24995)
* Migrate evohome, cache access tokens (#24491)
* add water_heater, add storage - initial commit
* add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
* Add Broker, Water Heater & Refactor
add missing code
desiderata
* update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
* bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
* support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
* store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
* update CODEOWNERS
* fix regression
* fix requirements
* migrate to climate-1.0
* tweaking
* de-lint
* TCS working? & delint
* tweaking
* TCS code finalised
* remove available() logic
* refactor _switchpoints()
* tidy up switchpoint code
* tweak
* teaking device_state_attributes
* some refactoring
* move PRESET_CUSTOM back to evohome
* move CONF_ACCESS_TOKEN_EXPIRES CONF_REFRESH_TOKEN back to evohome
* refactor SP code and dt conversion
* delinted
* delinted
* remove water_heater
* fix regression
* Migrate homekit
* Cleanup away mode
* Fix tests
* add helpers
* fix tests melissa
* Fix nehueat
* fix zwave
* add more tests
* fix deconz
* Fix climate test emulate_hue
* fix tests
* fix dyson tests
* fix demo with new layout
* fix honeywell
* Switch homekit_controller to use HVAC_MODE_HEAT_COOL instead of HVAC_MODE_AUTO (#25009)
* Lint
* PyLint
* Pylint
* fix fritzbox tests
* Fix google
* Fix all tests
* Fix lint
* Fix auto for homekit like controler
* Fix lint
* fix lint
2019-07-08 12:00:24 +00:00
|
|
|
import pytest
|
2019-04-25 08:14:16 +00:00
|
|
|
import voluptuous as vol
|
|
|
|
|
2020-08-28 04:59:49 +00:00
|
|
|
from homeassistant import config as hass_config
|
Climate 1.0 (#23899)
* Climate 1.0 / part 1/2/3
* fix flake
* Lint
* Update Google Assistant
* ambiclimate to climate 1.0 (#24911)
* Fix Alexa
* Lint
* Migrate zhong_hong
* Migrate tuya
* Migrate honeywell to new climate schema (#24257)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* Fix PRESET can be None
* apply PR#23913 from dev
* remove EU component, etc.
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* apply PR#23913 from dev
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* delint, move debug code
* away preset now working
* code tidy-up
* code tidy-up 2
* code tidy-up 3
* address issues #18932, #15063
* address issues #18932, #15063 - 2/2
* refactor MODE_AUTO to MODE_HEAT_COOL and use F not C
* add low/high to set_temp
* add low/high to set_temp 2
* add low/high to set_temp - delint
* run HA scripts
* port changes from PR #24402
* manual rebase
* manual rebase 2
* delint
* minor change
* remove SUPPORT_HVAC_ACTION
* Migrate radiotherm
* Convert touchline
* Migrate flexit
* Migrate nuheat
* Migrate maxcube
* Fix names maxcube const
* Migrate proliphix
* Migrate heatmiser
* Migrate fritzbox
* Migrate opentherm_gw
* Migrate venstar
* Migrate daikin
* Migrate modbus
* Fix elif
* Migrate Homematic IP Cloud to climate-1.0 (#24913)
* hmip climate fix
* Update hvac_mode and preset_mode
* fix lint
* Fix lint
* Migrate generic_thermostat
* Migrate incomfort to new climate schema (#24915)
* initial commit
* Update climate.py
* Migrate eq3btsmart
* Lint
* cleanup PRESET_MANUAL
* Migrate ecobee
* No conditional features
* KNX: Migrate climate component to new climate platform (#24931)
* Migrate climate component
* Remove unused code
* Corrected line length
* Lint
* Lint
* fix tests
* Fix value
* Migrate geniushub to new climate schema (#24191)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* delinted
* delinted
* use latest client
* clean up mappings
* clean up mappings
* add duration to set_temperature
* add duration to set_temperature
* manual rebase
* tweak
* fix regression
* small fix
* fix rebase mixup
* address comments
* finish refactor
* fix regression
* tweak type hints
* delint
* manual rebase
* WIP: Fixes for honeywell migration to climate-1.0 (#24938)
* add type hints
* code tidy-up
* Fixes for incomfort migration to climate-1.0 (#24936)
* delint type hints
* no async unless await
* revert: no async unless await
* revert: no async unless await 2
* delint
* fix typo
* Fix homekit_controller on climate-1.0 (#24948)
* Fix tests on climate-1.0 branch
* As part of climate-1.0, make state return the heating-cooling.current characteristic
* Fixes from review
* lint
* Fix imports
* Migrate stibel_eltron
* Fix lint
* Migrate coolmaster to climate 1.0 (#24967)
* Migrate coolmaster to climate 1.0
* fix lint errors
* More lint fixes
* Fix demo to work with UI
* Migrate spider
* Demo update
* Updated frontend to 20190705.0
* Fix boost mode (#24980)
* Prepare Netatmo for climate 1.0 (#24973)
* Migration Netatmo
* Address comments
* Update climate.py
* Migrate ephember
* Migrate Sensibo
* Implemented review comments (#24942)
* Migrate ESPHome
* Migrate MQTT
* Migrate Nest
* Migrate melissa
* Initial/partial migration of ST
* Migrate ST
* Remove Away mode (#24995)
* Migrate evohome, cache access tokens (#24491)
* add water_heater, add storage - initial commit
* add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
* Add Broker, Water Heater & Refactor
add missing code
desiderata
* update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
* bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
* support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
* store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
* update CODEOWNERS
* fix regression
* fix requirements
* migrate to climate-1.0
* tweaking
* de-lint
* TCS working? & delint
* tweaking
* TCS code finalised
* remove available() logic
* refactor _switchpoints()
* tidy up switchpoint code
* tweak
* teaking device_state_attributes
* some refactoring
* move PRESET_CUSTOM back to evohome
* move CONF_ACCESS_TOKEN_EXPIRES CONF_REFRESH_TOKEN back to evohome
* refactor SP code and dt conversion
* delinted
* delinted
* remove water_heater
* fix regression
* Migrate homekit
* Cleanup away mode
* Fix tests
* add helpers
* fix tests melissa
* Fix nehueat
* fix zwave
* add more tests
* fix deconz
* Fix climate test emulate_hue
* fix tests
* fix dyson tests
* fix demo with new layout
* fix honeywell
* Switch homekit_controller to use HVAC_MODE_HEAT_COOL instead of HVAC_MODE_AUTO (#25009)
* Lint
* PyLint
* Pylint
* fix fritzbox tests
* Fix google
* Fix all tests
* Fix lint
* Fix auto for homekit like controler
* Fix lint
* fix lint
2019-07-08 12:00:24 +00:00
|
|
|
from homeassistant.components import input_boolean, switch
|
2022-09-21 16:57:41 +00:00
|
|
|
from homeassistant.components.climate import (
|
2019-07-31 19:25:30 +00:00
|
|
|
ATTR_PRESET_MODE,
|
|
|
|
DOMAIN,
|
2021-12-24 00:29:29 +00:00
|
|
|
PRESET_ACTIVITY,
|
2019-07-31 19:25:30 +00:00
|
|
|
PRESET_AWAY,
|
2021-12-24 00:29:29 +00:00
|
|
|
PRESET_COMFORT,
|
|
|
|
PRESET_HOME,
|
2019-07-31 19:25:30 +00:00
|
|
|
PRESET_NONE,
|
2021-12-24 00:29:29 +00:00
|
|
|
PRESET_SLEEP,
|
2022-04-25 08:58:05 +00:00
|
|
|
HVACMode,
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
2020-08-28 04:59:49 +00:00
|
|
|
from homeassistant.components.generic_thermostat import (
|
|
|
|
DOMAIN as GENERIC_THERMOSTAT_DOMAIN,
|
|
|
|
)
|
Climate 1.0 (#23899)
* Climate 1.0 / part 1/2/3
* fix flake
* Lint
* Update Google Assistant
* ambiclimate to climate 1.0 (#24911)
* Fix Alexa
* Lint
* Migrate zhong_hong
* Migrate tuya
* Migrate honeywell to new climate schema (#24257)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* Fix PRESET can be None
* apply PR#23913 from dev
* remove EU component, etc.
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* apply PR#23913 from dev
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* delint, move debug code
* away preset now working
* code tidy-up
* code tidy-up 2
* code tidy-up 3
* address issues #18932, #15063
* address issues #18932, #15063 - 2/2
* refactor MODE_AUTO to MODE_HEAT_COOL and use F not C
* add low/high to set_temp
* add low/high to set_temp 2
* add low/high to set_temp - delint
* run HA scripts
* port changes from PR #24402
* manual rebase
* manual rebase 2
* delint
* minor change
* remove SUPPORT_HVAC_ACTION
* Migrate radiotherm
* Convert touchline
* Migrate flexit
* Migrate nuheat
* Migrate maxcube
* Fix names maxcube const
* Migrate proliphix
* Migrate heatmiser
* Migrate fritzbox
* Migrate opentherm_gw
* Migrate venstar
* Migrate daikin
* Migrate modbus
* Fix elif
* Migrate Homematic IP Cloud to climate-1.0 (#24913)
* hmip climate fix
* Update hvac_mode and preset_mode
* fix lint
* Fix lint
* Migrate generic_thermostat
* Migrate incomfort to new climate schema (#24915)
* initial commit
* Update climate.py
* Migrate eq3btsmart
* Lint
* cleanup PRESET_MANUAL
* Migrate ecobee
* No conditional features
* KNX: Migrate climate component to new climate platform (#24931)
* Migrate climate component
* Remove unused code
* Corrected line length
* Lint
* Lint
* fix tests
* Fix value
* Migrate geniushub to new climate schema (#24191)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* delinted
* delinted
* use latest client
* clean up mappings
* clean up mappings
* add duration to set_temperature
* add duration to set_temperature
* manual rebase
* tweak
* fix regression
* small fix
* fix rebase mixup
* address comments
* finish refactor
* fix regression
* tweak type hints
* delint
* manual rebase
* WIP: Fixes for honeywell migration to climate-1.0 (#24938)
* add type hints
* code tidy-up
* Fixes for incomfort migration to climate-1.0 (#24936)
* delint type hints
* no async unless await
* revert: no async unless await
* revert: no async unless await 2
* delint
* fix typo
* Fix homekit_controller on climate-1.0 (#24948)
* Fix tests on climate-1.0 branch
* As part of climate-1.0, make state return the heating-cooling.current characteristic
* Fixes from review
* lint
* Fix imports
* Migrate stibel_eltron
* Fix lint
* Migrate coolmaster to climate 1.0 (#24967)
* Migrate coolmaster to climate 1.0
* fix lint errors
* More lint fixes
* Fix demo to work with UI
* Migrate spider
* Demo update
* Updated frontend to 20190705.0
* Fix boost mode (#24980)
* Prepare Netatmo for climate 1.0 (#24973)
* Migration Netatmo
* Address comments
* Update climate.py
* Migrate ephember
* Migrate Sensibo
* Implemented review comments (#24942)
* Migrate ESPHome
* Migrate MQTT
* Migrate Nest
* Migrate melissa
* Initial/partial migration of ST
* Migrate ST
* Remove Away mode (#24995)
* Migrate evohome, cache access tokens (#24491)
* add water_heater, add storage - initial commit
* add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
* Add Broker, Water Heater & Refactor
add missing code
desiderata
* update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
* bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
* support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
* store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
* update CODEOWNERS
* fix regression
* fix requirements
* migrate to climate-1.0
* tweaking
* de-lint
* TCS working? & delint
* tweaking
* TCS code finalised
* remove available() logic
* refactor _switchpoints()
* tidy up switchpoint code
* tweak
* teaking device_state_attributes
* some refactoring
* move PRESET_CUSTOM back to evohome
* move CONF_ACCESS_TOKEN_EXPIRES CONF_REFRESH_TOKEN back to evohome
* refactor SP code and dt conversion
* delinted
* delinted
* remove water_heater
* fix regression
* Migrate homekit
* Cleanup away mode
* Fix tests
* add helpers
* fix tests melissa
* Fix nehueat
* fix zwave
* add more tests
* fix deconz
* Fix climate test emulate_hue
* fix tests
* fix dyson tests
* fix demo with new layout
* fix honeywell
* Switch homekit_controller to use HVAC_MODE_HEAT_COOL instead of HVAC_MODE_AUTO (#25009)
* Lint
* PyLint
* Pylint
* fix fritzbox tests
* Fix google
* Fix all tests
* Fix lint
* Fix auto for homekit like controler
* Fix lint
* fix lint
2019-07-08 12:00:24 +00:00
|
|
|
from homeassistant.const import (
|
2019-07-31 19:25:30 +00:00
|
|
|
ATTR_TEMPERATURE,
|
2020-08-28 04:59:49 +00:00
|
|
|
SERVICE_RELOAD,
|
2019-07-31 19:25:30 +00:00
|
|
|
SERVICE_TURN_OFF,
|
|
|
|
SERVICE_TURN_ON,
|
|
|
|
STATE_OFF,
|
|
|
|
STATE_ON,
|
2020-03-22 14:35:58 +00:00
|
|
|
STATE_UNAVAILABLE,
|
|
|
|
STATE_UNKNOWN,
|
2023-01-15 13:46:45 +00:00
|
|
|
UnitOfTemperature,
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
2017-03-04 17:42:43 +00:00
|
|
|
import homeassistant.core as ha
|
2023-02-08 12:33:52 +00:00
|
|
|
from homeassistant.core import (
|
|
|
|
DOMAIN as HASS_DOMAIN,
|
|
|
|
CoreState,
|
|
|
|
HomeAssistant,
|
|
|
|
State,
|
|
|
|
callback,
|
|
|
|
)
|
2021-03-09 13:31:17 +00:00
|
|
|
from homeassistant.helpers import entity_registry as er
|
2018-11-02 20:06:59 +00:00
|
|
|
from homeassistant.setup import async_setup_component
|
2021-05-08 05:46:26 +00:00
|
|
|
from homeassistant.util import dt as dt_util
|
2022-10-20 13:42:23 +00:00
|
|
|
from homeassistant.util.unit_system import METRIC_SYSTEM, US_CUSTOMARY_SYSTEM
|
Climate 1.0 (#23899)
* Climate 1.0 / part 1/2/3
* fix flake
* Lint
* Update Google Assistant
* ambiclimate to climate 1.0 (#24911)
* Fix Alexa
* Lint
* Migrate zhong_hong
* Migrate tuya
* Migrate honeywell to new climate schema (#24257)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* Fix PRESET can be None
* apply PR#23913 from dev
* remove EU component, etc.
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* apply PR#23913 from dev
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* delint, move debug code
* away preset now working
* code tidy-up
* code tidy-up 2
* code tidy-up 3
* address issues #18932, #15063
* address issues #18932, #15063 - 2/2
* refactor MODE_AUTO to MODE_HEAT_COOL and use F not C
* add low/high to set_temp
* add low/high to set_temp 2
* add low/high to set_temp - delint
* run HA scripts
* port changes from PR #24402
* manual rebase
* manual rebase 2
* delint
* minor change
* remove SUPPORT_HVAC_ACTION
* Migrate radiotherm
* Convert touchline
* Migrate flexit
* Migrate nuheat
* Migrate maxcube
* Fix names maxcube const
* Migrate proliphix
* Migrate heatmiser
* Migrate fritzbox
* Migrate opentherm_gw
* Migrate venstar
* Migrate daikin
* Migrate modbus
* Fix elif
* Migrate Homematic IP Cloud to climate-1.0 (#24913)
* hmip climate fix
* Update hvac_mode and preset_mode
* fix lint
* Fix lint
* Migrate generic_thermostat
* Migrate incomfort to new climate schema (#24915)
* initial commit
* Update climate.py
* Migrate eq3btsmart
* Lint
* cleanup PRESET_MANUAL
* Migrate ecobee
* No conditional features
* KNX: Migrate climate component to new climate platform (#24931)
* Migrate climate component
* Remove unused code
* Corrected line length
* Lint
* Lint
* fix tests
* Fix value
* Migrate geniushub to new climate schema (#24191)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* delinted
* delinted
* use latest client
* clean up mappings
* clean up mappings
* add duration to set_temperature
* add duration to set_temperature
* manual rebase
* tweak
* fix regression
* small fix
* fix rebase mixup
* address comments
* finish refactor
* fix regression
* tweak type hints
* delint
* manual rebase
* WIP: Fixes for honeywell migration to climate-1.0 (#24938)
* add type hints
* code tidy-up
* Fixes for incomfort migration to climate-1.0 (#24936)
* delint type hints
* no async unless await
* revert: no async unless await
* revert: no async unless await 2
* delint
* fix typo
* Fix homekit_controller on climate-1.0 (#24948)
* Fix tests on climate-1.0 branch
* As part of climate-1.0, make state return the heating-cooling.current characteristic
* Fixes from review
* lint
* Fix imports
* Migrate stibel_eltron
* Fix lint
* Migrate coolmaster to climate 1.0 (#24967)
* Migrate coolmaster to climate 1.0
* fix lint errors
* More lint fixes
* Fix demo to work with UI
* Migrate spider
* Demo update
* Updated frontend to 20190705.0
* Fix boost mode (#24980)
* Prepare Netatmo for climate 1.0 (#24973)
* Migration Netatmo
* Address comments
* Update climate.py
* Migrate ephember
* Migrate Sensibo
* Implemented review comments (#24942)
* Migrate ESPHome
* Migrate MQTT
* Migrate Nest
* Migrate melissa
* Initial/partial migration of ST
* Migrate ST
* Remove Away mode (#24995)
* Migrate evohome, cache access tokens (#24491)
* add water_heater, add storage - initial commit
* add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
* Add Broker, Water Heater & Refactor
add missing code
desiderata
* update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
* bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
* support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
* store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
* update CODEOWNERS
* fix regression
* fix requirements
* migrate to climate-1.0
* tweaking
* de-lint
* TCS working? & delint
* tweaking
* TCS code finalised
* remove available() logic
* refactor _switchpoints()
* tidy up switchpoint code
* tweak
* teaking device_state_attributes
* some refactoring
* move PRESET_CUSTOM back to evohome
* move CONF_ACCESS_TOKEN_EXPIRES CONF_REFRESH_TOKEN back to evohome
* refactor SP code and dt conversion
* delinted
* delinted
* remove water_heater
* fix regression
* Migrate homekit
* Cleanup away mode
* Fix tests
* add helpers
* fix tests melissa
* Fix nehueat
* fix zwave
* add more tests
* fix deconz
* Fix climate test emulate_hue
* fix tests
* fix dyson tests
* fix demo with new layout
* fix honeywell
* Switch homekit_controller to use HVAC_MODE_HEAT_COOL instead of HVAC_MODE_AUTO (#25009)
* Lint
* PyLint
* Pylint
* fix fritzbox tests
* Fix google
* Fix all tests
* Fix lint
* Fix auto for homekit like controler
* Fix lint
* fix lint
2019-07-08 12:00:24 +00:00
|
|
|
|
2020-06-29 16:39:24 +00:00
|
|
|
from tests.common import (
|
|
|
|
assert_setup_component,
|
|
|
|
async_fire_time_changed,
|
2021-09-13 20:27:06 +00:00
|
|
|
async_mock_service,
|
2021-11-02 03:47:05 +00:00
|
|
|
get_fixture_path,
|
2020-06-29 16:39:24 +00:00
|
|
|
mock_restore_cache,
|
|
|
|
)
|
2018-09-26 07:49:55 +00:00
|
|
|
from tests.components.climate import common
|
2016-08-19 07:17:28 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
ENTITY = "climate.test"
|
|
|
|
ENT_SENSOR = "sensor.test"
|
|
|
|
ENT_SWITCH = "switch.test"
|
|
|
|
HEAT_ENTITY = "climate.test_heat"
|
|
|
|
COOL_ENTITY = "climate.test_cool"
|
|
|
|
ATTR_AWAY_MODE = "away_mode"
|
2016-08-19 07:17:28 +00:00
|
|
|
MIN_TEMP = 3.0
|
|
|
|
MAX_TEMP = 65.0
|
|
|
|
TARGET_TEMP = 42.0
|
2017-10-31 13:06:34 +00:00
|
|
|
COLD_TOLERANCE = 0.5
|
|
|
|
HOT_TOLERANCE = 0.5
|
2022-04-19 22:19:59 +00:00
|
|
|
TARGET_TEMP_STEP = 0.5
|
2016-08-19 07:17:28 +00:00
|
|
|
|
|
|
|
|
2023-02-08 12:33:52 +00:00
|
|
|
async def test_setup_missing_conf(hass: HomeAssistant) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test set up heat_control with missing config values."""
|
|
|
|
config = {
|
2019-07-31 19:25:30 +00:00
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "test",
|
|
|
|
"target_sensor": ENT_SENSOR,
|
2018-11-02 20:06:59 +00:00
|
|
|
}
|
|
|
|
with assert_setup_component(0):
|
2019-07-31 19:25:30 +00:00
|
|
|
await async_setup_component(hass, "climate", {"climate": config})
|
2016-08-19 07:17:28 +00:00
|
|
|
|
|
|
|
|
2023-02-08 12:33:52 +00:00
|
|
|
async def test_valid_conf(hass: HomeAssistant) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test set up generic_thermostat with valid config values."""
|
2019-07-31 19:25:30 +00:00
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
"climate",
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "test",
|
|
|
|
"heater": ENT_SWITCH,
|
|
|
|
"target_sensor": ENT_SENSOR,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
2016-08-19 07:17:28 +00:00
|
|
|
|
|
|
|
|
2018-11-02 20:06:59 +00:00
|
|
|
@pytest.fixture
|
2020-06-01 05:18:30 +00:00
|
|
|
async def setup_comp_1(hass):
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Initialize components."""
|
|
|
|
hass.config.units = METRIC_SYSTEM
|
2020-06-01 05:18:30 +00:00
|
|
|
assert await async_setup_component(hass, "homeassistant", {})
|
|
|
|
await hass.async_block_till_done()
|
2017-11-17 11:47:54 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_heater_input_boolean(hass: HomeAssistant, setup_comp_1) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test heater switching input_boolean."""
|
2019-07-31 19:25:30 +00:00
|
|
|
heater_switch = "input_boolean.test"
|
|
|
|
assert await async_setup_component(
|
|
|
|
hass, input_boolean.DOMAIN, {"input_boolean": {"test": None}}
|
|
|
|
)
|
2017-11-17 11:47:54 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
DOMAIN,
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "test",
|
|
|
|
"heater": heater_switch,
|
|
|
|
"target_sensor": ENT_SENSOR,
|
2022-04-25 08:58:05 +00:00
|
|
|
"initial_hvac_mode": HVACMode.HEAT,
|
2019-07-31 19:25:30 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
2020-06-01 05:18:30 +00:00
|
|
|
await hass.async_block_till_done()
|
2017-11-17 11:47:54 +00:00
|
|
|
|
2021-03-20 12:55:10 +00:00
|
|
|
assert hass.states.get(heater_switch).state == STATE_OFF
|
2017-11-17 11:47:54 +00:00
|
|
|
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 18)
|
|
|
|
await hass.async_block_till_done()
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 23)
|
2023-06-16 14:01:40 +00:00
|
|
|
await hass.async_block_till_done()
|
2017-11-17 11:47:54 +00:00
|
|
|
|
2021-03-20 12:55:10 +00:00
|
|
|
assert hass.states.get(heater_switch).state == STATE_ON
|
2017-11-17 11:47:54 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_heater_switch(
|
|
|
|
hass: HomeAssistant, setup_comp_1, enable_custom_integrations: None
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test heater switching test switch."""
|
2019-07-31 19:25:30 +00:00
|
|
|
platform = getattr(hass.components, "test.switch")
|
2018-11-02 20:06:59 +00:00
|
|
|
platform.init()
|
2019-09-15 07:50:17 +00:00
|
|
|
switch_1 = platform.ENTITIES[1]
|
2019-07-31 19:25:30 +00:00
|
|
|
assert await async_setup_component(
|
|
|
|
hass, switch.DOMAIN, {"switch": {"platform": "test"}}
|
|
|
|
)
|
2020-06-01 05:18:30 +00:00
|
|
|
await hass.async_block_till_done()
|
2018-11-02 20:06:59 +00:00
|
|
|
heater_switch = switch_1.entity_id
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
DOMAIN,
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "test",
|
|
|
|
"heater": heater_switch,
|
|
|
|
"target_sensor": ENT_SENSOR,
|
2022-04-25 08:58:05 +00:00
|
|
|
"initial_hvac_mode": HVACMode.HEAT,
|
2019-07-31 19:25:30 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
2017-11-17 11:47:54 +00:00
|
|
|
|
2019-04-11 08:26:36 +00:00
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert hass.states.get(heater_switch).state == STATE_OFF
|
2017-11-17 11:47:54 +00:00
|
|
|
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 18)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 23)
|
2018-11-02 20:06:59 +00:00
|
|
|
await hass.async_block_till_done()
|
2017-11-17 11:47:54 +00:00
|
|
|
|
2021-03-20 12:55:10 +00:00
|
|
|
assert hass.states.get(heater_switch).state == STATE_ON
|
2017-11-17 11:47:54 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_unique_id(hass: HomeAssistant, setup_comp_1) -> None:
|
2023-10-06 18:15:40 +00:00
|
|
|
"""Test setting a unique ID."""
|
2021-02-11 19:46:58 +00:00
|
|
|
unique_id = "some_unique_id"
|
|
|
|
_setup_sensor(hass, 18)
|
|
|
|
_setup_switch(hass, True)
|
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
DOMAIN,
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "test",
|
|
|
|
"heater": ENT_SWITCH,
|
|
|
|
"target_sensor": ENT_SENSOR,
|
|
|
|
"unique_id": unique_id,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
2021-03-09 13:31:17 +00:00
|
|
|
entity_registry = er.async_get(hass)
|
2021-02-11 19:46:58 +00:00
|
|
|
|
|
|
|
entry = entity_registry.async_get(ENTITY)
|
|
|
|
assert entry
|
|
|
|
assert entry.unique_id == unique_id
|
|
|
|
|
|
|
|
|
2018-11-02 20:06:59 +00:00
|
|
|
def _setup_sensor(hass, temp):
|
|
|
|
"""Set up the test sensor."""
|
|
|
|
hass.states.async_set(ENT_SENSOR, temp)
|
2016-08-19 07:17:28 +00:00
|
|
|
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
@pytest.fixture
|
2020-06-01 05:18:30 +00:00
|
|
|
async def setup_comp_2(hass):
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Initialize components."""
|
|
|
|
hass.config.units = METRIC_SYSTEM
|
2020-06-01 05:18:30 +00:00
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
DOMAIN,
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "test",
|
|
|
|
"cold_tolerance": 2,
|
|
|
|
"hot_tolerance": 4,
|
|
|
|
"heater": ENT_SWITCH,
|
|
|
|
"target_sensor": ENT_SENSOR,
|
|
|
|
"away_temp": 16,
|
2021-12-24 00:29:29 +00:00
|
|
|
"sleep_temp": 17,
|
|
|
|
"home_temp": 19,
|
|
|
|
"comfort_temp": 20,
|
|
|
|
"activity_temp": 21,
|
2022-04-25 08:58:05 +00:00
|
|
|
"initial_hvac_mode": HVACMode.HEAT,
|
2020-06-01 05:18:30 +00:00
|
|
|
}
|
|
|
|
},
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
2020-06-01 05:18:30 +00:00
|
|
|
await hass.async_block_till_done()
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-08 12:33:52 +00:00
|
|
|
async def test_setup_defaults_to_unknown(hass: HomeAssistant) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test the setting of defaults to unknown."""
|
Climate 1.0 (#23899)
* Climate 1.0 / part 1/2/3
* fix flake
* Lint
* Update Google Assistant
* ambiclimate to climate 1.0 (#24911)
* Fix Alexa
* Lint
* Migrate zhong_hong
* Migrate tuya
* Migrate honeywell to new climate schema (#24257)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* Fix PRESET can be None
* apply PR#23913 from dev
* remove EU component, etc.
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* apply PR#23913 from dev
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* delint, move debug code
* away preset now working
* code tidy-up
* code tidy-up 2
* code tidy-up 3
* address issues #18932, #15063
* address issues #18932, #15063 - 2/2
* refactor MODE_AUTO to MODE_HEAT_COOL and use F not C
* add low/high to set_temp
* add low/high to set_temp 2
* add low/high to set_temp - delint
* run HA scripts
* port changes from PR #24402
* manual rebase
* manual rebase 2
* delint
* minor change
* remove SUPPORT_HVAC_ACTION
* Migrate radiotherm
* Convert touchline
* Migrate flexit
* Migrate nuheat
* Migrate maxcube
* Fix names maxcube const
* Migrate proliphix
* Migrate heatmiser
* Migrate fritzbox
* Migrate opentherm_gw
* Migrate venstar
* Migrate daikin
* Migrate modbus
* Fix elif
* Migrate Homematic IP Cloud to climate-1.0 (#24913)
* hmip climate fix
* Update hvac_mode and preset_mode
* fix lint
* Fix lint
* Migrate generic_thermostat
* Migrate incomfort to new climate schema (#24915)
* initial commit
* Update climate.py
* Migrate eq3btsmart
* Lint
* cleanup PRESET_MANUAL
* Migrate ecobee
* No conditional features
* KNX: Migrate climate component to new climate platform (#24931)
* Migrate climate component
* Remove unused code
* Corrected line length
* Lint
* Lint
* fix tests
* Fix value
* Migrate geniushub to new climate schema (#24191)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* delinted
* delinted
* use latest client
* clean up mappings
* clean up mappings
* add duration to set_temperature
* add duration to set_temperature
* manual rebase
* tweak
* fix regression
* small fix
* fix rebase mixup
* address comments
* finish refactor
* fix regression
* tweak type hints
* delint
* manual rebase
* WIP: Fixes for honeywell migration to climate-1.0 (#24938)
* add type hints
* code tidy-up
* Fixes for incomfort migration to climate-1.0 (#24936)
* delint type hints
* no async unless await
* revert: no async unless await
* revert: no async unless await 2
* delint
* fix typo
* Fix homekit_controller on climate-1.0 (#24948)
* Fix tests on climate-1.0 branch
* As part of climate-1.0, make state return the heating-cooling.current characteristic
* Fixes from review
* lint
* Fix imports
* Migrate stibel_eltron
* Fix lint
* Migrate coolmaster to climate 1.0 (#24967)
* Migrate coolmaster to climate 1.0
* fix lint errors
* More lint fixes
* Fix demo to work with UI
* Migrate spider
* Demo update
* Updated frontend to 20190705.0
* Fix boost mode (#24980)
* Prepare Netatmo for climate 1.0 (#24973)
* Migration Netatmo
* Address comments
* Update climate.py
* Migrate ephember
* Migrate Sensibo
* Implemented review comments (#24942)
* Migrate ESPHome
* Migrate MQTT
* Migrate Nest
* Migrate melissa
* Initial/partial migration of ST
* Migrate ST
* Remove Away mode (#24995)
* Migrate evohome, cache access tokens (#24491)
* add water_heater, add storage - initial commit
* add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
* Add Broker, Water Heater & Refactor
add missing code
desiderata
* update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
* bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
* support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
* store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
* update CODEOWNERS
* fix regression
* fix requirements
* migrate to climate-1.0
* tweaking
* de-lint
* TCS working? & delint
* tweaking
* TCS code finalised
* remove available() logic
* refactor _switchpoints()
* tidy up switchpoint code
* tweak
* teaking device_state_attributes
* some refactoring
* move PRESET_CUSTOM back to evohome
* move CONF_ACCESS_TOKEN_EXPIRES CONF_REFRESH_TOKEN back to evohome
* refactor SP code and dt conversion
* delinted
* delinted
* remove water_heater
* fix regression
* Migrate homekit
* Cleanup away mode
* Fix tests
* add helpers
* fix tests melissa
* Fix nehueat
* fix zwave
* add more tests
* fix deconz
* Fix climate test emulate_hue
* fix tests
* fix dyson tests
* fix demo with new layout
* fix honeywell
* Switch homekit_controller to use HVAC_MODE_HEAT_COOL instead of HVAC_MODE_AUTO (#25009)
* Lint
* PyLint
* Pylint
* fix fritzbox tests
* Fix google
* Fix all tests
* Fix lint
* Fix auto for homekit like controler
* Fix lint
* fix lint
2019-07-08 12:00:24 +00:00
|
|
|
hass.config.units = METRIC_SYSTEM
|
|
|
|
await async_setup_component(
|
2019-07-31 19:25:30 +00:00
|
|
|
hass,
|
|
|
|
DOMAIN,
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "test",
|
|
|
|
"cold_tolerance": 2,
|
|
|
|
"hot_tolerance": 4,
|
|
|
|
"heater": ENT_SWITCH,
|
|
|
|
"target_sensor": ENT_SENSOR,
|
|
|
|
"away_temp": 16,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
2020-06-01 05:18:30 +00:00
|
|
|
await hass.async_block_till_done()
|
2022-04-25 08:58:05 +00:00
|
|
|
assert hass.states.get(ENTITY).state == HVACMode.OFF
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-08 12:33:52 +00:00
|
|
|
async def test_setup_gets_current_temp_from_sensor(hass: HomeAssistant) -> None:
|
2020-12-07 12:14:54 +00:00
|
|
|
"""Test that current temperature is updated on entity addition."""
|
|
|
|
hass.config.units = METRIC_SYSTEM
|
|
|
|
_setup_sensor(hass, 18)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
await async_setup_component(
|
|
|
|
hass,
|
|
|
|
DOMAIN,
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "test",
|
|
|
|
"cold_tolerance": 2,
|
|
|
|
"hot_tolerance": 4,
|
|
|
|
"heater": ENT_SWITCH,
|
|
|
|
"target_sensor": ENT_SENSOR,
|
|
|
|
"away_temp": 16,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
assert hass.states.get(ENTITY).attributes["current_temperature"] == 18
|
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_default_setup_params(hass: HomeAssistant, setup_comp_2) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test the setup with default parameters."""
|
|
|
|
state = hass.states.get(ENTITY)
|
2021-03-20 12:55:10 +00:00
|
|
|
assert state.attributes.get("min_temp") == 7
|
|
|
|
assert state.attributes.get("max_temp") == 35
|
|
|
|
assert state.attributes.get("temperature") == 7
|
2022-04-19 22:19:59 +00:00
|
|
|
assert state.attributes.get("target_temp_step") == 0.1
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_get_hvac_modes(hass: HomeAssistant, setup_comp_2) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test that the operation list returns the correct modes."""
|
|
|
|
state = hass.states.get(ENTITY)
|
2019-07-31 19:25:30 +00:00
|
|
|
modes = state.attributes.get("hvac_modes")
|
2022-04-25 08:58:05 +00:00
|
|
|
assert modes == [HVACMode.HEAT, HVACMode.OFF]
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_set_target_temp(hass: HomeAssistant, setup_comp_2) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test the setting of the target temperature."""
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 30)
|
2018-11-02 20:06:59 +00:00
|
|
|
state = hass.states.get(ENTITY)
|
2021-03-20 12:55:10 +00:00
|
|
|
assert state.attributes.get("temperature") == 30.0
|
2019-04-25 08:14:16 +00:00
|
|
|
with pytest.raises(vol.Invalid):
|
|
|
|
await common.async_set_temperature(hass, None)
|
2018-11-02 20:06:59 +00:00
|
|
|
state = hass.states.get(ENTITY)
|
2021-03-20 12:55:10 +00:00
|
|
|
assert state.attributes.get("temperature") == 30.0
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2021-12-24 00:29:29 +00:00
|
|
|
@pytest.mark.parametrize(
|
2023-02-15 13:09:50 +00:00
|
|
|
("preset", "temp"),
|
2021-12-24 00:29:29 +00:00
|
|
|
[
|
|
|
|
(PRESET_NONE, 23),
|
|
|
|
(PRESET_AWAY, 16),
|
|
|
|
(PRESET_COMFORT, 20),
|
|
|
|
(PRESET_HOME, 19),
|
|
|
|
(PRESET_SLEEP, 17),
|
|
|
|
(PRESET_ACTIVITY, 21),
|
|
|
|
],
|
|
|
|
)
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_set_away_mode(hass: HomeAssistant, setup_comp_2, preset, temp) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test the setting away mode."""
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 23)
|
2021-12-24 00:29:29 +00:00
|
|
|
await common.async_set_preset_mode(hass, preset)
|
2018-11-02 20:06:59 +00:00
|
|
|
state = hass.states.get(ENTITY)
|
2021-12-24 00:29:29 +00:00
|
|
|
assert state.attributes.get("temperature") == temp
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize(
|
2023-02-15 13:09:50 +00:00
|
|
|
("preset", "temp"),
|
2021-12-24 00:29:29 +00:00
|
|
|
[
|
|
|
|
(PRESET_NONE, 23),
|
|
|
|
(PRESET_AWAY, 16),
|
|
|
|
(PRESET_COMFORT, 20),
|
|
|
|
(PRESET_HOME, 19),
|
|
|
|
(PRESET_SLEEP, 17),
|
|
|
|
(PRESET_ACTIVITY, 21),
|
|
|
|
],
|
|
|
|
)
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_set_away_mode_and_restore_prev_temp(
|
|
|
|
hass: HomeAssistant, setup_comp_2, preset, temp
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test the setting and removing away mode.
|
|
|
|
|
|
|
|
Verify original temperature is restored.
|
|
|
|
"""
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 23)
|
2021-12-24 00:29:29 +00:00
|
|
|
await common.async_set_preset_mode(hass, preset)
|
2018-11-02 20:06:59 +00:00
|
|
|
state = hass.states.get(ENTITY)
|
2021-12-24 00:29:29 +00:00
|
|
|
assert state.attributes.get("temperature") == temp
|
2019-07-21 18:00:42 +00:00
|
|
|
await common.async_set_preset_mode(hass, PRESET_NONE)
|
2018-11-02 20:06:59 +00:00
|
|
|
state = hass.states.get(ENTITY)
|
2021-03-20 12:55:10 +00:00
|
|
|
assert state.attributes.get("temperature") == 23
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2021-12-24 00:29:29 +00:00
|
|
|
@pytest.mark.parametrize(
|
2023-02-15 13:09:50 +00:00
|
|
|
("preset", "temp"),
|
2021-12-24 00:29:29 +00:00
|
|
|
[
|
|
|
|
(PRESET_NONE, 23),
|
|
|
|
(PRESET_AWAY, 16),
|
|
|
|
(PRESET_COMFORT, 20),
|
|
|
|
(PRESET_HOME, 19),
|
|
|
|
(PRESET_SLEEP, 17),
|
|
|
|
(PRESET_ACTIVITY, 21),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
async def test_set_away_mode_twice_and_restore_prev_temp(
|
2023-02-13 08:53:09 +00:00
|
|
|
hass: HomeAssistant, setup_comp_2, preset, temp
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test the setting away mode twice in a row.
|
|
|
|
|
|
|
|
Verify original temperature is restored.
|
|
|
|
"""
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 23)
|
2021-12-24 00:29:29 +00:00
|
|
|
await common.async_set_preset_mode(hass, preset)
|
|
|
|
await common.async_set_preset_mode(hass, preset)
|
2018-11-02 20:06:59 +00:00
|
|
|
state = hass.states.get(ENTITY)
|
2021-12-24 00:29:29 +00:00
|
|
|
assert state.attributes.get("temperature") == temp
|
2019-07-21 18:00:42 +00:00
|
|
|
await common.async_set_preset_mode(hass, PRESET_NONE)
|
2018-11-02 20:06:59 +00:00
|
|
|
state = hass.states.get(ENTITY)
|
2021-03-20 12:55:10 +00:00
|
|
|
assert state.attributes.get("temperature") == 23
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_set_preset_mode_invalid(hass: HomeAssistant, setup_comp_2) -> None:
|
2021-09-04 20:17:57 +00:00
|
|
|
"""Test an invalid mode raises an error and ignore case when checking modes."""
|
|
|
|
await common.async_set_temperature(hass, 23)
|
|
|
|
await common.async_set_preset_mode(hass, "away")
|
|
|
|
state = hass.states.get(ENTITY)
|
|
|
|
assert state.attributes.get("preset_mode") == "away"
|
|
|
|
await common.async_set_preset_mode(hass, "none")
|
|
|
|
state = hass.states.get(ENTITY)
|
|
|
|
assert state.attributes.get("preset_mode") == "none"
|
|
|
|
with pytest.raises(ValueError):
|
|
|
|
await common.async_set_preset_mode(hass, "Sleep")
|
|
|
|
state = hass.states.get(ENTITY)
|
|
|
|
assert state.attributes.get("preset_mode") == "none"
|
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_sensor_bad_value(hass: HomeAssistant, setup_comp_2) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test sensor that have None as state."""
|
|
|
|
state = hass.states.get(ENTITY)
|
2019-07-31 19:25:30 +00:00
|
|
|
temp = state.attributes.get("current_temperature")
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
_setup_sensor(hass, None)
|
|
|
|
await hass.async_block_till_done()
|
2021-04-07 16:00:42 +00:00
|
|
|
state = hass.states.get(ENTITY)
|
|
|
|
assert state.attributes.get("current_temperature") == temp
|
2016-08-19 07:17:28 +00:00
|
|
|
|
2021-04-07 16:00:42 +00:00
|
|
|
_setup_sensor(hass, "inf")
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
state = hass.states.get(ENTITY)
|
|
|
|
assert state.attributes.get("current_temperature") == temp
|
|
|
|
|
|
|
|
_setup_sensor(hass, "nan")
|
|
|
|
await hass.async_block_till_done()
|
2018-11-02 20:06:59 +00:00
|
|
|
state = hass.states.get(ENTITY)
|
2021-04-07 16:00:42 +00:00
|
|
|
assert state.attributes.get("current_temperature") == temp
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-08 12:33:52 +00:00
|
|
|
async def test_sensor_unknown(hass: HomeAssistant) -> None:
|
2020-03-22 14:35:58 +00:00
|
|
|
"""Test when target sensor is Unknown."""
|
|
|
|
hass.states.async_set("sensor.unknown", STATE_UNKNOWN)
|
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
"climate",
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "unknown",
|
|
|
|
"heater": ENT_SWITCH,
|
|
|
|
"target_sensor": "sensor.unknown",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
2020-06-01 05:18:30 +00:00
|
|
|
await hass.async_block_till_done()
|
2020-03-22 14:35:58 +00:00
|
|
|
state = hass.states.get("climate.unknown")
|
|
|
|
assert state.attributes.get("current_temperature") is None
|
|
|
|
|
|
|
|
|
2023-02-08 12:33:52 +00:00
|
|
|
async def test_sensor_unavailable(hass: HomeAssistant) -> None:
|
2020-03-22 14:35:58 +00:00
|
|
|
"""Test when target sensor is Unavailable."""
|
|
|
|
hass.states.async_set("sensor.unavailable", STATE_UNAVAILABLE)
|
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
"climate",
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "unavailable",
|
|
|
|
"heater": ENT_SWITCH,
|
|
|
|
"target_sensor": "sensor.unavailable",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
2020-06-01 05:18:30 +00:00
|
|
|
await hass.async_block_till_done()
|
2020-03-22 14:35:58 +00:00
|
|
|
state = hass.states.get("climate.unavailable")
|
|
|
|
assert state.attributes.get("current_temperature") is None
|
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_set_target_temp_heater_on(hass: HomeAssistant, setup_comp_2) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if target temperature turn heater on."""
|
|
|
|
calls = _setup_switch(hass, False)
|
|
|
|
_setup_sensor(hass, 25)
|
|
|
|
await hass.async_block_till_done()
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 30)
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_ON
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_set_target_temp_heater_off(hass: HomeAssistant, setup_comp_2) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if target temperature turn heater off."""
|
|
|
|
calls = _setup_switch(hass, True)
|
|
|
|
_setup_sensor(hass, 30)
|
|
|
|
await hass.async_block_till_done()
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 25)
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 2
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_OFF
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_temp_change_heater_on_within_tolerance(
|
|
|
|
hass: HomeAssistant, setup_comp_2
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if temperature change doesn't turn on within tolerance."""
|
|
|
|
calls = _setup_switch(hass, False)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 30)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 29)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_temp_change_heater_on_outside_tolerance(
|
|
|
|
hass: HomeAssistant, setup_comp_2
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if temperature change turn heater on outside cold tolerance."""
|
|
|
|
calls = _setup_switch(hass, False)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 30)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 27)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_ON
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_temp_change_heater_off_within_tolerance(
|
|
|
|
hass: HomeAssistant, setup_comp_2
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if temperature change doesn't turn off within tolerance."""
|
|
|
|
calls = _setup_switch(hass, True)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 30)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 33)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_temp_change_heater_off_outside_tolerance(
|
|
|
|
hass: HomeAssistant, setup_comp_2
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if temperature change turn heater off outside hot tolerance."""
|
|
|
|
calls = _setup_switch(hass, True)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 30)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 35)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_OFF
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_running_when_hvac_mode_is_off(hass: HomeAssistant, setup_comp_2) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test that the switch turns off when enabled is set False."""
|
|
|
|
calls = _setup_switch(hass, True)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 30)
|
2022-04-25 08:58:05 +00:00
|
|
|
await common.async_set_hvac_mode(hass, HVACMode.OFF)
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_OFF
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_no_state_change_when_hvac_mode_off(
|
|
|
|
hass: HomeAssistant, setup_comp_2
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test that the switch doesn't turn on when enabled is False."""
|
|
|
|
calls = _setup_switch(hass, False)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 30)
|
2022-04-25 08:58:05 +00:00
|
|
|
await common.async_set_hvac_mode(hass, HVACMode.OFF)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 25)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_hvac_mode_heat(hass: HomeAssistant, setup_comp_2) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test change mode from OFF to HEAT.
|
|
|
|
|
|
|
|
Switch turns on when temp below setpoint and mode changes.
|
|
|
|
"""
|
2022-04-25 08:58:05 +00:00
|
|
|
await common.async_set_hvac_mode(hass, HVACMode.OFF)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 30)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 25)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
calls = _setup_switch(hass, False)
|
2022-04-25 08:58:05 +00:00
|
|
|
await common.async_set_hvac_mode(hass, HVACMode.HEAT)
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_ON
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
def _setup_switch(hass, is_on):
|
|
|
|
"""Set up the test switch."""
|
|
|
|
hass.states.async_set(ENT_SWITCH, STATE_ON if is_on else STATE_OFF)
|
|
|
|
calls = []
|
|
|
|
|
|
|
|
@callback
|
|
|
|
def log_call(call):
|
|
|
|
"""Log service calls."""
|
|
|
|
calls.append(call)
|
|
|
|
|
|
|
|
hass.services.async_register(ha.DOMAIN, SERVICE_TURN_ON, log_call)
|
|
|
|
hass.services.async_register(ha.DOMAIN, SERVICE_TURN_OFF, log_call)
|
|
|
|
|
|
|
|
return calls
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
2020-06-01 05:18:30 +00:00
|
|
|
async def setup_comp_3(hass):
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Initialize components."""
|
2023-01-15 13:46:45 +00:00
|
|
|
hass.config.temperature_unit = UnitOfTemperature.CELSIUS
|
2020-06-01 05:18:30 +00:00
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
DOMAIN,
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "test",
|
|
|
|
"cold_tolerance": 2,
|
|
|
|
"hot_tolerance": 4,
|
|
|
|
"away_temp": 30,
|
|
|
|
"heater": ENT_SWITCH,
|
|
|
|
"target_sensor": ENT_SENSOR,
|
|
|
|
"ac_mode": True,
|
2022-04-25 08:58:05 +00:00
|
|
|
"initial_hvac_mode": HVACMode.COOL,
|
2020-06-01 05:18:30 +00:00
|
|
|
}
|
|
|
|
},
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
2020-06-01 05:18:30 +00:00
|
|
|
await hass.async_block_till_done()
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_set_target_temp_ac_off(hass: HomeAssistant, setup_comp_3) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if target temperature turn ac off."""
|
|
|
|
calls = _setup_switch(hass, True)
|
|
|
|
_setup_sensor(hass, 25)
|
|
|
|
await hass.async_block_till_done()
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 30)
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 2
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_OFF
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_turn_away_mode_on_cooling(hass: HomeAssistant, setup_comp_3) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test the setting away mode when cooling."""
|
2019-04-25 08:14:16 +00:00
|
|
|
_setup_switch(hass, True)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 25)
|
|
|
|
await hass.async_block_till_done()
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 19)
|
Climate 1.0 (#23899)
* Climate 1.0 / part 1/2/3
* fix flake
* Lint
* Update Google Assistant
* ambiclimate to climate 1.0 (#24911)
* Fix Alexa
* Lint
* Migrate zhong_hong
* Migrate tuya
* Migrate honeywell to new climate schema (#24257)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* Fix PRESET can be None
* apply PR#23913 from dev
* remove EU component, etc.
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* apply PR#23913 from dev
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* delint, move debug code
* away preset now working
* code tidy-up
* code tidy-up 2
* code tidy-up 3
* address issues #18932, #15063
* address issues #18932, #15063 - 2/2
* refactor MODE_AUTO to MODE_HEAT_COOL and use F not C
* add low/high to set_temp
* add low/high to set_temp 2
* add low/high to set_temp - delint
* run HA scripts
* port changes from PR #24402
* manual rebase
* manual rebase 2
* delint
* minor change
* remove SUPPORT_HVAC_ACTION
* Migrate radiotherm
* Convert touchline
* Migrate flexit
* Migrate nuheat
* Migrate maxcube
* Fix names maxcube const
* Migrate proliphix
* Migrate heatmiser
* Migrate fritzbox
* Migrate opentherm_gw
* Migrate venstar
* Migrate daikin
* Migrate modbus
* Fix elif
* Migrate Homematic IP Cloud to climate-1.0 (#24913)
* hmip climate fix
* Update hvac_mode and preset_mode
* fix lint
* Fix lint
* Migrate generic_thermostat
* Migrate incomfort to new climate schema (#24915)
* initial commit
* Update climate.py
* Migrate eq3btsmart
* Lint
* cleanup PRESET_MANUAL
* Migrate ecobee
* No conditional features
* KNX: Migrate climate component to new climate platform (#24931)
* Migrate climate component
* Remove unused code
* Corrected line length
* Lint
* Lint
* fix tests
* Fix value
* Migrate geniushub to new climate schema (#24191)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* delinted
* delinted
* use latest client
* clean up mappings
* clean up mappings
* add duration to set_temperature
* add duration to set_temperature
* manual rebase
* tweak
* fix regression
* small fix
* fix rebase mixup
* address comments
* finish refactor
* fix regression
* tweak type hints
* delint
* manual rebase
* WIP: Fixes for honeywell migration to climate-1.0 (#24938)
* add type hints
* code tidy-up
* Fixes for incomfort migration to climate-1.0 (#24936)
* delint type hints
* no async unless await
* revert: no async unless await
* revert: no async unless await 2
* delint
* fix typo
* Fix homekit_controller on climate-1.0 (#24948)
* Fix tests on climate-1.0 branch
* As part of climate-1.0, make state return the heating-cooling.current characteristic
* Fixes from review
* lint
* Fix imports
* Migrate stibel_eltron
* Fix lint
* Migrate coolmaster to climate 1.0 (#24967)
* Migrate coolmaster to climate 1.0
* fix lint errors
* More lint fixes
* Fix demo to work with UI
* Migrate spider
* Demo update
* Updated frontend to 20190705.0
* Fix boost mode (#24980)
* Prepare Netatmo for climate 1.0 (#24973)
* Migration Netatmo
* Address comments
* Update climate.py
* Migrate ephember
* Migrate Sensibo
* Implemented review comments (#24942)
* Migrate ESPHome
* Migrate MQTT
* Migrate Nest
* Migrate melissa
* Initial/partial migration of ST
* Migrate ST
* Remove Away mode (#24995)
* Migrate evohome, cache access tokens (#24491)
* add water_heater, add storage - initial commit
* add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
* Add Broker, Water Heater & Refactor
add missing code
desiderata
* update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
* bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
* support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
* store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
* update CODEOWNERS
* fix regression
* fix requirements
* migrate to climate-1.0
* tweaking
* de-lint
* TCS working? & delint
* tweaking
* TCS code finalised
* remove available() logic
* refactor _switchpoints()
* tidy up switchpoint code
* tweak
* teaking device_state_attributes
* some refactoring
* move PRESET_CUSTOM back to evohome
* move CONF_ACCESS_TOKEN_EXPIRES CONF_REFRESH_TOKEN back to evohome
* refactor SP code and dt conversion
* delinted
* delinted
* remove water_heater
* fix regression
* Migrate homekit
* Cleanup away mode
* Fix tests
* add helpers
* fix tests melissa
* Fix nehueat
* fix zwave
* add more tests
* fix deconz
* Fix climate test emulate_hue
* fix tests
* fix dyson tests
* fix demo with new layout
* fix honeywell
* Switch homekit_controller to use HVAC_MODE_HEAT_COOL instead of HVAC_MODE_AUTO (#25009)
* Lint
* PyLint
* Pylint
* fix fritzbox tests
* Fix google
* Fix all tests
* Fix lint
* Fix auto for homekit like controler
* Fix lint
* fix lint
2019-07-08 12:00:24 +00:00
|
|
|
await common.async_set_preset_mode(hass, PRESET_AWAY)
|
2018-11-02 20:06:59 +00:00
|
|
|
state = hass.states.get(ENTITY)
|
2021-03-20 12:55:10 +00:00
|
|
|
assert state.attributes.get("temperature") == 30
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_hvac_mode_cool(hass: HomeAssistant, setup_comp_3) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test change mode from OFF to COOL.
|
2016-08-19 07:17:28 +00:00
|
|
|
|
2018-11-02 20:06:59 +00:00
|
|
|
Switch turns on when temp below setpoint and mode changes.
|
|
|
|
"""
|
2022-04-25 08:58:05 +00:00
|
|
|
await common.async_set_hvac_mode(hass, HVACMode.OFF)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 25)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 30)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
calls = _setup_switch(hass, False)
|
2022-04-25 08:58:05 +00:00
|
|
|
await common.async_set_hvac_mode(hass, HVACMode.COOL)
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_ON
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_set_target_temp_ac_on(hass: HomeAssistant, setup_comp_3) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if target temperature turn ac on."""
|
|
|
|
calls = _setup_switch(hass, False)
|
|
|
|
_setup_sensor(hass, 30)
|
|
|
|
await hass.async_block_till_done()
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 25)
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_ON
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_temp_change_ac_off_within_tolerance(
|
|
|
|
hass: HomeAssistant, setup_comp_3
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if temperature change doesn't turn ac off within tolerance."""
|
|
|
|
calls = _setup_switch(hass, True)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 30)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 29.8)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_set_temp_change_ac_off_outside_tolerance(
|
|
|
|
hass: HomeAssistant, setup_comp_3
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if temperature change turn ac off."""
|
|
|
|
calls = _setup_switch(hass, True)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 30)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 27)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_OFF
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_temp_change_ac_on_within_tolerance(
|
|
|
|
hass: HomeAssistant, setup_comp_3
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if temperature change doesn't turn ac on within tolerance."""
|
|
|
|
calls = _setup_switch(hass, False)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 25)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 25.2)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_temp_change_ac_on_outside_tolerance(
|
|
|
|
hass: HomeAssistant, setup_comp_3
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if temperature change turn ac on."""
|
|
|
|
calls = _setup_switch(hass, False)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 25)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 30)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_ON
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_running_when_operating_mode_is_off_2(
|
|
|
|
hass: HomeAssistant, setup_comp_3
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test that the switch turns off when enabled is set False."""
|
|
|
|
calls = _setup_switch(hass, True)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 30)
|
2022-04-25 08:58:05 +00:00
|
|
|
await common.async_set_hvac_mode(hass, HVACMode.OFF)
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_OFF
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_no_state_change_when_operation_mode_off_2(
|
|
|
|
hass: HomeAssistant, setup_comp_3
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test that the switch doesn't turn on when enabled is False."""
|
|
|
|
calls = _setup_switch(hass, False)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 30)
|
2022-04-25 08:58:05 +00:00
|
|
|
await common.async_set_hvac_mode(hass, HVACMode.OFF)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 35)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
2020-06-01 05:18:30 +00:00
|
|
|
async def setup_comp_4(hass):
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Initialize components."""
|
2023-01-15 13:46:45 +00:00
|
|
|
hass.config.temperature_unit = UnitOfTemperature.CELSIUS
|
2020-06-01 05:18:30 +00:00
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
DOMAIN,
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "test",
|
|
|
|
"cold_tolerance": 0.3,
|
|
|
|
"hot_tolerance": 0.3,
|
|
|
|
"heater": ENT_SWITCH,
|
|
|
|
"target_sensor": ENT_SENSOR,
|
|
|
|
"ac_mode": True,
|
|
|
|
"min_cycle_duration": datetime.timedelta(minutes=10),
|
2022-04-25 08:58:05 +00:00
|
|
|
"initial_hvac_mode": HVACMode.COOL,
|
2020-06-01 05:18:30 +00:00
|
|
|
}
|
|
|
|
},
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
2020-06-01 05:18:30 +00:00
|
|
|
await hass.async_block_till_done()
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_temp_change_ac_trigger_on_not_long_enough(
|
|
|
|
hass: HomeAssistant, setup_comp_4
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if temperature change turn ac on."""
|
|
|
|
calls = _setup_switch(hass, False)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 25)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 30)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_temp_change_ac_trigger_on_long_enough(
|
|
|
|
hass: HomeAssistant, setup_comp_4
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if temperature change turn ac on."""
|
2022-05-14 19:12:08 +00:00
|
|
|
fake_changed = datetime.datetime(1970, 11, 11, 11, 11, 11, tzinfo=dt_util.UTC)
|
2023-05-24 18:17:28 +00:00
|
|
|
with freeze_time(fake_changed):
|
2018-11-02 20:06:59 +00:00
|
|
|
calls = _setup_switch(hass, False)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 25)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 30)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_ON
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_temp_change_ac_trigger_off_not_long_enough(
|
|
|
|
hass: HomeAssistant, setup_comp_4
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if temperature change turn ac on."""
|
|
|
|
calls = _setup_switch(hass, True)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 30)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 25)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_temp_change_ac_trigger_off_long_enough(
|
|
|
|
hass: HomeAssistant, setup_comp_4
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if temperature change turn ac on."""
|
2022-05-14 19:12:08 +00:00
|
|
|
fake_changed = datetime.datetime(1970, 11, 11, 11, 11, 11, tzinfo=dt_util.UTC)
|
2023-05-24 18:17:28 +00:00
|
|
|
with freeze_time(fake_changed):
|
2018-11-02 20:06:59 +00:00
|
|
|
calls = _setup_switch(hass, True)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 30)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 25)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_OFF
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_mode_change_ac_trigger_off_not_long_enough(
|
|
|
|
hass: HomeAssistant, setup_comp_4
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if mode change turns ac off despite minimum cycle."""
|
|
|
|
calls = _setup_switch(hass, True)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 30)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 25)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2022-04-25 08:58:05 +00:00
|
|
|
await common.async_set_hvac_mode(hass, HVACMode.OFF)
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == "homeassistant"
|
|
|
|
assert call.service == SERVICE_TURN_OFF
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_mode_change_ac_trigger_on_not_long_enough(
|
|
|
|
hass: HomeAssistant, setup_comp_4
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if mode change turns ac on despite minimum cycle."""
|
|
|
|
calls = _setup_switch(hass, False)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 25)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 30)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2022-04-25 08:58:05 +00:00
|
|
|
await common.async_set_hvac_mode(hass, HVACMode.HEAT)
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == "homeassistant"
|
|
|
|
assert call.service == SERVICE_TURN_ON
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
2020-06-01 05:18:30 +00:00
|
|
|
async def setup_comp_5(hass):
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Initialize components."""
|
2023-01-15 13:46:45 +00:00
|
|
|
hass.config.temperature_unit = UnitOfTemperature.CELSIUS
|
2020-06-01 05:18:30 +00:00
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
DOMAIN,
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "test",
|
|
|
|
"cold_tolerance": 0.3,
|
|
|
|
"hot_tolerance": 0.3,
|
|
|
|
"heater": ENT_SWITCH,
|
|
|
|
"target_sensor": ENT_SENSOR,
|
|
|
|
"ac_mode": True,
|
|
|
|
"min_cycle_duration": datetime.timedelta(minutes=10),
|
2022-04-25 08:58:05 +00:00
|
|
|
"initial_hvac_mode": HVACMode.COOL,
|
2020-06-01 05:18:30 +00:00
|
|
|
}
|
|
|
|
},
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
2020-06-01 05:18:30 +00:00
|
|
|
await hass.async_block_till_done()
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_temp_change_ac_trigger_on_not_long_enough_2(
|
|
|
|
hass: HomeAssistant, setup_comp_5
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if temperature change turn ac on."""
|
|
|
|
calls = _setup_switch(hass, False)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 25)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 30)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_temp_change_ac_trigger_on_long_enough_2(
|
|
|
|
hass: HomeAssistant, setup_comp_5
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if temperature change turn ac on."""
|
2022-05-14 19:12:08 +00:00
|
|
|
fake_changed = datetime.datetime(1970, 11, 11, 11, 11, 11, tzinfo=dt_util.UTC)
|
2023-05-24 18:17:28 +00:00
|
|
|
with freeze_time(fake_changed):
|
2018-11-02 20:06:59 +00:00
|
|
|
calls = _setup_switch(hass, False)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 25)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 30)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_ON
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_temp_change_ac_trigger_off_not_long_enough_2(
|
|
|
|
hass: HomeAssistant, setup_comp_5
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if temperature change turn ac on."""
|
|
|
|
calls = _setup_switch(hass, True)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 30)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 25)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_temp_change_ac_trigger_off_long_enough_2(
|
|
|
|
hass: HomeAssistant, setup_comp_5
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if temperature change turn ac on."""
|
2022-05-14 19:12:08 +00:00
|
|
|
fake_changed = datetime.datetime(1970, 11, 11, 11, 11, 11, tzinfo=dt_util.UTC)
|
2023-05-24 18:17:28 +00:00
|
|
|
with freeze_time(fake_changed):
|
2018-11-02 20:06:59 +00:00
|
|
|
calls = _setup_switch(hass, True)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 30)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 25)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_OFF
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_mode_change_ac_trigger_off_not_long_enough_2(
|
|
|
|
hass: HomeAssistant, setup_comp_5
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if mode change turns ac off despite minimum cycle."""
|
|
|
|
calls = _setup_switch(hass, True)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 30)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 25)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2022-04-25 08:58:05 +00:00
|
|
|
await common.async_set_hvac_mode(hass, HVACMode.OFF)
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == "homeassistant"
|
|
|
|
assert call.service == SERVICE_TURN_OFF
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_mode_change_ac_trigger_on_not_long_enough_2(
|
|
|
|
hass: HomeAssistant, setup_comp_5
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if mode change turns ac on despite minimum cycle."""
|
|
|
|
calls = _setup_switch(hass, False)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 25)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 30)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2022-04-25 08:58:05 +00:00
|
|
|
await common.async_set_hvac_mode(hass, HVACMode.HEAT)
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == "homeassistant"
|
|
|
|
assert call.service == SERVICE_TURN_ON
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
2020-06-01 05:18:30 +00:00
|
|
|
async def setup_comp_6(hass):
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Initialize components."""
|
2023-01-15 13:46:45 +00:00
|
|
|
hass.config.temperature_unit = UnitOfTemperature.CELSIUS
|
2020-06-01 05:18:30 +00:00
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
DOMAIN,
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "test",
|
|
|
|
"cold_tolerance": 0.3,
|
|
|
|
"hot_tolerance": 0.3,
|
|
|
|
"heater": ENT_SWITCH,
|
|
|
|
"target_sensor": ENT_SENSOR,
|
|
|
|
"min_cycle_duration": datetime.timedelta(minutes=10),
|
2022-04-25 08:58:05 +00:00
|
|
|
"initial_hvac_mode": HVACMode.HEAT,
|
2020-06-01 05:18:30 +00:00
|
|
|
}
|
|
|
|
},
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
2020-06-01 05:18:30 +00:00
|
|
|
await hass.async_block_till_done()
|
2019-07-31 19:25:30 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_temp_change_heater_trigger_off_not_long_enough(
|
|
|
|
hass: HomeAssistant, setup_comp_6
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if temp change doesn't turn heater off because of time."""
|
|
|
|
calls = _setup_switch(hass, True)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 25)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 30)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_temp_change_heater_trigger_on_not_long_enough(
|
|
|
|
hass: HomeAssistant, setup_comp_6
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if temp change doesn't turn heater on because of time."""
|
|
|
|
calls = _setup_switch(hass, False)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 30)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 25)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_temp_change_heater_trigger_on_long_enough(
|
|
|
|
hass: HomeAssistant, setup_comp_6
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if temperature change turn heater on after min cycle."""
|
2022-05-14 19:12:08 +00:00
|
|
|
fake_changed = datetime.datetime(1970, 11, 11, 11, 11, 11, tzinfo=dt_util.UTC)
|
2023-05-24 18:17:28 +00:00
|
|
|
with freeze_time(fake_changed):
|
2018-11-02 20:06:59 +00:00
|
|
|
calls = _setup_switch(hass, False)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 30)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 25)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_ON
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_temp_change_heater_trigger_off_long_enough(
|
|
|
|
hass: HomeAssistant, setup_comp_6
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if temperature change turn heater off after min cycle."""
|
2022-05-14 19:12:08 +00:00
|
|
|
fake_changed = datetime.datetime(1970, 11, 11, 11, 11, 11, tzinfo=dt_util.UTC)
|
2023-05-24 18:17:28 +00:00
|
|
|
with freeze_time(fake_changed):
|
2018-11-02 20:06:59 +00:00
|
|
|
calls = _setup_switch(hass, True)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 25)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 30)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_OFF
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_mode_change_heater_trigger_off_not_long_enough(
|
|
|
|
hass: HomeAssistant, setup_comp_6
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if mode change turns heater off despite minimum cycle."""
|
|
|
|
calls = _setup_switch(hass, True)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 25)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 30)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2022-04-25 08:58:05 +00:00
|
|
|
await common.async_set_hvac_mode(hass, HVACMode.OFF)
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == "homeassistant"
|
|
|
|
assert call.service == SERVICE_TURN_OFF
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_mode_change_heater_trigger_on_not_long_enough(
|
|
|
|
hass: HomeAssistant, setup_comp_6
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if mode change turns heater on despite minimum cycle."""
|
|
|
|
calls = _setup_switch(hass, False)
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 30)
|
2018-11-02 20:06:59 +00:00
|
|
|
_setup_sensor(hass, 25)
|
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2022-04-25 08:58:05 +00:00
|
|
|
await common.async_set_hvac_mode(hass, HVACMode.HEAT)
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == "homeassistant"
|
|
|
|
assert call.service == SERVICE_TURN_ON
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
2020-06-01 05:18:30 +00:00
|
|
|
async def setup_comp_7(hass):
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Initialize components."""
|
2023-01-15 13:46:45 +00:00
|
|
|
hass.config.temperature_unit = UnitOfTemperature.CELSIUS
|
2020-06-01 05:18:30 +00:00
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
DOMAIN,
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "test",
|
|
|
|
"cold_tolerance": 0.3,
|
|
|
|
"hot_tolerance": 0.3,
|
|
|
|
"heater": ENT_SWITCH,
|
|
|
|
"target_temp": 25,
|
|
|
|
"target_sensor": ENT_SENSOR,
|
|
|
|
"ac_mode": True,
|
|
|
|
"min_cycle_duration": datetime.timedelta(minutes=15),
|
|
|
|
"keep_alive": datetime.timedelta(minutes=10),
|
2022-04-25 08:58:05 +00:00
|
|
|
"initial_hvac_mode": HVACMode.COOL,
|
2020-06-01 05:18:30 +00:00
|
|
|
}
|
|
|
|
},
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
2018-11-02 20:06:59 +00:00
|
|
|
|
2020-06-01 05:18:30 +00:00
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
2018-11-02 20:06:59 +00:00
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_temp_change_ac_trigger_on_long_enough_3(
|
|
|
|
hass: HomeAssistant, setup_comp_7
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if turn on signal is sent at keep-alive intervals."""
|
|
|
|
calls = _setup_switch(hass, True)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
_setup_sensor(hass, 30)
|
|
|
|
await hass.async_block_till_done()
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 25)
|
2021-05-08 05:46:26 +00:00
|
|
|
test_time = datetime.datetime.now(dt_util.UTC)
|
2020-06-29 16:39:24 +00:00
|
|
|
async_fire_time_changed(hass, test_time)
|
2018-11-02 20:06:59 +00:00
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2020-06-29 16:39:24 +00:00
|
|
|
async_fire_time_changed(hass, test_time + datetime.timedelta(minutes=5))
|
2018-11-02 20:06:59 +00:00
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2020-06-29 16:39:24 +00:00
|
|
|
async_fire_time_changed(hass, test_time + datetime.timedelta(minutes=10))
|
2018-11-02 20:06:59 +00:00
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_ON
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_temp_change_ac_trigger_off_long_enough_3(
|
|
|
|
hass: HomeAssistant, setup_comp_7
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if turn on signal is sent at keep-alive intervals."""
|
|
|
|
calls = _setup_switch(hass, False)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
_setup_sensor(hass, 20)
|
|
|
|
await hass.async_block_till_done()
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 25)
|
2021-05-08 05:46:26 +00:00
|
|
|
test_time = datetime.datetime.now(dt_util.UTC)
|
2020-06-29 16:39:24 +00:00
|
|
|
async_fire_time_changed(hass, test_time)
|
2018-11-02 20:06:59 +00:00
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2020-06-29 16:39:24 +00:00
|
|
|
async_fire_time_changed(hass, test_time + datetime.timedelta(minutes=5))
|
2018-11-02 20:06:59 +00:00
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2020-06-29 16:39:24 +00:00
|
|
|
async_fire_time_changed(hass, test_time + datetime.timedelta(minutes=10))
|
2018-11-02 20:06:59 +00:00
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_OFF
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
2020-06-01 05:18:30 +00:00
|
|
|
async def setup_comp_8(hass):
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Initialize components."""
|
2023-01-15 13:46:45 +00:00
|
|
|
hass.config.temperature_unit = UnitOfTemperature.CELSIUS
|
2020-06-01 05:18:30 +00:00
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
DOMAIN,
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "test",
|
|
|
|
"cold_tolerance": 0.3,
|
|
|
|
"hot_tolerance": 0.3,
|
|
|
|
"target_temp": 25,
|
|
|
|
"heater": ENT_SWITCH,
|
|
|
|
"target_sensor": ENT_SENSOR,
|
|
|
|
"min_cycle_duration": datetime.timedelta(minutes=15),
|
|
|
|
"keep_alive": datetime.timedelta(minutes=10),
|
2022-04-25 08:58:05 +00:00
|
|
|
"initial_hvac_mode": HVACMode.HEAT,
|
2020-06-01 05:18:30 +00:00
|
|
|
}
|
|
|
|
},
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
2020-06-01 05:18:30 +00:00
|
|
|
await hass.async_block_till_done()
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_temp_change_heater_trigger_on_long_enough_2(
|
|
|
|
hass: HomeAssistant, setup_comp_8
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if turn on signal is sent at keep-alive intervals."""
|
|
|
|
calls = _setup_switch(hass, True)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
_setup_sensor(hass, 20)
|
|
|
|
await hass.async_block_till_done()
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 25)
|
2021-05-08 05:46:26 +00:00
|
|
|
test_time = datetime.datetime.now(dt_util.UTC)
|
2020-06-29 16:39:24 +00:00
|
|
|
async_fire_time_changed(hass, test_time)
|
2018-11-02 20:06:59 +00:00
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2020-06-29 16:39:24 +00:00
|
|
|
async_fire_time_changed(hass, test_time + datetime.timedelta(minutes=5))
|
2018-11-02 20:06:59 +00:00
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2020-06-29 16:39:24 +00:00
|
|
|
async_fire_time_changed(hass, test_time + datetime.timedelta(minutes=10))
|
2018-11-02 20:06:59 +00:00
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_ON
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_temp_change_heater_trigger_off_long_enough_2(
|
|
|
|
hass: HomeAssistant, setup_comp_8
|
|
|
|
) -> None:
|
2018-11-02 20:06:59 +00:00
|
|
|
"""Test if turn on signal is sent at keep-alive intervals."""
|
|
|
|
calls = _setup_switch(hass, False)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
_setup_sensor(hass, 30)
|
|
|
|
await hass.async_block_till_done()
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 25)
|
2021-05-08 05:46:26 +00:00
|
|
|
test_time = datetime.datetime.now(dt_util.UTC)
|
2020-06-29 16:39:24 +00:00
|
|
|
async_fire_time_changed(hass, test_time)
|
2018-11-02 20:06:59 +00:00
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2020-06-29 16:39:24 +00:00
|
|
|
async_fire_time_changed(hass, test_time + datetime.timedelta(minutes=5))
|
2018-11-02 20:06:59 +00:00
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2020-06-29 16:39:24 +00:00
|
|
|
async_fire_time_changed(hass, test_time + datetime.timedelta(minutes=10))
|
2018-11-02 20:06:59 +00:00
|
|
|
await hass.async_block_till_done()
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 1
|
2018-11-02 20:06:59 +00:00
|
|
|
call = calls[0]
|
2021-03-20 12:55:10 +00:00
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_OFF
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
2020-06-01 05:18:30 +00:00
|
|
|
async def setup_comp_9(hass):
|
2018-11-08 08:39:35 +00:00
|
|
|
"""Initialize components."""
|
2020-06-01 05:18:30 +00:00
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
DOMAIN,
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "test",
|
|
|
|
"cold_tolerance": 0.3,
|
|
|
|
"hot_tolerance": 0.3,
|
|
|
|
"target_temp": 25,
|
|
|
|
"heater": ENT_SWITCH,
|
|
|
|
"target_sensor": ENT_SENSOR,
|
|
|
|
"min_cycle_duration": datetime.timedelta(minutes=15),
|
|
|
|
"keep_alive": datetime.timedelta(minutes=10),
|
|
|
|
"precision": 0.1,
|
|
|
|
}
|
|
|
|
},
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
2020-06-01 05:18:30 +00:00
|
|
|
await hass.async_block_till_done()
|
2018-11-08 08:39:35 +00:00
|
|
|
|
|
|
|
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_precision(hass: HomeAssistant, setup_comp_9) -> None:
|
2018-11-08 08:39:35 +00:00
|
|
|
"""Test that setting precision to tenths works as intended."""
|
2022-10-20 13:42:23 +00:00
|
|
|
hass.config.units = US_CUSTOMARY_SYSTEM
|
2019-04-25 08:14:16 +00:00
|
|
|
await common.async_set_temperature(hass, 23.27)
|
2018-11-08 08:39:35 +00:00
|
|
|
state = hass.states.get(ENTITY)
|
2021-03-20 12:55:10 +00:00
|
|
|
assert state.attributes.get("temperature") == 23.3
|
2022-04-19 22:19:59 +00:00
|
|
|
# check that target_temp_step defaults to precision
|
|
|
|
assert state.attributes.get("target_temp_step") == 0.1
|
2018-11-08 08:39:35 +00:00
|
|
|
|
|
|
|
|
2023-02-08 12:33:52 +00:00
|
|
|
async def test_custom_setup_params(hass: HomeAssistant) -> None:
|
2017-03-01 04:33:19 +00:00
|
|
|
"""Test the setup with custom parameters."""
|
2018-11-02 20:06:59 +00:00
|
|
|
result = await async_setup_component(
|
2019-07-31 19:25:30 +00:00
|
|
|
hass,
|
|
|
|
DOMAIN,
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "test",
|
|
|
|
"heater": ENT_SWITCH,
|
|
|
|
"target_sensor": ENT_SENSOR,
|
|
|
|
"min_temp": MIN_TEMP,
|
|
|
|
"max_temp": MAX_TEMP,
|
|
|
|
"target_temp": TARGET_TEMP,
|
2022-04-19 22:19:59 +00:00
|
|
|
"target_temp_step": 0.5,
|
2019-07-31 19:25:30 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
2017-03-01 04:33:19 +00:00
|
|
|
assert result
|
2020-06-01 05:18:30 +00:00
|
|
|
await hass.async_block_till_done()
|
2017-03-01 04:33:19 +00:00
|
|
|
state = hass.states.get(ENTITY)
|
2019-07-31 19:25:30 +00:00
|
|
|
assert state.attributes.get("min_temp") == MIN_TEMP
|
|
|
|
assert state.attributes.get("max_temp") == MAX_TEMP
|
|
|
|
assert state.attributes.get("temperature") == TARGET_TEMP
|
2022-04-19 22:19:59 +00:00
|
|
|
assert state.attributes.get("target_temp_step") == TARGET_TEMP_STEP
|
2017-11-17 16:32:58 +00:00
|
|
|
|
|
|
|
|
2022-04-25 08:58:05 +00:00
|
|
|
@pytest.mark.parametrize("hvac_mode", [HVACMode.OFF, HVACMode.HEAT, HVACMode.COOL])
|
2023-02-13 08:53:09 +00:00
|
|
|
async def test_restore_state(hass: HomeAssistant, hvac_mode) -> None:
|
2017-11-17 16:32:58 +00:00
|
|
|
"""Ensure states are restored on startup."""
|
2019-07-31 19:25:30 +00:00
|
|
|
mock_restore_cache(
|
|
|
|
hass,
|
|
|
|
(
|
|
|
|
State(
|
|
|
|
"climate.test_thermostat",
|
2021-09-13 20:27:06 +00:00
|
|
|
hvac_mode,
|
2019-07-31 19:25:30 +00:00
|
|
|
{ATTR_TEMPERATURE: "20", ATTR_PRESET_MODE: PRESET_AWAY},
|
|
|
|
),
|
Climate 1.0 (#23899)
* Climate 1.0 / part 1/2/3
* fix flake
* Lint
* Update Google Assistant
* ambiclimate to climate 1.0 (#24911)
* Fix Alexa
* Lint
* Migrate zhong_hong
* Migrate tuya
* Migrate honeywell to new climate schema (#24257)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* Fix PRESET can be None
* apply PR#23913 from dev
* remove EU component, etc.
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* apply PR#23913 from dev
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* delint, move debug code
* away preset now working
* code tidy-up
* code tidy-up 2
* code tidy-up 3
* address issues #18932, #15063
* address issues #18932, #15063 - 2/2
* refactor MODE_AUTO to MODE_HEAT_COOL and use F not C
* add low/high to set_temp
* add low/high to set_temp 2
* add low/high to set_temp - delint
* run HA scripts
* port changes from PR #24402
* manual rebase
* manual rebase 2
* delint
* minor change
* remove SUPPORT_HVAC_ACTION
* Migrate radiotherm
* Convert touchline
* Migrate flexit
* Migrate nuheat
* Migrate maxcube
* Fix names maxcube const
* Migrate proliphix
* Migrate heatmiser
* Migrate fritzbox
* Migrate opentherm_gw
* Migrate venstar
* Migrate daikin
* Migrate modbus
* Fix elif
* Migrate Homematic IP Cloud to climate-1.0 (#24913)
* hmip climate fix
* Update hvac_mode and preset_mode
* fix lint
* Fix lint
* Migrate generic_thermostat
* Migrate incomfort to new climate schema (#24915)
* initial commit
* Update climate.py
* Migrate eq3btsmart
* Lint
* cleanup PRESET_MANUAL
* Migrate ecobee
* No conditional features
* KNX: Migrate climate component to new climate platform (#24931)
* Migrate climate component
* Remove unused code
* Corrected line length
* Lint
* Lint
* fix tests
* Fix value
* Migrate geniushub to new climate schema (#24191)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* delinted
* delinted
* use latest client
* clean up mappings
* clean up mappings
* add duration to set_temperature
* add duration to set_temperature
* manual rebase
* tweak
* fix regression
* small fix
* fix rebase mixup
* address comments
* finish refactor
* fix regression
* tweak type hints
* delint
* manual rebase
* WIP: Fixes for honeywell migration to climate-1.0 (#24938)
* add type hints
* code tidy-up
* Fixes for incomfort migration to climate-1.0 (#24936)
* delint type hints
* no async unless await
* revert: no async unless await
* revert: no async unless await 2
* delint
* fix typo
* Fix homekit_controller on climate-1.0 (#24948)
* Fix tests on climate-1.0 branch
* As part of climate-1.0, make state return the heating-cooling.current characteristic
* Fixes from review
* lint
* Fix imports
* Migrate stibel_eltron
* Fix lint
* Migrate coolmaster to climate 1.0 (#24967)
* Migrate coolmaster to climate 1.0
* fix lint errors
* More lint fixes
* Fix demo to work with UI
* Migrate spider
* Demo update
* Updated frontend to 20190705.0
* Fix boost mode (#24980)
* Prepare Netatmo for climate 1.0 (#24973)
* Migration Netatmo
* Address comments
* Update climate.py
* Migrate ephember
* Migrate Sensibo
* Implemented review comments (#24942)
* Migrate ESPHome
* Migrate MQTT
* Migrate Nest
* Migrate melissa
* Initial/partial migration of ST
* Migrate ST
* Remove Away mode (#24995)
* Migrate evohome, cache access tokens (#24491)
* add water_heater, add storage - initial commit
* add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
* Add Broker, Water Heater & Refactor
add missing code
desiderata
* update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
* bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
* support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
* store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
* update CODEOWNERS
* fix regression
* fix requirements
* migrate to climate-1.0
* tweaking
* de-lint
* TCS working? & delint
* tweaking
* TCS code finalised
* remove available() logic
* refactor _switchpoints()
* tidy up switchpoint code
* tweak
* teaking device_state_attributes
* some refactoring
* move PRESET_CUSTOM back to evohome
* move CONF_ACCESS_TOKEN_EXPIRES CONF_REFRESH_TOKEN back to evohome
* refactor SP code and dt conversion
* delinted
* delinted
* remove water_heater
* fix regression
* Migrate homekit
* Cleanup away mode
* Fix tests
* add helpers
* fix tests melissa
* Fix nehueat
* fix zwave
* add more tests
* fix deconz
* Fix climate test emulate_hue
* fix tests
* fix dyson tests
* fix demo with new layout
* fix honeywell
* Switch homekit_controller to use HVAC_MODE_HEAT_COOL instead of HVAC_MODE_AUTO (#25009)
* Lint
* PyLint
* Pylint
* fix fritzbox tests
* Fix google
* Fix all tests
* Fix lint
* Fix auto for homekit like controler
* Fix lint
* fix lint
2019-07-08 12:00:24 +00:00
|
|
|
),
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
2017-11-17 16:32:58 +00:00
|
|
|
|
|
|
|
hass.state = CoreState.starting
|
|
|
|
|
2018-11-02 20:06:59 +00:00
|
|
|
await async_setup_component(
|
2019-07-31 19:25:30 +00:00
|
|
|
hass,
|
|
|
|
DOMAIN,
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "test_thermostat",
|
|
|
|
"heater": ENT_SWITCH,
|
|
|
|
"target_sensor": ENT_SENSOR,
|
|
|
|
"away_temp": 14,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
2020-06-01 05:18:30 +00:00
|
|
|
await hass.async_block_till_done()
|
2019-07-31 19:25:30 +00:00
|
|
|
state = hass.states.get("climate.test_thermostat")
|
|
|
|
assert state.attributes[ATTR_TEMPERATURE] == 20
|
|
|
|
assert state.attributes[ATTR_PRESET_MODE] == PRESET_AWAY
|
2021-09-13 20:27:06 +00:00
|
|
|
assert state.state == hvac_mode
|
2017-12-05 14:00:33 +00:00
|
|
|
|
|
|
|
|
2023-02-08 12:33:52 +00:00
|
|
|
async def test_no_restore_state(hass: HomeAssistant) -> None:
|
2018-01-04 18:05:11 +00:00
|
|
|
"""Ensure states are restored on startup if they exist.
|
|
|
|
|
|
|
|
Allows for graceful reboot.
|
|
|
|
"""
|
2019-07-31 19:25:30 +00:00
|
|
|
mock_restore_cache(
|
|
|
|
hass,
|
|
|
|
(
|
|
|
|
State(
|
|
|
|
"climate.test_thermostat",
|
2022-04-25 08:58:05 +00:00
|
|
|
HVACMode.OFF,
|
2019-07-31 19:25:30 +00:00
|
|
|
{ATTR_TEMPERATURE: "20", ATTR_PRESET_MODE: PRESET_AWAY},
|
|
|
|
),
|
Climate 1.0 (#23899)
* Climate 1.0 / part 1/2/3
* fix flake
* Lint
* Update Google Assistant
* ambiclimate to climate 1.0 (#24911)
* Fix Alexa
* Lint
* Migrate zhong_hong
* Migrate tuya
* Migrate honeywell to new climate schema (#24257)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* Fix PRESET can be None
* apply PR#23913 from dev
* remove EU component, etc.
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* apply PR#23913 from dev
* remove EU component, etc.
* ready to test now
* de-linted
* some tweaks
* de-lint
* better handling of edge cases
* delint
* fix set_mode typos
* delint, move debug code
* away preset now working
* code tidy-up
* code tidy-up 2
* code tidy-up 3
* address issues #18932, #15063
* address issues #18932, #15063 - 2/2
* refactor MODE_AUTO to MODE_HEAT_COOL and use F not C
* add low/high to set_temp
* add low/high to set_temp 2
* add low/high to set_temp - delint
* run HA scripts
* port changes from PR #24402
* manual rebase
* manual rebase 2
* delint
* minor change
* remove SUPPORT_HVAC_ACTION
* Migrate radiotherm
* Convert touchline
* Migrate flexit
* Migrate nuheat
* Migrate maxcube
* Fix names maxcube const
* Migrate proliphix
* Migrate heatmiser
* Migrate fritzbox
* Migrate opentherm_gw
* Migrate venstar
* Migrate daikin
* Migrate modbus
* Fix elif
* Migrate Homematic IP Cloud to climate-1.0 (#24913)
* hmip climate fix
* Update hvac_mode and preset_mode
* fix lint
* Fix lint
* Migrate generic_thermostat
* Migrate incomfort to new climate schema (#24915)
* initial commit
* Update climate.py
* Migrate eq3btsmart
* Lint
* cleanup PRESET_MANUAL
* Migrate ecobee
* No conditional features
* KNX: Migrate climate component to new climate platform (#24931)
* Migrate climate component
* Remove unused code
* Corrected line length
* Lint
* Lint
* fix tests
* Fix value
* Migrate geniushub to new climate schema (#24191)
* Update one
* Fix model climate v2
* Cleanup p4
* Add comfort hold mode
* Fix old code
* Update homeassistant/components/climate/__init__.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/climate/const.py
Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io>
* First renaming
* Rename operation to hvac for paulus
* Rename hold mode to preset mode
* Cleanup & update comments
* Remove on/off
* Fix supported feature count
* Update services
* Update demo
* Fix tests & use current_hvac
* Update comment
* Fix tests & add typing
* Add more typing
* Update modes
* Fix tests
* Cleanup low/high with range
* Update homematic part 1
* Finish homematic
* Fix lint
* fix hm mapping
* Support simple devices
* convert lcn
* migrate oem
* Fix xs1
* update hive
* update mil
* Update toon
* migrate deconz
* cleanup
* update tesla
* Fix lint
* Fix vera
* Migrate zwave
* Migrate velbus
* Cleanup humity feature
* Cleanup
* Migrate wink
* migrate dyson
* Fix current hvac
* Renaming
* Fix lint
* Migrate tfiac
* migrate tado
* delinted
* delinted
* use latest client
* clean up mappings
* clean up mappings
* add duration to set_temperature
* add duration to set_temperature
* manual rebase
* tweak
* fix regression
* small fix
* fix rebase mixup
* address comments
* finish refactor
* fix regression
* tweak type hints
* delint
* manual rebase
* WIP: Fixes for honeywell migration to climate-1.0 (#24938)
* add type hints
* code tidy-up
* Fixes for incomfort migration to climate-1.0 (#24936)
* delint type hints
* no async unless await
* revert: no async unless await
* revert: no async unless await 2
* delint
* fix typo
* Fix homekit_controller on climate-1.0 (#24948)
* Fix tests on climate-1.0 branch
* As part of climate-1.0, make state return the heating-cooling.current characteristic
* Fixes from review
* lint
* Fix imports
* Migrate stibel_eltron
* Fix lint
* Migrate coolmaster to climate 1.0 (#24967)
* Migrate coolmaster to climate 1.0
* fix lint errors
* More lint fixes
* Fix demo to work with UI
* Migrate spider
* Demo update
* Updated frontend to 20190705.0
* Fix boost mode (#24980)
* Prepare Netatmo for climate 1.0 (#24973)
* Migration Netatmo
* Address comments
* Update climate.py
* Migrate ephember
* Migrate Sensibo
* Implemented review comments (#24942)
* Migrate ESPHome
* Migrate MQTT
* Migrate Nest
* Migrate melissa
* Initial/partial migration of ST
* Migrate ST
* Remove Away mode (#24995)
* Migrate evohome, cache access tokens (#24491)
* add water_heater, add storage - initial commit
* add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
* Add Broker, Water Heater & Refactor
add missing code
desiderata
* update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
* bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
* support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
* store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
add water_heater, add storage - initial commit
delint
add missing code
desiderata
update honeywell client library & CODEOWNER
add auth_tokens code, refactor & delint
refactor for broker
delint
bugfix - loc_idx may not be 0
more refactor - ensure pure async
more refactoring
appears all r/o attributes are working
tweak precsion, DHW & delint
remove unused code
remove unused code 2
remove unused code, refactor _save_auth_tokens()
support RoundThermostat
bugfix opmode, switch to util.dt, add until=1h
revert breaking change
store at_expires as naive UTC
remove debug code
delint
tidy up exception handling
delint
* update CODEOWNERS
* fix regression
* fix requirements
* migrate to climate-1.0
* tweaking
* de-lint
* TCS working? & delint
* tweaking
* TCS code finalised
* remove available() logic
* refactor _switchpoints()
* tidy up switchpoint code
* tweak
* teaking device_state_attributes
* some refactoring
* move PRESET_CUSTOM back to evohome
* move CONF_ACCESS_TOKEN_EXPIRES CONF_REFRESH_TOKEN back to evohome
* refactor SP code and dt conversion
* delinted
* delinted
* remove water_heater
* fix regression
* Migrate homekit
* Cleanup away mode
* Fix tests
* add helpers
* fix tests melissa
* Fix nehueat
* fix zwave
* add more tests
* fix deconz
* Fix climate test emulate_hue
* fix tests
* fix dyson tests
* fix demo with new layout
* fix honeywell
* Switch homekit_controller to use HVAC_MODE_HEAT_COOL instead of HVAC_MODE_AUTO (#25009)
* Lint
* PyLint
* Pylint
* fix fritzbox tests
* Fix google
* Fix all tests
* Fix lint
* Fix auto for homekit like controler
* Fix lint
* fix lint
2019-07-08 12:00:24 +00:00
|
|
|
),
|
2019-07-31 19:25:30 +00:00
|
|
|
)
|
2017-12-05 14:00:33 +00:00
|
|
|
|
|
|
|
hass.state = CoreState.starting
|
|
|
|
|
2018-11-02 20:06:59 +00:00
|
|
|
await async_setup_component(
|
2019-07-31 19:25:30 +00:00
|
|
|
hass,
|
|
|
|
DOMAIN,
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "test_thermostat",
|
|
|
|
"heater": ENT_SWITCH,
|
|
|
|
"target_sensor": ENT_SENSOR,
|
|
|
|
"target_temp": 22,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
2020-06-01 05:18:30 +00:00
|
|
|
await hass.async_block_till_done()
|
2019-07-31 19:25:30 +00:00
|
|
|
state = hass.states.get("climate.test_thermostat")
|
|
|
|
assert state.attributes[ATTR_TEMPERATURE] == 22
|
2022-04-25 08:58:05 +00:00
|
|
|
assert state.state == HVACMode.OFF
|
2018-02-03 15:59:19 +00:00
|
|
|
|
|
|
|
|
2023-02-08 12:33:52 +00:00
|
|
|
async def test_initial_hvac_off_force_heater_off(hass: HomeAssistant) -> None:
|
2021-03-19 14:42:45 +00:00
|
|
|
"""Ensure that restored state is coherent with real situation.
|
|
|
|
|
|
|
|
'initial_hvac_mode: off' will force HVAC status, but we must be sure
|
|
|
|
that heater don't keep on.
|
|
|
|
"""
|
|
|
|
# switch is on
|
|
|
|
calls = _setup_switch(hass, True)
|
|
|
|
assert hass.states.get(ENT_SWITCH).state == STATE_ON
|
|
|
|
|
|
|
|
_setup_sensor(hass, 16)
|
|
|
|
|
|
|
|
await async_setup_component(
|
|
|
|
hass,
|
|
|
|
DOMAIN,
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "test_thermostat",
|
|
|
|
"heater": ENT_SWITCH,
|
|
|
|
"target_sensor": ENT_SENSOR,
|
|
|
|
"target_temp": 20,
|
2022-04-25 08:58:05 +00:00
|
|
|
"initial_hvac_mode": HVACMode.OFF,
|
2021-03-19 14:42:45 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
state = hass.states.get("climate.test_thermostat")
|
|
|
|
# 'initial_hvac_mode' will force state but must prevent heather keep working
|
2022-04-25 08:58:05 +00:00
|
|
|
assert state.state == HVACMode.OFF
|
2021-03-19 14:42:45 +00:00
|
|
|
# heater must be switched off
|
|
|
|
assert len(calls) == 1
|
|
|
|
call = calls[0]
|
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_OFF
|
|
|
|
assert call.data["entity_id"] == ENT_SWITCH
|
|
|
|
|
|
|
|
|
2023-02-08 12:33:52 +00:00
|
|
|
async def test_restore_will_turn_off_(hass: HomeAssistant) -> None:
|
2021-03-19 14:42:45 +00:00
|
|
|
"""Ensure that restored state is coherent with real situation.
|
|
|
|
|
|
|
|
Thermostat status must trigger heater event if temp raises the target .
|
|
|
|
"""
|
|
|
|
heater_switch = "input_boolean.test"
|
|
|
|
mock_restore_cache(
|
|
|
|
hass,
|
|
|
|
(
|
|
|
|
State(
|
|
|
|
"climate.test_thermostat",
|
2022-04-25 08:58:05 +00:00
|
|
|
HVACMode.HEAT,
|
2021-03-19 14:42:45 +00:00
|
|
|
{ATTR_TEMPERATURE: "18", ATTR_PRESET_MODE: PRESET_NONE},
|
|
|
|
),
|
|
|
|
State(heater_switch, STATE_ON, {}),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
|
|
|
|
hass.state = CoreState.starting
|
|
|
|
|
|
|
|
assert await async_setup_component(
|
|
|
|
hass, input_boolean.DOMAIN, {"input_boolean": {"test": None}}
|
|
|
|
)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
assert hass.states.get(heater_switch).state == STATE_ON
|
|
|
|
|
|
|
|
_setup_sensor(hass, 22)
|
|
|
|
|
|
|
|
await async_setup_component(
|
|
|
|
hass,
|
|
|
|
DOMAIN,
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "test_thermostat",
|
|
|
|
"heater": heater_switch,
|
|
|
|
"target_sensor": ENT_SENSOR,
|
|
|
|
"target_temp": 20,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
state = hass.states.get("climate.test_thermostat")
|
|
|
|
assert state.attributes[ATTR_TEMPERATURE] == 20
|
2022-04-25 08:58:05 +00:00
|
|
|
assert state.state == HVACMode.HEAT
|
2021-03-19 14:42:45 +00:00
|
|
|
assert hass.states.get(heater_switch).state == STATE_ON
|
|
|
|
|
|
|
|
|
2023-02-08 12:33:52 +00:00
|
|
|
async def test_restore_will_turn_off_when_loaded_second(hass: HomeAssistant) -> None:
|
2021-09-13 20:27:06 +00:00
|
|
|
"""Ensure that restored state is coherent with real situation.
|
|
|
|
|
|
|
|
Switch is not available until after component is loaded
|
|
|
|
"""
|
|
|
|
heater_switch = "input_boolean.test"
|
|
|
|
mock_restore_cache(
|
|
|
|
hass,
|
|
|
|
(
|
|
|
|
State(
|
|
|
|
"climate.test_thermostat",
|
2022-04-25 08:58:05 +00:00
|
|
|
HVACMode.HEAT,
|
2021-09-13 20:27:06 +00:00
|
|
|
{ATTR_TEMPERATURE: "18", ATTR_PRESET_MODE: PRESET_NONE},
|
|
|
|
),
|
|
|
|
State(heater_switch, STATE_ON, {}),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
|
|
|
|
hass.state = CoreState.starting
|
|
|
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
assert hass.states.get(heater_switch) is None
|
|
|
|
|
|
|
|
_setup_sensor(hass, 16)
|
|
|
|
|
|
|
|
await async_setup_component(
|
|
|
|
hass,
|
|
|
|
DOMAIN,
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "test_thermostat",
|
|
|
|
"heater": heater_switch,
|
|
|
|
"target_sensor": ENT_SENSOR,
|
|
|
|
"target_temp": 20,
|
2022-04-25 08:58:05 +00:00
|
|
|
"initial_hvac_mode": HVACMode.OFF,
|
2021-09-13 20:27:06 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
state = hass.states.get("climate.test_thermostat")
|
|
|
|
assert state.attributes[ATTR_TEMPERATURE] == 20
|
2022-04-25 08:58:05 +00:00
|
|
|
assert state.state == HVACMode.OFF
|
2021-09-13 20:27:06 +00:00
|
|
|
|
|
|
|
calls_on = async_mock_service(hass, ha.DOMAIN, SERVICE_TURN_ON)
|
|
|
|
calls_off = async_mock_service(hass, ha.DOMAIN, SERVICE_TURN_OFF)
|
|
|
|
|
|
|
|
assert await async_setup_component(
|
|
|
|
hass, input_boolean.DOMAIN, {"input_boolean": {"test": None}}
|
|
|
|
)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
# heater must be switched off
|
|
|
|
assert len(calls_on) == 0
|
|
|
|
assert len(calls_off) == 1
|
|
|
|
call = calls_off[0]
|
|
|
|
assert call.domain == HASS_DOMAIN
|
|
|
|
assert call.service == SERVICE_TURN_OFF
|
|
|
|
assert call.data["entity_id"] == "input_boolean.test"
|
|
|
|
|
|
|
|
|
2023-02-08 12:33:52 +00:00
|
|
|
async def test_restore_state_uncoherence_case(hass: HomeAssistant) -> None:
|
2023-02-03 22:08:48 +00:00
|
|
|
"""Test restore from a strange state.
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
- Turn the generic thermostat off
|
|
|
|
- Restart HA and restore state from DB
|
|
|
|
"""
|
|
|
|
_mock_restore_cache(hass, temperature=20)
|
|
|
|
|
|
|
|
calls = _setup_switch(hass, False)
|
|
|
|
_setup_sensor(hass, 15)
|
2019-07-31 19:25:30 +00:00
|
|
|
await _setup_climate(hass)
|
2018-11-02 20:06:59 +00:00
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
state = hass.states.get(ENTITY)
|
2021-03-20 12:55:10 +00:00
|
|
|
assert state.attributes[ATTR_TEMPERATURE] == 20
|
2022-04-25 08:58:05 +00:00
|
|
|
assert state.state == HVACMode.OFF
|
2021-03-20 12:55:10 +00:00
|
|
|
assert len(calls) == 0
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
calls = _setup_switch(hass, False)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
state = hass.states.get(ENTITY)
|
2022-04-25 08:58:05 +00:00
|
|
|
assert state.state == HVACMode.OFF
|
2018-11-02 20:06:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
async def _setup_climate(hass):
|
2019-07-31 19:25:30 +00:00
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
DOMAIN,
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "test",
|
|
|
|
"cold_tolerance": 2,
|
|
|
|
"hot_tolerance": 4,
|
|
|
|
"away_temp": 30,
|
|
|
|
"heater": ENT_SWITCH,
|
|
|
|
"target_sensor": ENT_SENSOR,
|
|
|
|
"ac_mode": True,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
2018-02-03 15:59:19 +00:00
|
|
|
|
2018-11-02 20:06:59 +00:00
|
|
|
|
2022-04-25 08:58:05 +00:00
|
|
|
def _mock_restore_cache(hass, temperature=20, hvac_mode=HVACMode.OFF):
|
2019-07-31 19:25:30 +00:00
|
|
|
mock_restore_cache(
|
|
|
|
hass,
|
|
|
|
(
|
|
|
|
State(
|
|
|
|
ENTITY,
|
|
|
|
hvac_mode,
|
|
|
|
{ATTR_TEMPERATURE: str(temperature), ATTR_PRESET_MODE: PRESET_AWAY},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
2020-08-28 04:59:49 +00:00
|
|
|
|
|
|
|
|
2023-02-08 12:33:52 +00:00
|
|
|
async def test_reload(hass: HomeAssistant) -> None:
|
2020-08-28 04:59:49 +00:00
|
|
|
"""Test we can reload."""
|
|
|
|
|
|
|
|
assert await async_setup_component(
|
|
|
|
hass,
|
|
|
|
DOMAIN,
|
|
|
|
{
|
|
|
|
"climate": {
|
|
|
|
"platform": "generic_thermostat",
|
|
|
|
"name": "test",
|
|
|
|
"heater": "switch.any",
|
|
|
|
"target_sensor": "sensor.any",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
assert len(hass.states.async_all()) == 1
|
|
|
|
assert hass.states.get("climate.test") is not None
|
|
|
|
|
2021-11-02 03:47:05 +00:00
|
|
|
yaml_path = get_fixture_path("configuration.yaml", "generic_thermostat")
|
2020-08-28 04:59:49 +00:00
|
|
|
with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path):
|
|
|
|
await hass.services.async_call(
|
2020-08-28 05:24:11 +00:00
|
|
|
GENERIC_THERMOSTAT_DOMAIN,
|
|
|
|
SERVICE_RELOAD,
|
|
|
|
{},
|
|
|
|
blocking=True,
|
2020-08-28 04:59:49 +00:00
|
|
|
)
|
|
|
|
await hass.async_block_till_done()
|
|
|
|
|
|
|
|
assert len(hass.states.async_all()) == 1
|
|
|
|
assert hass.states.get("climate.test") is None
|
|
|
|
assert hass.states.get("climate.reload")
|