Add mqtt sensor configurable state encoding for sensor and binary_sensor platform (#60447)

* Add mqtt sensor state encoding

* Make encoding attribute not specific to states

* Move encoding attribute to schema base
This commit is contained in:
Jan Bouwhuis 2021-11-30 14:04:24 +01:00 committed by GitHub
parent 7469f083fd
commit 2a2a20fcb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 76 additions and 7 deletions

View file

@ -10,13 +10,10 @@ from homeassistant.core import HassJob, callback
from homeassistant.helpers import config_validation as cv, template
from .. import mqtt
from .const import CONF_QOS, CONF_TOPIC
from .const import CONF_ENCODING, CONF_QOS, CONF_TOPIC, DEFAULT_ENCODING, DEFAULT_QOS
# mypy: allow-untyped-defs
CONF_ENCODING = "encoding"
DEFAULT_ENCODING = "utf-8"
DEFAULT_QOS = 0
TRIGGER_SCHEMA = cv.TRIGGER_BASE_SCHEMA.extend(
{