More support for availability reporting on MQTT components (#11336)

* Abstract MQTT availability from individual components

- Moved availability topic and payloads to MQTT base schema.
- Updated components that already report availability:
  - Switch
  - Binary sensor
  - Cover

* Add availability reporting to additional MQTT components

- Light
- JSON light
- Template light
- Lock
- Fan
- HVAC
- Sensor
- Vacuum
- Alarm control panel

* Annotate MQTT platform coroutines
This commit is contained in:
Dan Nixon 2018-01-02 02:32:29 +00:00 committed by Paulus Schoutsen
parent 541707c3e7
commit f0bf7b0def
25 changed files with 530 additions and 193 deletions

View file

@ -60,11 +60,9 @@ class MqttCamera(Camera):
"""Return the name of this camera."""
return self._name
@asyncio.coroutine
def async_added_to_hass(self):
"""Subscribe MQTT events.
This method must be run in the event loop and returns a coroutine.
"""
"""Subscribe MQTT events."""
@callback
def message_received(topic, payload, qos):
"""Handle new MQTT messages."""