diff --git a/homeassistant/components/mqtt/binary_sensor.py b/homeassistant/components/mqtt/binary_sensor.py index cffb2fd8300..adb4c12daf9 100644 --- a/homeassistant/components/mqtt/binary_sensor.py +++ b/homeassistant/components/mqtt/binary_sensor.py @@ -184,6 +184,7 @@ class MqttBinarySensor(MqttEntity, BinarySensorEntity, RestoreEntity): return DISCOVERY_SCHEMA def _setup_from_config(self, config): + self._attr_force_update = config[CONF_FORCE_UPDATE] self._value_template = MqttValueTemplate( self._config.get(CONF_VALUE_TEMPLATE), entity=self, @@ -300,11 +301,6 @@ class MqttBinarySensor(MqttEntity, BinarySensorEntity, RestoreEntity): """Return the class of this sensor.""" return self._config.get(CONF_DEVICE_CLASS) - @property - def force_update(self) -> bool: - """Force update.""" - return self._config[CONF_FORCE_UPDATE] - @property def available(self) -> bool: """Return true if the device is available and value has not expired.""" diff --git a/homeassistant/components/mqtt/sensor.py b/homeassistant/components/mqtt/sensor.py index 4c04d6176f1..b361ce06a81 100644 --- a/homeassistant/components/mqtt/sensor.py +++ b/homeassistant/components/mqtt/sensor.py @@ -233,6 +233,7 @@ class MqttSensor(MqttEntity, RestoreSensor): def _setup_from_config(self, config): """(Re)Setup the entity.""" + self._attr_force_update = config[CONF_FORCE_UPDATE] self._template = MqttValueTemplate( self._config.get(CONF_VALUE_TEMPLATE), entity=self ).async_render_with_possible_json_value @@ -350,11 +351,6 @@ class MqttSensor(MqttEntity, RestoreSensor): """Return the unit this state is expressed in.""" return self._config.get(CONF_UNIT_OF_MEASUREMENT) - @property - def force_update(self) -> bool: - """Force update.""" - return self._config[CONF_FORCE_UPDATE] - @property def native_value(self): """Return the state of the entity."""