Rename zwave_mqtt to ozw (#35631)

pull/35637/head
Franck Nijhof 2020-05-14 22:56:04 +02:00 committed by GitHub
parent 626f72b97a
commit 0be20ec6ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
54 changed files with 67 additions and 78 deletions

View File

@ -919,10 +919,10 @@ omit =
homeassistant/components/zoneminder/*
homeassistant/components/supla/*
homeassistant/components/zwave/util.py
homeassistant/components/zwave_mqtt/__init__.py
homeassistant/components/zwave_mqtt/discovery.py
homeassistant/components/zwave_mqtt/entity.py
homeassistant/components/zwave_mqtt/services.py
homeassistant/components/ozw/__init__.py
homeassistant/components/ozw/discovery.py
homeassistant/components/ozw/entity.py
homeassistant/components/ozw/services.py
[report]
# Regexes for lines to exclude from consideration

View File

@ -292,6 +292,7 @@ homeassistant/components/openweathermap/* @fabaff
homeassistant/components/opnsense/* @mtreinish
homeassistant/components/orangepi_gpio/* @pascallj
homeassistant/components/oru/* @bvlaicu
homeassistant/components/ozw/* @cgarwood @marcelveldt @MartinHjelmare
homeassistant/components/panasonic_viera/* @joogps
homeassistant/components/panel_custom/* @home-assistant/frontend
homeassistant/components/panel_iframe/* @home-assistant/frontend
@ -474,7 +475,6 @@ homeassistant/components/zha/* @dmulcahey @adminiuga
homeassistant/components/zone/* @home-assistant/core
homeassistant/components/zoneminder/* @rohankapoorcom
homeassistant/components/zwave/* @home-assistant/z-wave
homeassistant/components/zwave_mqtt/* @cgarwood @marcelveldt @MartinHjelmare
# Individual files
homeassistant/components/demo/weather @fabaff

View File

@ -1,4 +1,4 @@
"""The zwave_mqtt integration."""
"""The ozw integration."""
import asyncio
import json
import logging
@ -43,7 +43,7 @@ DATA_DEVICES = "zwave-mqtt-devices"
async def async_setup(hass: HomeAssistant, config: dict):
"""Initialize basic config of zwave_mqtt component."""
"""Initialize basic config of ozw component."""
if "mqtt" not in hass.config.components:
_LOGGER.error("MQTT integration is not set up")
return False
@ -52,9 +52,9 @@ async def async_setup(hass: HomeAssistant, config: dict):
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up zwave_mqtt from a config entry."""
zwave_mqtt_data = hass.data[DOMAIN][entry.entry_id] = {}
zwave_mqtt_data[DATA_UNSUBSCRIBE] = []
"""Set up ozw from a config entry."""
ozw_data = hass.data[DOMAIN][entry.entry_id] = {}
ozw_data[DATA_UNSUBSCRIBE] = []
data_nodes = {}
data_values = {}
@ -216,7 +216,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
for component in PLATFORMS
]
)
zwave_mqtt_data[DATA_UNSUBSCRIBE].append(
ozw_data[DATA_UNSUBSCRIBE].append(
await mqtt.async_subscribe(
hass, f"{TOPIC_OPENZWAVE}/#", async_receive_message
)

View File

@ -1,13 +1,13 @@
"""Config flow for zwave_mqtt integration."""
"""Config flow for ozw integration."""
from homeassistant import config_entries
from .const import DOMAIN # pylint:disable=unused-import
TITLE = "Z-Wave MQTT"
TITLE = "OpenZWave"
class DomainConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
"""Handle a config flow for zwave_mqtt."""
"""Handle a config flow for ozw."""
VERSION = 1
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_PUSH

View File

@ -1,10 +1,10 @@
"""Constants for the zwave_mqtt integration."""
"""Constants for the ozw integration."""
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
DOMAIN = "zwave_mqtt"
DOMAIN = "ozw"
DATA_UNSUBSCRIBE = "unsubscribe"
PLATFORMS = [BINARY_SENSOR_DOMAIN, LIGHT_DOMAIN, SENSOR_DOMAIN, SWITCH_DOMAIN]

View File

@ -0,0 +1,9 @@
{
"domain": "ozw",
"name": "OpenZWave (beta)",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/ozw",
"requirements": ["python-openzwave-mqtt==1.0.1"],
"after_dependencies": ["mqtt"],
"codeowners": ["@cgarwood", "@marcelveldt", "@MartinHjelmare"]
}

View File

@ -1,5 +1,4 @@
{
"title": "Z-Wave over MQTT",
"config": {
"step": {
"user": {

View File

@ -1,17 +0,0 @@
{
"domain": "zwave_mqtt",
"name": "Z-Wave over MQTT",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/zwave_mqtt",
"requirements": [
"python-openzwave-mqtt==1.0.1"
],
"after_dependencies": [
"mqtt"
],
"codeowners": [
"@cgarwood",
"@marcelveldt",
"@MartinHjelmare"
]
}

View File

@ -106,6 +106,7 @@ FLOWS = [
"opentherm_gw",
"openuv",
"owntracks",
"ozw",
"panasonic_viera",
"pi_hole",
"plaato",
@ -164,6 +165,5 @@ FLOWS = [
"xiaomi_miio",
"zerproc",
"zha",
"zwave",
"zwave_mqtt"
"zwave"
]

View File

@ -1707,7 +1707,7 @@ python-nest==4.1.0
# homeassistant.components.nmap_tracker
python-nmap==0.6.1
# homeassistant.components.zwave_mqtt
# homeassistant.components.ozw
python-openzwave-mqtt==1.0.1
# homeassistant.components.qbittorrent

View File

@ -704,7 +704,7 @@ python-miio==0.5.0.1
# homeassistant.components.nest
python-nest==4.1.0
# homeassistant.components.zwave_mqtt
# homeassistant.components.ozw
python-openzwave-mqtt==1.0.1
# homeassistant.components.songpal

View File

@ -0,0 +1 @@
"""Tests for the OZW integration."""

View File

@ -2,14 +2,14 @@
import json
from homeassistant import config_entries
from homeassistant.components.zwave_mqtt.const import DOMAIN
from homeassistant.components.ozw.const import DOMAIN
from tests.async_mock import Mock, patch
from tests.common import MockConfigEntry
async def setup_zwave(hass, entry=None, fixture=None):
"""Set up Z-Wave and load a dump."""
async def setup_ozw(hass, entry=None, fixture=None):
"""Set up OZW and load a dump."""
hass.config.components.add("mqtt")
if entry is None:
@ -26,7 +26,7 @@ async def setup_zwave(hass, entry=None, fixture=None):
assert await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
assert "zwave_mqtt" in hass.config.components
assert "ozw" in hass.config.components
assert len(mock_subscribe.mock_calls) == 1
receive_message = mock_subscribe.mock_calls[0][1][2]

View File

@ -12,13 +12,13 @@ from tests.common import load_fixture
@pytest.fixture(name="generic_data", scope="session")
def generic_data_fixture():
"""Load generic MQTT data and return it."""
return load_fixture("zwave_mqtt/generic_network_dump.csv")
return load_fixture("ozw/generic_network_dump.csv")
@pytest.fixture(name="light_data", scope="session")
def light_data_fixture():
"""Load light dimmer MQTT data and return it."""
return load_fixture("zwave_mqtt/light_network_dump.csv")
return load_fixture("ozw/light_network_dump.csv")
@pytest.fixture(name="sent_messages")
@ -39,7 +39,7 @@ def sent_messages_fixture():
async def light_msg_fixture(hass):
"""Return a mock MQTT msg with a light actuator message."""
light_json = json.loads(
await hass.async_add_executor_job(load_fixture, "zwave_mqtt/light.json")
await hass.async_add_executor_job(load_fixture, "ozw/light.json")
)
message = MQTTMessage(topic=light_json["topic"], payload=light_json["payload"])
message.encode()
@ -50,7 +50,7 @@ async def light_msg_fixture(hass):
async def switch_msg_fixture(hass):
"""Return a mock MQTT msg with a switch actuator message."""
switch_json = json.loads(
await hass.async_add_executor_job(load_fixture, "zwave_mqtt/switch.json")
await hass.async_add_executor_job(load_fixture, "ozw/switch.json")
)
message = MQTTMessage(topic=switch_json["topic"], payload=switch_json["payload"])
message.encode()
@ -61,7 +61,7 @@ async def switch_msg_fixture(hass):
async def sensor_msg_fixture(hass):
"""Return a mock MQTT msg with a sensor change message."""
sensor_json = json.loads(
await hass.async_add_executor_job(load_fixture, "zwave_mqtt/sensor.json")
await hass.async_add_executor_job(load_fixture, "ozw/sensor.json")
)
message = MQTTMessage(topic=sensor_json["topic"], payload=sensor_json["payload"])
message.encode()
@ -72,7 +72,7 @@ async def sensor_msg_fixture(hass):
async def binary_sensor_msg_fixture(hass):
"""Return a mock MQTT msg with a binary_sensor change message."""
sensor_json = json.loads(
await hass.async_add_executor_job(load_fixture, "zwave_mqtt/binary_sensor.json")
await hass.async_add_executor_job(load_fixture, "ozw/binary_sensor.json")
)
message = MQTTMessage(topic=sensor_json["topic"], payload=sensor_json["payload"])
message.encode()
@ -83,9 +83,7 @@ async def binary_sensor_msg_fixture(hass):
async def binary_sensor_alt_msg_fixture(hass):
"""Return a mock MQTT msg with a binary_sensor change message."""
sensor_json = json.loads(
await hass.async_add_executor_job(
load_fixture, "zwave_mqtt/binary_sensor_alt.json"
)
await hass.async_add_executor_job(load_fixture, "ozw/binary_sensor_alt.json")
)
message = MQTTMessage(topic=sensor_json["topic"], payload=sensor_json["payload"])
message.encode()

View File

@ -3,15 +3,15 @@ from homeassistant.components.binary_sensor import (
DEVICE_CLASS_MOTION,
DOMAIN as BINARY_SENSOR_DOMAIN,
)
from homeassistant.components.zwave_mqtt.const import DOMAIN
from homeassistant.components.ozw.const import DOMAIN
from homeassistant.const import ATTR_DEVICE_CLASS
from .common import setup_zwave
from .common import setup_ozw
async def test_binary_sensor(hass, generic_data, binary_sensor_msg):
"""Test setting up config entry."""
receive_msg = await setup_zwave(hass, fixture=generic_data)
receive_msg = await setup_ozw(hass, fixture=generic_data)
# Test Legacy sensor (disabled by default)
registry = await hass.helpers.entity_registry.async_get_registry()
@ -57,7 +57,7 @@ async def test_sensor_enabled(hass, generic_data, binary_sensor_alt_msg):
)
assert entry.disabled is False
receive_msg = await setup_zwave(hass, fixture=generic_data)
receive_msg = await setup_ozw(hass, fixture=generic_data)
receive_msg(binary_sensor_alt_msg)
await hass.async_block_till_done()

View File

@ -1,7 +1,7 @@
"""Test the Z-Wave over MQTT config flow."""
from homeassistant import config_entries, setup
from homeassistant.components.zwave_mqtt.config_flow import TITLE
from homeassistant.components.zwave_mqtt.const import DOMAIN
from homeassistant.components.ozw.config_flow import TITLE
from homeassistant.components.ozw.const import DOMAIN
from tests.async_mock import patch
from tests.common import MockConfigEntry
@ -18,9 +18,9 @@ async def test_user_create_entry(hass):
assert result["errors"] is None
with patch(
"homeassistant.components.zwave_mqtt.async_setup", return_value=True
"homeassistant.components.ozw.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.zwave_mqtt.async_setup_entry", return_value=True,
"homeassistant.components.ozw.async_setup_entry", return_value=True,
) as mock_setup_entry:
result2 = await hass.config_entries.flow.async_configure(result["flow_id"], {})

View File

@ -1,18 +1,18 @@
"""Test integration initialization."""
from homeassistant import config_entries
from homeassistant.components.zwave_mqtt import DOMAIN, PLATFORMS, const
from homeassistant.components.ozw import DOMAIN, PLATFORMS, const
from .common import setup_zwave
from .common import setup_ozw
from tests.common import MockConfigEntry
async def test_init_entry(hass, generic_data):
"""Test setting up config entry."""
await setup_zwave(hass, fixture=generic_data)
await setup_ozw(hass, fixture=generic_data)
# Verify integration + platform loaded.
assert "zwave_mqtt" in hass.config.components
assert "ozw" in hass.config.components
for platform in PLATFORMS:
assert platform in hass.config.components, platform
assert f"{platform}.{DOMAIN}" in hass.config.components, f"{platform}.{DOMAIN}"
@ -32,7 +32,7 @@ async def test_unload_entry(hass, generic_data, switch_msg, caplog):
entry.add_to_hass(hass)
assert entry.state == config_entries.ENTRY_STATE_NOT_LOADED
receive_message = await setup_zwave(hass, entry=entry, fixture=generic_data)
receive_message = await setup_ozw(hass, entry=entry, fixture=generic_data)
assert entry.state == config_entries.ENTRY_STATE_LOADED
assert len(hass.states.async_entity_ids("switch")) == 1
@ -53,7 +53,7 @@ async def test_unload_entry(hass, generic_data, switch_msg, caplog):
# adding the entities.
# This asserts that we have unsubscribed the entity addition signals
# when unloading the integration previously.
await setup_zwave(hass, entry=entry, fixture=generic_data)
await setup_ozw(hass, entry=entry, fixture=generic_data)
await hass.async_block_till_done()
assert entry.state == config_entries.ENTRY_STATE_LOADED

View File

@ -1,12 +1,12 @@
"""Test Z-Wave Lights."""
from homeassistant.components.zwave_mqtt.light import byte_to_zwave_brightness
from homeassistant.components.ozw.light import byte_to_zwave_brightness
from .common import setup_zwave
from .common import setup_ozw
async def test_light(hass, light_data, light_msg, sent_messages):
"""Test setting up config entry."""
receive_message = await setup_zwave(hass, fixture=light_data)
receive_message = await setup_ozw(hass, fixture=light_data)
# Test loaded
state = hass.states.get("light.led_bulb_6_multi_colour_level")

View File

@ -1,5 +1,5 @@
"""Test Z-Wave (central) Scenes."""
from .common import MQTTMessage, setup_zwave
from .common import MQTTMessage, setup_ozw
from tests.common import async_capture_events
@ -7,8 +7,8 @@ from tests.common import async_capture_events
async def test_scenes(hass, generic_data, sent_messages):
"""Test setting up config entry."""
receive_message = await setup_zwave(hass, fixture=generic_data)
events = async_capture_events(hass, "zwave_mqtt.scene_activated")
receive_message = await setup_ozw(hass, fixture=generic_data)
events = async_capture_events(hass, "ozw.scene_activated")
# Publish fake scene event on mqtt
message = MQTTMessage(

View File

@ -1,19 +1,19 @@
"""Test Z-Wave Sensors."""
from homeassistant.components.ozw.const import DOMAIN
from homeassistant.components.sensor import (
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_POWER,
DEVICE_CLASS_PRESSURE,
DOMAIN as SENSOR_DOMAIN,
)
from homeassistant.components.zwave_mqtt.const import DOMAIN
from homeassistant.const import ATTR_DEVICE_CLASS
from .common import setup_zwave
from .common import setup_ozw
async def test_sensor(hass, generic_data):
"""Test setting up config entry."""
await setup_zwave(hass, fixture=generic_data)
await setup_ozw(hass, fixture=generic_data)
# Test standard sensor
state = hass.states.get("sensor.smart_plug_electric_v")
@ -66,7 +66,7 @@ async def test_sensor_enabled(hass, generic_data, sensor_msg):
)
assert entry.disabled is False
receive_msg = await setup_zwave(hass, fixture=generic_data)
receive_msg = await setup_ozw(hass, fixture=generic_data)
receive_msg(sensor_msg)
await hass.async_block_till_done()

View File

@ -1,10 +1,10 @@
"""Test Z-Wave Switches."""
from .common import setup_zwave
from .common import setup_ozw
async def test_switch(hass, generic_data, sent_messages, switch_msg):
"""Test setting up config entry."""
receive_message = await setup_zwave(hass, fixture=generic_data)
receive_message = await setup_ozw(hass, fixture=generic_data)
# Test loaded
state = hass.states.get("switch.smart_plug_switch")

View File

@ -1 +0,0 @@
"""Tests for the Z-Wave MQTT integration."""

View File

Can't render this file because it contains an unexpected character in line 1 and column 26.

View File

Can't render this file because it contains an unexpected character in line 1 and column 26.