Skip to content

Commit bd19d49

Browse files
authored
Add files via upload
1 parent 5a08193 commit bd19d49

2 files changed

Lines changed: 17 additions & 10 deletions

File tree

custom_components/humidifier_template/humidifier.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@
2222
DEFAULT_MIN_HUMIDITY,
2323
)
2424
from homeassistant.components.template.const import CONF_AVAILABILITY_TEMPLATE
25-
from homeassistant.components.template.helpers import async_setup_template_platform
25+
from homeassistant.components.template.helpers import (
26+
async_create_template_tracking_entities,
27+
validate_template_scripts,
28+
)
2629
from homeassistant.components.template.schemas import make_template_entity_base_schema
2730
from homeassistant.components.template.template_entity import TemplateEntity
2831
from homeassistant.const import (
@@ -58,12 +61,18 @@
5861
CONF_TARGET_HUMIDITY_TEMPLATE = "target_humidity_template"
5962
CONF_TURN_OFF_ACTION = "turn_off"
6063
CONF_TURN_ON_ACTION = "turn_on"
64+
SCRIPT_OPTIONS = (
65+
CONF_TURN_ON_ACTION,
66+
CONF_TURN_OFF_ACTION,
67+
CONF_SET_HUMIDITY_ACTION,
68+
CONF_SET_MODE_ACTION,
69+
)
6170

6271
DEFAULT_NAME = "Template Humidifier"
6372
DEFAULT_TARGET_HUMIDITY = 50
6473
DEFAULT_TARGET_HUMIDITY_STEP = 1.0
6574
DOMAIN = "humidifier_template"
66-
PLATFORMS = ["humidifier"]
75+
PLATFORMS = [HUMIDIFIER_DOMAIN]
6776

6877

6978
def _humidity(value):
@@ -109,15 +118,13 @@ async def async_setup_platform(
109118
):
110119
"""Set up the Template Humidifier."""
111120
await async_setup_reload_service(hass, DOMAIN, PLATFORMS)
112-
await async_setup_template_platform(
113-
hass,
114-
HUMIDIFIER_DOMAIN,
115-
config,
121+
await validate_template_scripts(hass, config, SCRIPT_OPTIONS)
122+
async_create_template_tracking_entities(
116123
TemplateHumidifier,
117-
None,
118124
async_add_entities,
119-
discovery_info,
120-
{},
125+
hass,
126+
[config],
127+
None,
121128
)
122129

123130

custom_components/humidifier_template/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
"iot_class": "calculated",
1212
"issue_tracker": "https://github.com/kei81131/hass-humidifier-template/issues",
1313
"requirements": [],
14-
"version": "1.0.0"
14+
"version": "1.0.4"
1515
}

0 commit comments

Comments
 (0)