mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 02:49:40 +00:00
Add config flow to transmission (#26434)
* Add config flow to transmission * Reworked code to add all sensors and switches * applied fixes * final touches * Add tests * fixed tests * fix get_api errors and entities availabilty update * update config_flows.py * fix pylint error * update .coveragerc * add codeowner * add test_options * fixed test_options
This commit is contained in:
committed by
Martin Hjelmare
parent
9b204ad162
commit
82b77c2d29
@@ -1,32 +1,29 @@
|
||||
"""Support for monitoring the Transmission BitTorrent client API."""
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from homeassistant.const import STATE_IDLE
|
||||
from homeassistant.const import CONF_NAME, STATE_IDLE
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from . import DATA_TRANSMISSION, DATA_UPDATED, SENSOR_TYPES
|
||||
from .const import DATA_TRANSMISSION, DATA_UPDATED, DOMAIN, SENSOR_TYPES
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
DEFAULT_NAME = "Transmission"
|
||||
|
||||
SCAN_INTERVAL = timedelta(seconds=120)
|
||||
|
||||
|
||||
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
|
||||
"""Set up the Transmission sensors."""
|
||||
if discovery_info is None:
|
||||
return
|
||||
"""Import config from configuration.yaml."""
|
||||
pass
|
||||
|
||||
transmission_api = hass.data[DATA_TRANSMISSION]
|
||||
monitored_variables = discovery_info["sensors"]
|
||||
name = discovery_info["client_name"]
|
||||
|
||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
"""Set up the Transmission sensors."""
|
||||
|
||||
transmission_api = hass.data[DOMAIN][DATA_TRANSMISSION]
|
||||
name = config_entry.data[CONF_NAME]
|
||||
|
||||
dev = []
|
||||
for sensor_type in monitored_variables:
|
||||
for sensor_type in SENSOR_TYPES:
|
||||
dev.append(
|
||||
TransmissionSensor(
|
||||
sensor_type,
|
||||
|
||||
Reference in New Issue
Block a user