:vicare: Improve scan_interval (#33294)
This upgrades to PyVicare 0.1.10 which allows to combine multiple requests into a single HTTP GET. This in turn allows us to increase the scan_interval to 60 seconds by default. Additionally scan_interval has been introduced as a config parameter.
This commit is contained in:
parent
95cefd1acc
commit
4a2236fe85
5 changed files with 13 additions and 11 deletions
|
@ -7,7 +7,12 @@ from PyViCare.PyViCareGazBoiler import GazBoiler
|
|||
from PyViCare.PyViCareHeatPump import HeatPump
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import CONF_NAME, CONF_PASSWORD, CONF_USERNAME
|
||||
from homeassistant.const import (
|
||||
CONF_NAME,
|
||||
CONF_PASSWORD,
|
||||
CONF_SCAN_INTERVAL,
|
||||
CONF_USERNAME,
|
||||
)
|
||||
from homeassistant.helpers import discovery
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.storage import STORAGE_DIR
|
||||
|
@ -40,6 +45,9 @@ CONFIG_SCHEMA = vol.Schema(
|
|||
{
|
||||
vol.Required(CONF_USERNAME): cv.string,
|
||||
vol.Required(CONF_PASSWORD): cv.string,
|
||||
vol.Optional(CONF_SCAN_INTERVAL, default=60): vol.All(
|
||||
cv.time_period, lambda value: value.total_seconds()
|
||||
),
|
||||
vol.Optional(CONF_CIRCUIT): int,
|
||||
vol.Optional(CONF_NAME, default="ViCare"): cv.string,
|
||||
vol.Optional(CONF_HEATING_TYPE, default=DEFAULT_HEATING_TYPE): cv.enum(
|
||||
|
@ -59,6 +67,8 @@ def setup(hass, config):
|
|||
if conf.get(CONF_CIRCUIT) is not None:
|
||||
params["circuit"] = conf[CONF_CIRCUIT]
|
||||
|
||||
params["cacheDuration"] = conf.get(CONF_SCAN_INTERVAL)
|
||||
|
||||
heating_type = conf[CONF_HEATING_TYPE]
|
||||
|
||||
try:
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
"""Viessmann ViCare climate device."""
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
import requests
|
||||
|
@ -80,9 +79,6 @@ HA_TO_VICARE_PRESET_HEATING = {
|
|||
|
||||
PYVICARE_ERROR = "error"
|
||||
|
||||
# Scan interval of 15 minutes seems to be safe to not hit the ViCare server rate limit
|
||||
SCAN_INTERVAL = timedelta(seconds=900)
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
"""Create the ViCare climate devices."""
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
"documentation": "https://www.home-assistant.io/integrations/vicare",
|
||||
"dependencies": [],
|
||||
"codeowners": ["@oischinger"],
|
||||
"requirements": ["PyViCare==0.1.7"]
|
||||
"requirements": ["PyViCare==0.1.10"]
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
"""Viessmann ViCare water_heater device."""
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
import requests
|
||||
|
@ -43,9 +42,6 @@ HA_TO_VICARE_HVAC_DHW = {
|
|||
|
||||
PYVICARE_ERROR = "error"
|
||||
|
||||
# Scan interval of 15 minutes seems to be safe to not hit the ViCare server rate limit
|
||||
SCAN_INTERVAL = timedelta(seconds=900)
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
"""Create the ViCare water_heater devices."""
|
||||
|
|
|
@ -78,7 +78,7 @@ PySocks==1.7.1
|
|||
PyTransportNSW==0.1.1
|
||||
|
||||
# homeassistant.components.vicare
|
||||
PyViCare==0.1.7
|
||||
PyViCare==0.1.10
|
||||
|
||||
# homeassistant.components.xiaomi_aqara
|
||||
PyXiaomiGateway==0.12.4
|
||||
|
|
Loading…
Add table
Reference in a new issue