From c06d92900a6f0bacd09e06ae5475a7731fb88f93 Mon Sep 17 00:00:00 2001 From: PeteBa Date: Wed, 18 Oct 2017 10:19:09 +0100 Subject: [PATCH] Align away state tag with device_trackers (#9884) --- homeassistant/components/sensor/mqtt_room.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/sensor/mqtt_room.py b/homeassistant/components/sensor/mqtt_room.py index e14922a1579..21198fa940b 100644 --- a/homeassistant/components/sensor/mqtt_room.py +++ b/homeassistant/components/sensor/mqtt_room.py @@ -15,7 +15,7 @@ from homeassistant.core import callback import homeassistant.components.mqtt as mqtt from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import ( - CONF_NAME, CONF_TIMEOUT) + CONF_NAME, CONF_TIMEOUT, STATE_NOT_HOME) from homeassistant.components.mqtt import CONF_STATE_TOPIC import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity import Entity @@ -39,8 +39,6 @@ DEFAULT_TIMEOUT = 5 DEFAULT_AWAY_TIMEOUT = 0 DEFAULT_TOPIC = 'room_presence' -STATE_AWAY = 'away' - PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ vol.Required(CONF_DEVICE_ID): cv.string, vol.Required(CONF_STATE_TOPIC, default=DEFAULT_TOPIC): cv.string, @@ -73,7 +71,7 @@ class MQTTRoomSensor(Entity): def __init__(self, name, state_topic, device_id, timeout, consider_home): """Initialize the sensor.""" - self._state = STATE_AWAY + self._state = STATE_NOT_HOME self._name = name self._state_topic = '{}{}'.format(state_topic, '/+') self._device_id = slugify(device_id).upper() @@ -148,7 +146,7 @@ class MQTTRoomSensor(Entity): if self._updated \ and self._consider_home \ and dt.utcnow() - self._updated > self._consider_home: - self._state = STATE_AWAY + self._state = STATE_NOT_HOME def _parse_update_data(topic, data):