mirror of
https://github.com/home-assistant/core
synced 2024-09-25 00:41:32 +02:00
Remove Shiftr integration (#102224)
This commit is contained in:
parent
22de378d91
commit
1372126bc0
@ -1118,7 +1118,6 @@ omit =
|
||||
homeassistant/components/sesame/lock.py
|
||||
homeassistant/components/seven_segments/image_processing.py
|
||||
homeassistant/components/seventeentrack/sensor.py
|
||||
homeassistant/components/shiftr/*
|
||||
homeassistant/components/shodan/sensor.py
|
||||
homeassistant/components/sia/__init__.py
|
||||
homeassistant/components/sia/alarm_control_panel.py
|
||||
|
@ -1,76 +0,0 @@
|
||||
"""Support for Shiftr.io."""
|
||||
import paho.mqtt.client as mqtt
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import (
|
||||
CONF_PASSWORD,
|
||||
CONF_USERNAME,
|
||||
EVENT_HOMEASSISTANT_STOP,
|
||||
EVENT_STATE_CHANGED,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import state as state_helper
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
DOMAIN = "shiftr"
|
||||
|
||||
SHIFTR_BROKER = "broker.shiftr.io"
|
||||
|
||||
CONFIG_SCHEMA = vol.Schema(
|
||||
{
|
||||
DOMAIN: vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_USERNAME): cv.string,
|
||||
vol.Required(CONF_PASSWORD): cv.string,
|
||||
}
|
||||
)
|
||||
},
|
||||
extra=vol.ALLOW_EXTRA,
|
||||
)
|
||||
|
||||
|
||||
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Initialize the Shiftr.io MQTT consumer."""
|
||||
conf = config[DOMAIN]
|
||||
username = conf.get(CONF_USERNAME)
|
||||
password = conf.get(CONF_PASSWORD)
|
||||
|
||||
client_id = "HomeAssistant"
|
||||
port = 1883
|
||||
keepalive = 600
|
||||
|
||||
mqttc = mqtt.Client(client_id, protocol=mqtt.MQTTv311)
|
||||
mqttc.username_pw_set(username, password=password)
|
||||
mqttc.connect(SHIFTR_BROKER, port=port, keepalive=keepalive)
|
||||
|
||||
def stop_shiftr(event):
|
||||
"""Stop the Shiftr.io MQTT component."""
|
||||
mqttc.disconnect()
|
||||
|
||||
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, stop_shiftr)
|
||||
|
||||
def shiftr_event_listener(event):
|
||||
"""Listen for new messages on the bus and sends them to Shiftr.io."""
|
||||
state = event.data.get("new_state")
|
||||
topic = state.entity_id.replace(".", "/")
|
||||
|
||||
try:
|
||||
_state = state_helper.state_as_number(state)
|
||||
except ValueError:
|
||||
_state = state.state
|
||||
|
||||
try:
|
||||
mqttc.publish(topic, _state, qos=0, retain=False)
|
||||
|
||||
if state.attributes:
|
||||
for attribute, data in state.attributes.items():
|
||||
mqttc.publish(
|
||||
f"/{topic}/{attribute}", str(data), qos=0, retain=False
|
||||
)
|
||||
except RuntimeError:
|
||||
pass
|
||||
|
||||
hass.bus.listen(EVENT_STATE_CHANGED, shiftr_event_listener)
|
||||
|
||||
return True
|
@ -1,9 +0,0 @@
|
||||
{
|
||||
"domain": "shiftr",
|
||||
"name": "shiftr.io",
|
||||
"codeowners": [],
|
||||
"documentation": "https://www.home-assistant.io/integrations/shiftr",
|
||||
"iot_class": "cloud_push",
|
||||
"loggers": ["paho"],
|
||||
"requirements": ["paho-mqtt==1.6.1"]
|
||||
}
|
@ -5049,12 +5049,6 @@
|
||||
"config_flow": true,
|
||||
"iot_class": "local_push"
|
||||
},
|
||||
"shiftr": {
|
||||
"name": "shiftr.io",
|
||||
"integration_type": "hub",
|
||||
"config_flow": false,
|
||||
"iot_class": "cloud_push"
|
||||
},
|
||||
"shodan": {
|
||||
"name": "Shodan",
|
||||
"integration_type": "hub",
|
||||
|
@ -1410,7 +1410,6 @@ ovoenergy==1.2.0
|
||||
p1monitor==2.1.1
|
||||
|
||||
# homeassistant.components.mqtt
|
||||
# homeassistant.components.shiftr
|
||||
paho-mqtt==1.6.1
|
||||
|
||||
# homeassistant.components.panasonic_bluray
|
||||
|
@ -1082,7 +1082,6 @@ ovoenergy==1.2.0
|
||||
p1monitor==2.1.1
|
||||
|
||||
# homeassistant.components.mqtt
|
||||
# homeassistant.components.shiftr
|
||||
paho-mqtt==1.6.1
|
||||
|
||||
# homeassistant.components.panasonic_viera
|
||||
|
Loading…
Reference in New Issue
Block a user