Use Cloudhooks for OwnTracks (#23847)

* Use Cloudhooks for OwnTracks

* Update config_flow.py

* Update config_flow.py
This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2019-05-14 11:59:11 +02:00
1 parent 19cfa8cf22
commit 6fa8556033
4 files changed
+101 -18

No files matched your search

@@ -91,6 +91,24 @@ async def async_setup_entry(hass, entry):
return True
async def async_unload_entry(hass, entry):
"""Unload an OwnTracks config entry."""
hass.components.webhook.async_unregister(entry.data[CONF_WEBHOOK_ID])
await hass.config_entries.async_forward_entry_unload(
entry, 'device_tracker')
return True
async def async_remove_entry(hass, entry):
"""Remove an OwnTracks config entry."""
if (not entry.data.get('cloudhook') or
'cloud' not in hass.config.components):
return
await hass.components.cloud.async_delete_cloudhook(
entry.data[CONF_WEBHOOK_ID])
async def async_connect_mqtt(hass, component):
"""Subscribe to MQTT topic."""
context = hass.data[DOMAIN]['context']