mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
fix a bug after the pylint rework
This commit is contained in:
parent
7cfce94dfb
commit
538f8545f7
@ -86,21 +86,21 @@ class MqttLight(Light):
|
|||||||
""" A new MQTT message has been received. """
|
""" A new MQTT message has been received. """
|
||||||
if payload == self._payload_on:
|
if payload == self._payload_on:
|
||||||
self._state = True
|
self._state = True
|
||||||
self._hass.update_ha_state()
|
self.update_ha_state()
|
||||||
elif payload == self._payload_off:
|
elif payload == self._payload_off:
|
||||||
self._state = False
|
self._state = False
|
||||||
self._hass.update_ha_state()
|
self.update_ha_state()
|
||||||
|
|
||||||
def brightness_received(topic, payload, qos):
|
def brightness_received(topic, payload, qos):
|
||||||
""" A new MQTT message has been received. """
|
""" A new MQTT message has been received. """
|
||||||
self._brightness = int(payload)
|
self._brightness = int(payload)
|
||||||
self._hass.update_ha_state()
|
self.update_ha_state()
|
||||||
|
|
||||||
def rgb_received(topic, payload, qos):
|
def rgb_received(topic, payload, qos):
|
||||||
""" A new MQTT message has been received. """
|
""" A new MQTT message has been received. """
|
||||||
rgb = payload.split(",")
|
rgb = payload.split(",")
|
||||||
self._rgb = list(map(int, rgb))
|
self._rgb = list(map(int, rgb))
|
||||||
self._hass.update_ha_state()
|
self.update_ha_state()
|
||||||
|
|
||||||
# subscribe the state_topic
|
# subscribe the state_topic
|
||||||
mqtt.subscribe(self._hass, self._state_topic,
|
mqtt.subscribe(self._hass, self._state_topic,
|
||||||
@ -157,11 +157,11 @@ class MqttLight(Light):
|
|||||||
self._state = True
|
self._state = True
|
||||||
mqtt.publish(self._hass, self._command_topic,
|
mqtt.publish(self._hass, self._command_topic,
|
||||||
self._payload_on, self._qos)
|
self._payload_on, self._qos)
|
||||||
self._hass.update_ha_state()
|
self.update_ha_state()
|
||||||
|
|
||||||
def turn_off(self, **kwargs):
|
def turn_off(self, **kwargs):
|
||||||
""" Turn the device off. """
|
""" Turn the device off. """
|
||||||
self._state = False
|
self._state = False
|
||||||
mqtt.publish(self._hass, self._command_topic,
|
mqtt.publish(self._hass, self._command_topic,
|
||||||
self._payload_off, self._qos)
|
self._payload_off, self._qos)
|
||||||
self._hass.update_ha_state()
|
self.update_ha_state()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user