Add konnected multi output (#33412)

* add test to for importing multiple output settings

* provide option to set multiple output states

* tweaks after testing

* Update homeassistant/components/konnected/config_flow.py

Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Kit KleinandMartin Hjelmare authored and GitHub committed 2020-03-29 20:05:59 -07:00
1 parent d59209ff47
commit 0e6b905cdf
5 files changed
+143 -15

No files matched your search

+57 -1
View File
@@ -403,6 +403,14 @@ async def test_import_existing_config(hass, mock_panel):
"pause": 100,
"repeat": 4,
},
{
"zone": 8,
"name": "alarm",
"activation": "low",
"momentary": 100,
"pause": 100,
"repeat": -1,
},
{"zone": "out1"},
{"zone": "alarm1"},
],
@@ -463,6 +471,14 @@ async def test_import_existing_config(hass, mock_panel):
"pause": 100,
"repeat": 4,
},
{
"zone": "8",
"name": "alarm",
"activation": "low",
"momentary": 100,
"pause": 100,
"repeat": -1,
},
{"activation": "high", "zone": "out1"},
{"activation": "high", "zone": "alarm1"},
],
@@ -713,6 +729,7 @@ async def test_option_flow(hass, mock_panel):
assert result["step_id"] == "options_switch"
assert result["description_placeholders"] == {
"zone": "Zone 4",
"state": "1",
}
# zone 4
@@ -723,6 +740,7 @@ async def test_option_flow(hass, mock_panel):
assert result["step_id"] == "options_switch"
assert result["description_placeholders"] == {
"zone": "OUT",
"state": "1",
}
# zone out
@@ -734,6 +752,27 @@ async def test_option_flow(hass, mock_panel):
"momentary": 50,
"pause": 100,
"repeat": 4,
"more_states": "Yes",
},
)
assert result["type"] == "form"
assert result["step_id"] == "options_switch"
assert result["description_placeholders"] == {
"zone": "OUT",
"state": "2",
}
# zone out - state 2
result = await hass.config_entries.options.async_configure(
result["flow_id"],
user_input={
"name": "alarm",
"activation": "low",
"momentary": 100,
"pause": 100,
"repeat": -1,
"more_states": "No",
},
)
@@ -768,6 +807,14 @@ async def test_option_flow(hass, mock_panel):
"pause": 100,
"repeat": 4,
},
{
"zone": "out",
"name": "alarm",
"activation": "low",
"momentary": 100,
"pause": 100,
"repeat": -1,
},
],
}
@@ -977,6 +1024,14 @@ async def test_option_flow_import(hass, mock_panel):
"pause": 100,
"repeat": 4,
},
{
"zone": "3",
"name": "alarm",
"activation": "low",
"momentary": 100,
"pause": 100,
"repeat": -1,
},
],
}
)
@@ -1056,8 +1111,9 @@ async def test_option_flow_import(hass, mock_panel):
assert schema["momentary"] == 50
assert schema["pause"] == 100
assert schema["repeat"] == 4
assert schema["more_states"] == "Yes"
result = await hass.config_entries.options.async_configure(
result["flow_id"], user_input={"activation": "high"}
result["flow_id"], user_input={"activation": "high", "more_states": "No"}
)
assert result["type"] == "form"
assert result["step_id"] == "options_misc"
+36 -2
View File
@@ -124,7 +124,7 @@ async def test_config_schema(hass):
}
}
# check pin to zone
# check pin to zone and multiple output
config = {
konnected.DOMAIN: {
konnected.CONF_ACCESS_TOKEN: "abcdefgh",
@@ -135,6 +135,22 @@ async def test_config_schema(hass):
{"pin": 2, "type": "door"},
{"zone": 1, "type": "door"},
],
"switches": [
{
"zone": 3,
"name": "Beep Beep",
"momentary": 65,
"pause": 55,
"repeat": 4,
},
{
"zone": 3,
"name": "Warning",
"momentary": 100,
"pause": 100,
"repeat": -1,
},
],
}
],
}
@@ -153,7 +169,7 @@ async def test_config_schema(hass):
"11": "Disabled",
"12": "Disabled",
"2": "Binary Sensor",
"3": "Disabled",
"3": "Switchable Output",
"4": "Disabled",
"5": "Disabled",
"6": "Disabled",
@@ -169,6 +185,24 @@ async def test_config_schema(hass):
{"inverse": False, "type": "door", "zone": "2"},
{"inverse": False, "type": "door", "zone": "1"},
],
"switches": [
{
"zone": "3",
"activation": "high",
"name": "Beep Beep",
"momentary": 65,
"pause": 55,
"repeat": 4,
},
{
"zone": "3",
"activation": "high",
"name": "Warning",
"momentary": 100,
"pause": 100,
"repeat": -1,
},
],
},
"id": "aabbccddeeff",
}