diff --git a/homeassistant/components/sensor/mqtt.py b/homeassistant/components/sensor/mqtt.py index 99a01174560..37540820fcc 100644 --- a/homeassistant/components/sensor/mqtt.py +++ b/homeassistant/components/sensor/mqtt.py @@ -13,7 +13,7 @@ sensor: platform: mqtt name: "MQTT Sensor" state_topic: "home/bedroom/temperature" - qos: 2 + qos: 0 unit_of_measurement: "ÂșC" Variables: @@ -64,6 +64,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None): config.get('unit_of_measurement'))]) +# pylint: disable=too-many-arguments, too-many-instance-attributes class MqttSensor(Entity): """ Represents a sensor that can be updated using MQTT """ def __init__(self, hass, name, state_topic, qos, unit_of_measurement): diff --git a/homeassistant/components/switch/mqtt.py b/homeassistant/components/switch/mqtt.py index ce451c87062..73618bd9277 100644 --- a/homeassistant/components/switch/mqtt.py +++ b/homeassistant/components/switch/mqtt.py @@ -26,7 +26,7 @@ switch: name: "Bedroom Switch" state_topic: "home/bedroom/switch1" command_topic: "home/bedroom/switch1/set" - qos: 2 + qos: 0 payload_on: "ON" payload_off: "OFF" optimistic: false @@ -128,7 +128,7 @@ class MqttSwitch(SwitchDevice): self._optimistic = True else: # subscribe the state_topic - mqtt.subscribe(hass, self._state_topic, message_received, + mqtt.subscribe(hass, self._state_topic, message_received, self._qos) @property @@ -148,7 +148,7 @@ class MqttSwitch(SwitchDevice): def turn_on(self, **kwargs): """ Turn the device on. """ - mqtt.publish(self.hass, self._command_topic, self._payload_on, + mqtt.publish(self.hass, self._command_topic, self._payload_on, self._qos) if self._optimistic: # optimistically assume that switch has changed state @@ -157,7 +157,7 @@ class MqttSwitch(SwitchDevice): def turn_off(self, **kwargs): """ Turn the device off. """ - mqtt.publish(self.hass, self._command_topic, self._payload_off, + mqtt.publish(self.hass, self._command_topic, self._payload_off, self._qos) if self._optimistic: # optimistically assume that switch has changed state