mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
: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
@ -7,7 +7,12 @@ from PyViCare.PyViCareGazBoiler import GazBoiler
|
|||||||
from PyViCare.PyViCareHeatPump import HeatPump
|
from PyViCare.PyViCareHeatPump import HeatPump
|
||||||
import voluptuous as vol
|
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
|
from homeassistant.helpers import discovery
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.storage import STORAGE_DIR
|
from homeassistant.helpers.storage import STORAGE_DIR
|
||||||
@ -40,6 +45,9 @@ CONFIG_SCHEMA = vol.Schema(
|
|||||||
{
|
{
|
||||||
vol.Required(CONF_USERNAME): cv.string,
|
vol.Required(CONF_USERNAME): cv.string,
|
||||||
vol.Required(CONF_PASSWORD): 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_CIRCUIT): int,
|
||||||
vol.Optional(CONF_NAME, default="ViCare"): cv.string,
|
vol.Optional(CONF_NAME, default="ViCare"): cv.string,
|
||||||
vol.Optional(CONF_HEATING_TYPE, default=DEFAULT_HEATING_TYPE): cv.enum(
|
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:
|
if conf.get(CONF_CIRCUIT) is not None:
|
||||||
params["circuit"] = conf[CONF_CIRCUIT]
|
params["circuit"] = conf[CONF_CIRCUIT]
|
||||||
|
|
||||||
|
params["cacheDuration"] = conf.get(CONF_SCAN_INTERVAL)
|
||||||
|
|
||||||
heating_type = conf[CONF_HEATING_TYPE]
|
heating_type = conf[CONF_HEATING_TYPE]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Viessmann ViCare climate device."""
|
"""Viessmann ViCare climate device."""
|
||||||
from datetime import timedelta
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
@ -80,9 +79,6 @@ HA_TO_VICARE_PRESET_HEATING = {
|
|||||||
|
|
||||||
PYVICARE_ERROR = "error"
|
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):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Create the ViCare climate devices."""
|
"""Create the ViCare climate devices."""
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
"documentation": "https://www.home-assistant.io/integrations/vicare",
|
"documentation": "https://www.home-assistant.io/integrations/vicare",
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"codeowners": ["@oischinger"],
|
"codeowners": ["@oischinger"],
|
||||||
"requirements": ["PyViCare==0.1.7"]
|
"requirements": ["PyViCare==0.1.10"]
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
"""Viessmann ViCare water_heater device."""
|
"""Viessmann ViCare water_heater device."""
|
||||||
from datetime import timedelta
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
@ -43,9 +42,6 @@ HA_TO_VICARE_HVAC_DHW = {
|
|||||||
|
|
||||||
PYVICARE_ERROR = "error"
|
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):
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Create the ViCare water_heater devices."""
|
"""Create the ViCare water_heater devices."""
|
||||||
|
@ -78,7 +78,7 @@ PySocks==1.7.1
|
|||||||
PyTransportNSW==0.1.1
|
PyTransportNSW==0.1.1
|
||||||
|
|
||||||
# homeassistant.components.vicare
|
# homeassistant.components.vicare
|
||||||
PyViCare==0.1.7
|
PyViCare==0.1.10
|
||||||
|
|
||||||
# homeassistant.components.xiaomi_aqara
|
# homeassistant.components.xiaomi_aqara
|
||||||
PyXiaomiGateway==0.12.4
|
PyXiaomiGateway==0.12.4
|
||||||
|
Loading…
x
Reference in New Issue
Block a user