diff --git a/.coveragerc b/.coveragerc index 368af7d1a0f5..1c07c2ea5ddb 100644 --- a/.coveragerc +++ b/.coveragerc @@ -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 diff --git a/homeassistant/components/shiftr/__init__.py b/homeassistant/components/shiftr/__init__.py deleted file mode 100644 index 6f4282915acd..000000000000 --- a/homeassistant/components/shiftr/__init__.py +++ /dev/null @@ -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 diff --git a/homeassistant/components/shiftr/manifest.json b/homeassistant/components/shiftr/manifest.json deleted file mode 100644 index 6c524912e77c..000000000000 --- a/homeassistant/components/shiftr/manifest.json +++ /dev/null @@ -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"] -} diff --git a/homeassistant/generated/integrations.json b/homeassistant/generated/integrations.json index 71fddb0a18a1..ba426786dff2 100644 --- a/homeassistant/generated/integrations.json +++ b/homeassistant/generated/integrations.json @@ -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", diff --git a/requirements_all.txt b/requirements_all.txt index c218adca57e1..71d734089c4e 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -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 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index e44c0e4eecd5..b0818848dcaf 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -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