mirror of
https://github.com/andvikt/mega_hacs.git
synced 2025-12-10 16:44:28 +05:00
fix force_d
This commit is contained in:
@@ -7,11 +7,10 @@ import voluptuous as vol
|
||||
|
||||
from homeassistant.const import (
|
||||
CONF_SCAN_INTERVAL, CONF_ID, CONF_NAME, CONF_DOMAIN,
|
||||
CONF_UNIT_OF_MEASUREMENT, CONF_HOST
|
||||
CONF_UNIT_OF_MEASUREMENT, CONF_HOST, CONF_VALUE_TEMPLATE
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, ServiceCall
|
||||
from homeassistant.helpers.service import bind_hass
|
||||
from homeassistant.helpers.template import Template
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.components import mqtt
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
@@ -41,7 +40,8 @@ CUSTOMIZE_PORT = {
|
||||
'сообщение из меги '): cv.template,
|
||||
vol.Optional(CONF_ACTION): cv.script_action, # пока не реализовано
|
||||
vol.Optional(CONF_GET_VALUE, default=True): bool,
|
||||
vol.Optional(CONF_CONV_TEMPLATE): cv.template
|
||||
vol.Optional(CONF_CONV_TEMPLATE): cv.template,
|
||||
vol.Optional(CONF_VALUE_TEMPLATE): cv.template,
|
||||
}
|
||||
CUSTOMIZE_DS2413 = {
|
||||
vol.Optional(str.lower, description='адрес и индекс устройства'): CUSTOMIZE_PORT
|
||||
|
||||
@@ -15,5 +15,5 @@
|
||||
"@andvikt"
|
||||
],
|
||||
"issue_tracker": "https://github.com/andvikt/mega_hacs/issues",
|
||||
"version": "v0.4.1b7"
|
||||
"version": "v0.4.1"
|
||||
}
|
||||
@@ -13,7 +13,7 @@ from homeassistant.const import (
|
||||
CONF_PORT,
|
||||
CONF_UNIQUE_ID,
|
||||
CONF_ID,
|
||||
CONF_TYPE, CONF_UNIT_OF_MEASUREMENT,
|
||||
CONF_TYPE, CONF_UNIT_OF_MEASUREMENT, CONF_VALUE_TEMPLATE,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.template import Template
|
||||
@@ -163,7 +163,7 @@ class Mega1WSensor(MegaPushEntity):
|
||||
ret = str(ret)
|
||||
except:
|
||||
ret = None
|
||||
tmpl: Template = self.customize.get(CONF_CONV_TEMPLATE)
|
||||
tmpl: Template = self.customize.get(CONF_CONV_TEMPLATE, self.customize.get(CONF_VALUE_TEMPLATE))
|
||||
if tmpl is not None and self.hass is not None:
|
||||
tmpl.hass = self.hass
|
||||
ret = tmpl.async_render({'value': ret})
|
||||
|
||||
Reference in New Issue
Block a user