init home-assistant
This commit is contained in:
1
home-assistant/tests/components/rainmachine/__init__.py
Normal file
1
home-assistant/tests/components/rainmachine/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
"""Define tests for the RainMachine component."""
|
||||
169
home-assistant/tests/components/rainmachine/conftest.py
Normal file
169
home-assistant/tests/components/rainmachine/conftest.py
Normal file
@@ -0,0 +1,169 @@
|
||||
"""Define test fixtures for RainMachine."""
|
||||
|
||||
from collections.abc import AsyncGenerator
|
||||
import json
|
||||
from typing import Any
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.rainmachine import DOMAIN
|
||||
from homeassistant.const import CONF_IP_ADDRESS, CONF_PASSWORD, CONF_PORT, CONF_SSL
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import MockConfigEntry, load_fixture
|
||||
|
||||
|
||||
@pytest.fixture(name="client")
|
||||
def client_fixture(controller: AsyncMock, controller_mac: str) -> AsyncMock:
|
||||
"""Define a regenmaschine client."""
|
||||
return AsyncMock(load_local=AsyncMock(), controllers={controller_mac: controller})
|
||||
|
||||
|
||||
@pytest.fixture(name="config")
|
||||
def config_fixture() -> dict[str, Any]:
|
||||
"""Define a config entry data fixture."""
|
||||
return {
|
||||
CONF_IP_ADDRESS: "192.168.1.100",
|
||||
CONF_PASSWORD: "password",
|
||||
CONF_PORT: 8080,
|
||||
CONF_SSL: True,
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture(name="config_entry")
|
||||
def config_entry_fixture(
|
||||
hass: HomeAssistant, config: dict[str, Any], controller_mac: str
|
||||
) -> MockConfigEntry:
|
||||
"""Define a config entry fixture."""
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
unique_id=controller_mac,
|
||||
data=config,
|
||||
entry_id="81bd010ed0a63b705f6da8407cb26d4b",
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
return entry
|
||||
|
||||
|
||||
@pytest.fixture(name="controller")
|
||||
def controller_fixture(
|
||||
controller_mac,
|
||||
data_api_versions,
|
||||
data_diagnostics_current,
|
||||
data_machine_firmare_update_status,
|
||||
data_programs,
|
||||
data_provision_settings,
|
||||
data_restrictions_current,
|
||||
data_restrictions_universal,
|
||||
data_zones,
|
||||
):
|
||||
"""Define a regenmaschine controller."""
|
||||
controller = AsyncMock()
|
||||
controller.api_version = "4.5.0"
|
||||
controller.hardware_version = "3"
|
||||
controller.name = "12345"
|
||||
controller.mac = controller_mac
|
||||
controller.software_version = "4.0.925"
|
||||
|
||||
controller.api.versions.return_value = data_api_versions
|
||||
controller.diagnostics.current.return_value = data_diagnostics_current
|
||||
controller.machine.get_firmware_update_status.return_value = (
|
||||
data_machine_firmare_update_status
|
||||
)
|
||||
controller.programs.all.return_value = data_programs
|
||||
controller.provisioning.settings.return_value = data_provision_settings
|
||||
controller.restrictions.current.return_value = data_restrictions_current
|
||||
controller.restrictions.universal.return_value = data_restrictions_universal
|
||||
controller.zones.all.return_value = data_zones
|
||||
|
||||
return controller
|
||||
|
||||
|
||||
@pytest.fixture(name="controller_mac")
|
||||
def controller_mac_fixture() -> str:
|
||||
"""Define a controller MAC address."""
|
||||
return "aa:bb:cc:dd:ee:ff"
|
||||
|
||||
|
||||
@pytest.fixture(name="data_api_versions", scope="package")
|
||||
def data_api_versions_fixture():
|
||||
"""Define API version data."""
|
||||
return json.loads(load_fixture("api_versions_data.json", "rainmachine"))
|
||||
|
||||
|
||||
@pytest.fixture(name="data_diagnostics_current", scope="package")
|
||||
def data_diagnostics_current_fixture():
|
||||
"""Define current diagnostics data."""
|
||||
return json.loads(load_fixture("diagnostics_current_data.json", "rainmachine"))
|
||||
|
||||
|
||||
@pytest.fixture(name="data_machine_firmare_update_status", scope="package")
|
||||
def data_machine_firmare_update_status_fixture():
|
||||
"""Define machine firmware update status data."""
|
||||
return json.loads(
|
||||
load_fixture("machine_firmware_update_status_data.json", "rainmachine")
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(name="data_programs", scope="package")
|
||||
def data_programs_fixture():
|
||||
"""Define program data."""
|
||||
raw_data = json.loads(load_fixture("programs_data.json", "rainmachine"))
|
||||
# This replicate the process from `regenmaschine` to convert list to dict
|
||||
return {program["uid"]: program for program in raw_data}
|
||||
|
||||
|
||||
@pytest.fixture(name="data_provision_settings", scope="package")
|
||||
def data_provision_settings_fixture():
|
||||
"""Define provisioning settings data."""
|
||||
return json.loads(load_fixture("provision_settings_data.json", "rainmachine"))
|
||||
|
||||
|
||||
@pytest.fixture(name="data_restrictions_current", scope="package")
|
||||
def data_restrictions_current_fixture():
|
||||
"""Define current restrictions settings data."""
|
||||
return json.loads(load_fixture("restrictions_current_data.json", "rainmachine"))
|
||||
|
||||
|
||||
@pytest.fixture(name="data_restrictions_universal", scope="package")
|
||||
def data_restrictions_universal_fixture():
|
||||
"""Define universal restrictions settings data."""
|
||||
return json.loads(load_fixture("restrictions_universal_data.json", "rainmachine"))
|
||||
|
||||
|
||||
@pytest.fixture(name="data_zones", scope="package")
|
||||
def data_zones_fixture():
|
||||
"""Define zone data."""
|
||||
raw_data = json.loads(load_fixture("zones_data.json", "rainmachine"))
|
||||
# This replicate the process from `regenmaschine` to convert list to dict
|
||||
zone_details = json.loads(load_fixture("zones_details.json", "rainmachine"))
|
||||
|
||||
zones: dict[int, dict[str, Any]] = {}
|
||||
for zone in raw_data:
|
||||
[extra] = [z for z in zone_details if z["uid"] == zone["uid"]]
|
||||
zones[zone["uid"]] = {**zone, **extra}
|
||||
|
||||
return zones
|
||||
|
||||
|
||||
@pytest.fixture(name="setup_rainmachine")
|
||||
async def setup_rainmachine_fixture(
|
||||
hass: HomeAssistant, client: AsyncMock, config: dict[str, Any]
|
||||
) -> AsyncGenerator[None]:
|
||||
"""Define a fixture to set up RainMachine."""
|
||||
with (
|
||||
patch("homeassistant.components.rainmachine.Client", return_value=client),
|
||||
patch(
|
||||
"homeassistant.components.rainmachine.config_flow.Client",
|
||||
return_value=client,
|
||||
),
|
||||
patch(
|
||||
"homeassistant.components.rainmachine.PLATFORMS",
|
||||
[],
|
||||
),
|
||||
):
|
||||
assert await async_setup_component(hass, DOMAIN, config)
|
||||
await hass.async_block_till_done()
|
||||
yield
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"apiVer": "4.6.1",
|
||||
"hwVer": "3",
|
||||
"swVer": "4.0.1144"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"hasWifi": true,
|
||||
"uptime": "3 days, 18:14:14",
|
||||
"uptimeSeconds": 324854,
|
||||
"memUsage": 16196,
|
||||
"networkStatus": true,
|
||||
"bootCompleted": true,
|
||||
"lastCheckTimestamp": 1659895175,
|
||||
"wizardHasRun": true,
|
||||
"standaloneMode": false,
|
||||
"cpuUsage": 1,
|
||||
"lastCheck": "2022-08-07 11:59:35",
|
||||
"softwareVersion": "4.0.1144",
|
||||
"internetStatus": true,
|
||||
"locationStatus": true,
|
||||
"timeStatus": true,
|
||||
"wifiMode": null,
|
||||
"gatewayAddress": "172.16.20.1",
|
||||
"cloudStatus": 0,
|
||||
"weatherStatus": true
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"lastUpdateCheckTimestamp": 1657825288,
|
||||
"packageDetails": [],
|
||||
"update": false,
|
||||
"lastUpdateCheck": "2022-07-14 13:01:28",
|
||||
"updateStatus": 1
|
||||
}
|
||||
@@ -0,0 +1,284 @@
|
||||
[
|
||||
{
|
||||
"uid": 1,
|
||||
"name": "Morning",
|
||||
"active": true,
|
||||
"startTime": "06:00",
|
||||
"cycles": 0,
|
||||
"soak": 0,
|
||||
"cs_on": false,
|
||||
"delay": 0,
|
||||
"delay_on": false,
|
||||
"status": 0,
|
||||
"startTimeParams": {
|
||||
"offsetSign": 0,
|
||||
"type": 0,
|
||||
"offsetMinutes": 0
|
||||
},
|
||||
"frequency": {
|
||||
"type": 0,
|
||||
"param": "0"
|
||||
},
|
||||
"coef": 0,
|
||||
"ignoreInternetWeather": false,
|
||||
"futureField1": 0,
|
||||
"freq_modified": 0,
|
||||
"useWaterSense": false,
|
||||
"nextRun": "2018-06-04",
|
||||
"startDate": "2018-04-28",
|
||||
"endDate": null,
|
||||
"yearlyRecurring": true,
|
||||
"simulationExpired": false,
|
||||
"wateringTimes": [
|
||||
{
|
||||
"id": 1,
|
||||
"order": -1,
|
||||
"name": "Landscaping",
|
||||
"duration": 0,
|
||||
"active": true,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"order": -1,
|
||||
"name": "Flower Box",
|
||||
"duration": 0,
|
||||
"active": true,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"order": -1,
|
||||
"name": "TEST",
|
||||
"duration": 0,
|
||||
"active": false,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"order": -1,
|
||||
"name": "Zone 4",
|
||||
"duration": 0,
|
||||
"active": false,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"order": -1,
|
||||
"name": "Zone 5",
|
||||
"duration": 0,
|
||||
"active": false,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"order": -1,
|
||||
"name": "Zone 6",
|
||||
"duration": 0,
|
||||
"active": false,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"order": -1,
|
||||
"name": "Zone 7",
|
||||
"duration": 0,
|
||||
"active": false,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"order": -1,
|
||||
"name": "Zone 8",
|
||||
"duration": 0,
|
||||
"active": false,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"order": -1,
|
||||
"name": "Zone 9",
|
||||
"duration": 0,
|
||||
"active": false,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"order": -1,
|
||||
"name": "Zone 10",
|
||||
"duration": 0,
|
||||
"active": false,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"order": -1,
|
||||
"name": "Zone 11",
|
||||
"duration": 0,
|
||||
"active": false,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"order": -1,
|
||||
"name": "Zone 12",
|
||||
"duration": 0,
|
||||
"active": false,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"uid": 2,
|
||||
"name": "Evening",
|
||||
"active": false,
|
||||
"startTime": "06:00",
|
||||
"cycles": 0,
|
||||
"soak": 0,
|
||||
"cs_on": false,
|
||||
"delay": 0,
|
||||
"delay_on": false,
|
||||
"status": 0,
|
||||
"startTimeParams": {
|
||||
"offsetSign": 0,
|
||||
"type": 0,
|
||||
"offsetMinutes": 0
|
||||
},
|
||||
"frequency": {
|
||||
"type": 0,
|
||||
"param": "0"
|
||||
},
|
||||
"coef": 0,
|
||||
"ignoreInternetWeather": false,
|
||||
"futureField1": 0,
|
||||
"freq_modified": 0,
|
||||
"useWaterSense": false,
|
||||
"nextRun": "2018-06-04",
|
||||
"startDate": "2018-04-28",
|
||||
"endDate": null,
|
||||
"yearlyRecurring": true,
|
||||
"simulationExpired": false,
|
||||
"wateringTimes": [
|
||||
{
|
||||
"id": 1,
|
||||
"order": -1,
|
||||
"name": "Landscaping",
|
||||
"duration": 0,
|
||||
"active": true,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"order": -1,
|
||||
"name": "Flower Box",
|
||||
"duration": 0,
|
||||
"active": true,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"order": -1,
|
||||
"name": "TEST",
|
||||
"duration": 0,
|
||||
"active": false,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"order": -1,
|
||||
"name": "Zone 4",
|
||||
"duration": 0,
|
||||
"active": false,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"order": -1,
|
||||
"name": "Zone 5",
|
||||
"duration": 0,
|
||||
"active": false,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"order": -1,
|
||||
"name": "Zone 6",
|
||||
"duration": 0,
|
||||
"active": false,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"order": -1,
|
||||
"name": "Zone 7",
|
||||
"duration": 0,
|
||||
"active": false,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"order": -1,
|
||||
"name": "Zone 8",
|
||||
"duration": 0,
|
||||
"active": false,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"order": -1,
|
||||
"name": "Zone 9",
|
||||
"duration": 0,
|
||||
"active": false,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"order": -1,
|
||||
"name": "Zone 10",
|
||||
"duration": 0,
|
||||
"active": false,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"order": -1,
|
||||
"name": "Zone 11",
|
||||
"duration": 0,
|
||||
"active": false,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"order": -1,
|
||||
"name": "Zone 12",
|
||||
"duration": 0,
|
||||
"active": false,
|
||||
"userPercentage": 1,
|
||||
"minRuntimeCoef": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"system": {
|
||||
"httpEnabled": true,
|
||||
"rainSensorSnoozeDuration": 0,
|
||||
"uiUnitsMetric": false,
|
||||
"programZonesShowInactive": false,
|
||||
"programSingleSchedule": false,
|
||||
"standaloneMode": false,
|
||||
"masterValveAfter": 0,
|
||||
"touchSleepTimeout": 10,
|
||||
"selfTest": false,
|
||||
"useSoftwareRainSensor": false,
|
||||
"defaultZoneWateringDuration": 300,
|
||||
"maxLEDBrightness": 40,
|
||||
"simulatorHistorySize": 0,
|
||||
"vibration": false,
|
||||
"masterValveBefore": 0,
|
||||
"touchProgramToRun": null,
|
||||
"useRainSensor": false,
|
||||
"wizardHasRun": true,
|
||||
"waterLogHistorySize": 365,
|
||||
"netName": "Home",
|
||||
"softwareRainSensorMinQPF": 5,
|
||||
"touchAdvanced": false,
|
||||
"useBonjourService": true,
|
||||
"hardwareVersion": 3,
|
||||
"touchLongPressTimeout": 3,
|
||||
"showRestrictionsOnLed": false,
|
||||
"parserDataSizeInDays": 6,
|
||||
"programListShowInactive": true,
|
||||
"parserHistorySize": 365,
|
||||
"allowAlexaDiscovery": false,
|
||||
"automaticUpdates": true,
|
||||
"minLEDBrightness": 0,
|
||||
"minWateringDurationThreshold": 0,
|
||||
"localValveCount": 12,
|
||||
"touchAuthAPSeconds": 60,
|
||||
"useCommandLineArguments": false,
|
||||
"databasePath": "/rainmachine-app/DB/Default",
|
||||
"touchCyclePrograms": true,
|
||||
"zoneListShowInactive": true,
|
||||
"rainSensorRainStart": null,
|
||||
"zoneDuration": [
|
||||
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300
|
||||
],
|
||||
"rainSensorIsNormallyClosed": true,
|
||||
"useCorrectionForPast": true,
|
||||
"useMasterValve": false,
|
||||
"runParsersBeforePrograms": true,
|
||||
"maxWateringCoef": 2,
|
||||
"mixerHistorySize": 365
|
||||
},
|
||||
"location": {
|
||||
"elevation": 1593.45141602,
|
||||
"doyDownloaded": true,
|
||||
"zip": null,
|
||||
"windSensitivity": 0.5,
|
||||
"krs": 0.16,
|
||||
"stationID": 9172,
|
||||
"stationSource": "station",
|
||||
"et0Average": 6.578,
|
||||
"latitude": 21.037234682342,
|
||||
"state": "Default",
|
||||
"stationName": "MY STATION",
|
||||
"wsDays": 2,
|
||||
"stationDownloaded": true,
|
||||
"address": "Default",
|
||||
"rainSensitivity": 0.8,
|
||||
"timezone": "America/Los Angeles",
|
||||
"longitude": -87.12872612,
|
||||
"name": "Home"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"hourly": false,
|
||||
"freeze": false,
|
||||
"month": false,
|
||||
"weekDay": false,
|
||||
"rainDelay": false,
|
||||
"rainDelayCounter": -1,
|
||||
"rainSensor": false
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"hotDaysExtraWatering": false,
|
||||
"freezeProtectEnabled": true,
|
||||
"freezeProtectTemp": 2,
|
||||
"noWaterInWeekDays": "0000000",
|
||||
"noWaterInMonths": "000000000000",
|
||||
"rainDelayStartTime": 1524854551,
|
||||
"rainDelayDuration": 0
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
[
|
||||
{
|
||||
"uid": 1,
|
||||
"name": "Landscaping",
|
||||
"state": 0,
|
||||
"active": true,
|
||||
"userDuration": 0,
|
||||
"machineDuration": 0,
|
||||
"remaining": 0,
|
||||
"cycle": 0,
|
||||
"noOfCycles": 0,
|
||||
"restriction": false,
|
||||
"type": 4,
|
||||
"master": false,
|
||||
"waterSense": false
|
||||
},
|
||||
{
|
||||
"uid": 2,
|
||||
"name": "Flower Box",
|
||||
"state": 0,
|
||||
"active": true,
|
||||
"userDuration": 0,
|
||||
"machineDuration": 0,
|
||||
"remaining": 0,
|
||||
"cycle": 0,
|
||||
"noOfCycles": 0,
|
||||
"restriction": false,
|
||||
"type": 5,
|
||||
"master": false,
|
||||
"waterSense": false
|
||||
},
|
||||
{
|
||||
"uid": 3,
|
||||
"name": "TEST",
|
||||
"state": 0,
|
||||
"active": false,
|
||||
"userDuration": 0,
|
||||
"machineDuration": 0,
|
||||
"remaining": 0,
|
||||
"cycle": 0,
|
||||
"noOfCycles": 0,
|
||||
"restriction": false,
|
||||
"type": 9,
|
||||
"master": false,
|
||||
"waterSense": false
|
||||
},
|
||||
{
|
||||
"uid": 4,
|
||||
"name": "Zone 4",
|
||||
"state": 0,
|
||||
"active": false,
|
||||
"userDuration": 0,
|
||||
"machineDuration": 0,
|
||||
"remaining": 0,
|
||||
"cycle": 0,
|
||||
"noOfCycles": 0,
|
||||
"restriction": false,
|
||||
"type": 2,
|
||||
"master": false,
|
||||
"waterSense": false
|
||||
},
|
||||
{
|
||||
"uid": 5,
|
||||
"name": "Zone 5",
|
||||
"state": 0,
|
||||
"active": false,
|
||||
"userDuration": 0,
|
||||
"machineDuration": 0,
|
||||
"remaining": 0,
|
||||
"cycle": 0,
|
||||
"noOfCycles": 0,
|
||||
"restriction": false,
|
||||
"type": 2,
|
||||
"master": false,
|
||||
"waterSense": false
|
||||
},
|
||||
{
|
||||
"uid": 6,
|
||||
"name": "Zone 6",
|
||||
"state": 0,
|
||||
"active": false,
|
||||
"userDuration": 0,
|
||||
"machineDuration": 0,
|
||||
"remaining": 0,
|
||||
"cycle": 0,
|
||||
"noOfCycles": 0,
|
||||
"restriction": false,
|
||||
"type": 2,
|
||||
"master": false,
|
||||
"waterSense": false
|
||||
},
|
||||
{
|
||||
"uid": 7,
|
||||
"name": "Zone 7",
|
||||
"state": 0,
|
||||
"active": false,
|
||||
"userDuration": 0,
|
||||
"machineDuration": 0,
|
||||
"remaining": 0,
|
||||
"cycle": 0,
|
||||
"noOfCycles": 0,
|
||||
"restriction": false,
|
||||
"type": 2,
|
||||
"master": false,
|
||||
"waterSense": false
|
||||
},
|
||||
{
|
||||
"uid": 8,
|
||||
"name": "Zone 8",
|
||||
"state": 0,
|
||||
"active": false,
|
||||
"userDuration": 0,
|
||||
"machineDuration": 0,
|
||||
"remaining": 0,
|
||||
"cycle": 0,
|
||||
"noOfCycles": 0,
|
||||
"restriction": false,
|
||||
"type": 2,
|
||||
"master": false,
|
||||
"waterSense": false
|
||||
},
|
||||
{
|
||||
"uid": 9,
|
||||
"name": "Zone 9",
|
||||
"state": 0,
|
||||
"active": false,
|
||||
"userDuration": 0,
|
||||
"machineDuration": 0,
|
||||
"remaining": 0,
|
||||
"cycle": 0,
|
||||
"noOfCycles": 0,
|
||||
"restriction": false,
|
||||
"type": 2,
|
||||
"master": false,
|
||||
"waterSense": false
|
||||
},
|
||||
{
|
||||
"uid": 10,
|
||||
"name": "Zone 10",
|
||||
"state": 0,
|
||||
"active": false,
|
||||
"userDuration": 0,
|
||||
"machineDuration": 0,
|
||||
"remaining": 0,
|
||||
"cycle": 0,
|
||||
"noOfCycles": 0,
|
||||
"restriction": false,
|
||||
"type": 2,
|
||||
"master": false,
|
||||
"waterSense": false
|
||||
},
|
||||
{
|
||||
"uid": 11,
|
||||
"name": "Zone 11",
|
||||
"state": 0,
|
||||
"active": false,
|
||||
"userDuration": 0,
|
||||
"machineDuration": 0,
|
||||
"remaining": 0,
|
||||
"cycle": 0,
|
||||
"noOfCycles": 0,
|
||||
"restriction": false,
|
||||
"type": 2,
|
||||
"master": false,
|
||||
"waterSense": false
|
||||
},
|
||||
{
|
||||
"uid": 12,
|
||||
"name": "Zone 12",
|
||||
"state": 0,
|
||||
"active": false,
|
||||
"userDuration": 0,
|
||||
"machineDuration": 0,
|
||||
"remaining": 0,
|
||||
"cycle": 0,
|
||||
"noOfCycles": 0,
|
||||
"restriction": false,
|
||||
"type": 2,
|
||||
"master": false,
|
||||
"waterSense": false
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,482 @@
|
||||
[
|
||||
{
|
||||
"uid": 1,
|
||||
"name": "Landscaping",
|
||||
"valveid": 1,
|
||||
"ETcoef": 0.80000000000000004,
|
||||
"active": true,
|
||||
"type": 4,
|
||||
"internet": true,
|
||||
"savings": 100,
|
||||
"slope": 1,
|
||||
"sun": 1,
|
||||
"soil": 5,
|
||||
"group_id": 4,
|
||||
"history": true,
|
||||
"master": false,
|
||||
"before": 0,
|
||||
"after": 0,
|
||||
"waterSense": {
|
||||
"fieldCapacity": 0.17000000000000001,
|
||||
"rootDepth": 229,
|
||||
"minRuntime": 0,
|
||||
"appEfficiency": 0.75,
|
||||
"isTallPlant": true,
|
||||
"permWilting": 0.029999999999999999,
|
||||
"allowedSurfaceAcc": 8.3800000000000008,
|
||||
"maxAllowedDepletion": 0.5,
|
||||
"precipitationRate": 25.399999999999999,
|
||||
"currentFieldCapacity": 16.030000000000001,
|
||||
"area": 92.900001525878906,
|
||||
"referenceTime": 1243,
|
||||
"detailedMonthsKc": [
|
||||
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
|
||||
],
|
||||
"flowrate": null,
|
||||
"soilIntakeRate": 10.16
|
||||
},
|
||||
"customSoilPreset": null,
|
||||
"customVegetationPreset": null,
|
||||
"customSprinklerPreset": null
|
||||
},
|
||||
{
|
||||
"uid": 2,
|
||||
"name": "Flower Box",
|
||||
"valveid": 2,
|
||||
"ETcoef": 0.80000000000000004,
|
||||
"active": true,
|
||||
"type": 5,
|
||||
"internet": true,
|
||||
"savings": 100,
|
||||
"slope": 1,
|
||||
"sun": 1,
|
||||
"soil": 5,
|
||||
"group_id": 3,
|
||||
"history": true,
|
||||
"master": false,
|
||||
"before": 0,
|
||||
"after": 0,
|
||||
"waterSense": {
|
||||
"fieldCapacity": 0.17000000000000001,
|
||||
"rootDepth": 457,
|
||||
"minRuntime": 5,
|
||||
"appEfficiency": 0.80000000000000004,
|
||||
"isTallPlant": true,
|
||||
"permWilting": 0.029999999999999999,
|
||||
"allowedSurfaceAcc": 8.3800000000000008,
|
||||
"maxAllowedDepletion": 0.34999999999999998,
|
||||
"precipitationRate": 12.699999999999999,
|
||||
"currentFieldCapacity": 22.390000000000001,
|
||||
"area": 92.900000000000006,
|
||||
"referenceTime": 2680,
|
||||
"detailedMonthsKc": [
|
||||
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
|
||||
],
|
||||
"flowrate": null,
|
||||
"soilIntakeRate": 10.16
|
||||
},
|
||||
"customSoilPreset": null,
|
||||
"customVegetationPreset": null,
|
||||
"customSprinklerPreset": null
|
||||
},
|
||||
{
|
||||
"uid": 3,
|
||||
"name": "TEST",
|
||||
"valveid": 3,
|
||||
"ETcoef": 0.80000000000000004,
|
||||
"active": false,
|
||||
"type": 9,
|
||||
"internet": true,
|
||||
"savings": 100,
|
||||
"slope": 1,
|
||||
"sun": 1,
|
||||
"soil": 1,
|
||||
"group_id": 1,
|
||||
"history": true,
|
||||
"master": false,
|
||||
"before": 0,
|
||||
"after": 0,
|
||||
"waterSense": {
|
||||
"fieldCapacity": 0.29999999999999999,
|
||||
"rootDepth": 700,
|
||||
"minRuntime": 0,
|
||||
"appEfficiency": 0.69999999999999996,
|
||||
"isTallPlant": true,
|
||||
"permWilting": 0.029999999999999999,
|
||||
"allowedSurfaceAcc": 6.5999999999999996,
|
||||
"maxAllowedDepletion": 0.59999999999999998,
|
||||
"precipitationRate": 35.560000000000002,
|
||||
"currentFieldCapacity": 113.40000000000001,
|
||||
"area": 92.900000000000006,
|
||||
"referenceTime": 380,
|
||||
"detailedMonthsKc": [
|
||||
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
|
||||
],
|
||||
"flowrate": null,
|
||||
"soilIntakeRate": 5.0800000000000001
|
||||
},
|
||||
"customSoilPreset": null,
|
||||
"customVegetationPreset": null,
|
||||
"customSprinklerPreset": null
|
||||
},
|
||||
{
|
||||
"uid": 4,
|
||||
"name": "Zone 4",
|
||||
"valveid": 4,
|
||||
"ETcoef": 0.80000000000000004,
|
||||
"active": false,
|
||||
"type": 2,
|
||||
"internet": true,
|
||||
"savings": 100,
|
||||
"slope": 1,
|
||||
"sun": 1,
|
||||
"soil": 1,
|
||||
"group_id": 1,
|
||||
"history": true,
|
||||
"master": false,
|
||||
"before": 0,
|
||||
"after": 0,
|
||||
"waterSense": {
|
||||
"fieldCapacity": 0.29999999999999999,
|
||||
"rootDepth": 203,
|
||||
"minRuntime": -1,
|
||||
"appEfficiency": 0.69999999999999996,
|
||||
"isTallPlant": false,
|
||||
"permWilting": 0.029999999999999999,
|
||||
"allowedSurfaceAcc": 6.5999999999999996,
|
||||
"maxAllowedDepletion": 0.40000000000000002,
|
||||
"precipitationRate": 35.560000000000002,
|
||||
"currentFieldCapacity": 21.920000000000002,
|
||||
"area": 92.900000000000006,
|
||||
"referenceTime": 761,
|
||||
"detailedMonthsKc": [
|
||||
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
|
||||
],
|
||||
"flowrate": 0.0,
|
||||
"soilIntakeRate": 5.0800000000000001
|
||||
},
|
||||
"customSoilPreset": null,
|
||||
"customVegetationPreset": null,
|
||||
"customSprinklerPreset": null
|
||||
},
|
||||
{
|
||||
"uid": 5,
|
||||
"name": "Zone 5",
|
||||
"valveid": 5,
|
||||
"ETcoef": 0.80000000000000004,
|
||||
"active": false,
|
||||
"type": 2,
|
||||
"internet": true,
|
||||
"savings": 100,
|
||||
"slope": 1,
|
||||
"sun": 1,
|
||||
"soil": 1,
|
||||
"group_id": 1,
|
||||
"history": true,
|
||||
"master": false,
|
||||
"before": 0,
|
||||
"after": 0,
|
||||
"waterSense": {
|
||||
"fieldCapacity": 0.29999999999999999,
|
||||
"rootDepth": 203,
|
||||
"minRuntime": -1,
|
||||
"appEfficiency": 0.69999999999999996,
|
||||
"isTallPlant": false,
|
||||
"permWilting": 0.029999999999999999,
|
||||
"allowedSurfaceAcc": 6.5999999999999996,
|
||||
"maxAllowedDepletion": 0.40000000000000002,
|
||||
"precipitationRate": 35.560000000000002,
|
||||
"currentFieldCapacity": 21.920000000000002,
|
||||
"area": 92.900000000000006,
|
||||
"referenceTime": 761,
|
||||
"detailedMonthsKc": [
|
||||
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
|
||||
],
|
||||
"flowrate": 0.0,
|
||||
"soilIntakeRate": 5.0800000000000001
|
||||
},
|
||||
"customSoilPreset": null,
|
||||
"customVegetationPreset": null,
|
||||
"customSprinklerPreset": null
|
||||
},
|
||||
{
|
||||
"uid": 6,
|
||||
"name": "Zone 6",
|
||||
"valveid": 6,
|
||||
"ETcoef": 0.80000000000000004,
|
||||
"active": false,
|
||||
"type": 2,
|
||||
"internet": true,
|
||||
"savings": 100,
|
||||
"slope": 1,
|
||||
"sun": 1,
|
||||
"soil": 1,
|
||||
"group_id": 1,
|
||||
"history": true,
|
||||
"master": false,
|
||||
"before": 0,
|
||||
"after": 0,
|
||||
"waterSense": {
|
||||
"fieldCapacity": 0.29999999999999999,
|
||||
"rootDepth": 203,
|
||||
"minRuntime": -1,
|
||||
"appEfficiency": 0.69999999999999996,
|
||||
"isTallPlant": false,
|
||||
"permWilting": 0.029999999999999999,
|
||||
"allowedSurfaceAcc": 6.5999999999999996,
|
||||
"maxAllowedDepletion": 0.40000000000000002,
|
||||
"precipitationRate": 35.560000000000002,
|
||||
"currentFieldCapacity": 21.920000000000002,
|
||||
"area": 92.900000000000006,
|
||||
"referenceTime": 761,
|
||||
"detailedMonthsKc": [
|
||||
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
|
||||
],
|
||||
"flowrate": 0.0,
|
||||
"soilIntakeRate": 5.0800000000000001
|
||||
},
|
||||
"customSoilPreset": null,
|
||||
"customVegetationPreset": null,
|
||||
"customSprinklerPreset": null
|
||||
},
|
||||
{
|
||||
"uid": 7,
|
||||
"name": "Zone 7",
|
||||
"valveid": 7,
|
||||
"ETcoef": 0.80000000000000004,
|
||||
"active": false,
|
||||
"type": 2,
|
||||
"internet": true,
|
||||
"savings": 100,
|
||||
"slope": 1,
|
||||
"sun": 1,
|
||||
"soil": 1,
|
||||
"group_id": 1,
|
||||
"history": true,
|
||||
"master": false,
|
||||
"before": 0,
|
||||
"after": 0,
|
||||
"waterSense": {
|
||||
"fieldCapacity": 0.29999999999999999,
|
||||
"rootDepth": 203,
|
||||
"minRuntime": -1,
|
||||
"appEfficiency": 0.69999999999999996,
|
||||
"isTallPlant": false,
|
||||
"permWilting": 0.029999999999999999,
|
||||
"allowedSurfaceAcc": 6.5999999999999996,
|
||||
"maxAllowedDepletion": 0.40000000000000002,
|
||||
"precipitationRate": 35.560000000000002,
|
||||
"currentFieldCapacity": 21.920000000000002,
|
||||
"area": 92.900000000000006,
|
||||
"referenceTime": 761,
|
||||
"detailedMonthsKc": [
|
||||
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
|
||||
],
|
||||
"flowrate": 0.0,
|
||||
"soilIntakeRate": 5.0800000000000001
|
||||
},
|
||||
"customSoilPreset": null,
|
||||
"customVegetationPreset": null,
|
||||
"customSprinklerPreset": null
|
||||
},
|
||||
{
|
||||
"uid": 8,
|
||||
"name": "Zone 8",
|
||||
"valveid": 8,
|
||||
"ETcoef": 0.80000000000000004,
|
||||
"active": false,
|
||||
"type": 2,
|
||||
"internet": true,
|
||||
"savings": 100,
|
||||
"slope": 1,
|
||||
"sun": 1,
|
||||
"soil": 1,
|
||||
"group_id": 1,
|
||||
"history": true,
|
||||
"master": false,
|
||||
"before": 0,
|
||||
"after": 0,
|
||||
"waterSense": {
|
||||
"fieldCapacity": 0.29999999999999999,
|
||||
"rootDepth": 203,
|
||||
"minRuntime": -1,
|
||||
"appEfficiency": 0.69999999999999996,
|
||||
"isTallPlant": false,
|
||||
"permWilting": 0.029999999999999999,
|
||||
"allowedSurfaceAcc": 6.5999999999999996,
|
||||
"maxAllowedDepletion": 0.40000000000000002,
|
||||
"precipitationRate": 35.560000000000002,
|
||||
"currentFieldCapacity": 21.920000000000002,
|
||||
"area": 92.900000000000006,
|
||||
"referenceTime": 761,
|
||||
"detailedMonthsKc": [
|
||||
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
|
||||
],
|
||||
"flowrate": 0.0,
|
||||
"soilIntakeRate": 5.0800000000000001
|
||||
},
|
||||
"customSoilPreset": null,
|
||||
"customVegetationPreset": null,
|
||||
"customSprinklerPreset": null
|
||||
},
|
||||
{
|
||||
"uid": 9,
|
||||
"name": "Zone 9",
|
||||
"valveid": 9,
|
||||
"ETcoef": 0.80000000000000004,
|
||||
"active": false,
|
||||
"type": 2,
|
||||
"internet": true,
|
||||
"savings": 100,
|
||||
"slope": 1,
|
||||
"sun": 1,
|
||||
"soil": 1,
|
||||
"group_id": 1,
|
||||
"history": true,
|
||||
"master": false,
|
||||
"before": 0,
|
||||
"after": 0,
|
||||
"waterSense": {
|
||||
"fieldCapacity": 0.29999999999999999,
|
||||
"rootDepth": 203,
|
||||
"minRuntime": -1,
|
||||
"appEfficiency": 0.69999999999999996,
|
||||
"isTallPlant": false,
|
||||
"permWilting": 0.029999999999999999,
|
||||
"allowedSurfaceAcc": 6.5999999999999996,
|
||||
"maxAllowedDepletion": 0.40000000000000002,
|
||||
"precipitationRate": 35.560000000000002,
|
||||
"currentFieldCapacity": 21.920000000000002,
|
||||
"area": 92.900000000000006,
|
||||
"referenceTime": 761,
|
||||
"detailedMonthsKc": [
|
||||
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
|
||||
],
|
||||
"flowrate": 0.0,
|
||||
"soilIntakeRate": 5.0800000000000001
|
||||
},
|
||||
"customSoilPreset": null,
|
||||
"customVegetationPreset": null,
|
||||
"customSprinklerPreset": null
|
||||
},
|
||||
{
|
||||
"uid": 10,
|
||||
"name": "Zone 10",
|
||||
"valveid": 10,
|
||||
"ETcoef": 0.80000000000000004,
|
||||
"active": false,
|
||||
"type": 2,
|
||||
"internet": true,
|
||||
"savings": 100,
|
||||
"slope": 1,
|
||||
"sun": 1,
|
||||
"soil": 1,
|
||||
"group_id": 1,
|
||||
"history": true,
|
||||
"master": false,
|
||||
"before": 0,
|
||||
"after": 0,
|
||||
"waterSense": {
|
||||
"fieldCapacity": 0.29999999999999999,
|
||||
"rootDepth": 203,
|
||||
"minRuntime": -1,
|
||||
"appEfficiency": 0.69999999999999996,
|
||||
"isTallPlant": false,
|
||||
"permWilting": 0.029999999999999999,
|
||||
"allowedSurfaceAcc": 6.5999999999999996,
|
||||
"maxAllowedDepletion": 0.40000000000000002,
|
||||
"precipitationRate": 35.560000000000002,
|
||||
"currentFieldCapacity": 21.920000000000002,
|
||||
"area": 92.900000000000006,
|
||||
"referenceTime": 761,
|
||||
"detailedMonthsKc": [
|
||||
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
|
||||
],
|
||||
"flowrate": 0.0,
|
||||
"soilIntakeRate": 5.0800000000000001
|
||||
},
|
||||
"customSoilPreset": null,
|
||||
"customVegetationPreset": null,
|
||||
"customSprinklerPreset": null
|
||||
},
|
||||
{
|
||||
"uid": 11,
|
||||
"name": "Zone 11",
|
||||
"valveid": 11,
|
||||
"ETcoef": 0.80000000000000004,
|
||||
"active": false,
|
||||
"type": 2,
|
||||
"internet": true,
|
||||
"savings": 100,
|
||||
"slope": 1,
|
||||
"sun": 1,
|
||||
"soil": 1,
|
||||
"group_id": 1,
|
||||
"history": true,
|
||||
"master": false,
|
||||
"before": 0,
|
||||
"after": 0,
|
||||
"waterSense": {
|
||||
"fieldCapacity": 0.29999999999999999,
|
||||
"rootDepth": 203,
|
||||
"minRuntime": -1,
|
||||
"appEfficiency": 0.69999999999999996,
|
||||
"isTallPlant": false,
|
||||
"permWilting": 0.029999999999999999,
|
||||
"allowedSurfaceAcc": 6.5999999999999996,
|
||||
"maxAllowedDepletion": 0.40000000000000002,
|
||||
"precipitationRate": 35.560000000000002,
|
||||
"currentFieldCapacity": 21.920000000000002,
|
||||
"area": 92.900000000000006,
|
||||
"referenceTime": 761,
|
||||
"detailedMonthsKc": [
|
||||
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
|
||||
],
|
||||
"flowrate": 0.0,
|
||||
"soilIntakeRate": 5.0800000000000001
|
||||
},
|
||||
"customSoilPreset": null,
|
||||
"customVegetationPreset": null,
|
||||
"customSprinklerPreset": null
|
||||
},
|
||||
{
|
||||
"uid": 12,
|
||||
"name": "Zone 12",
|
||||
"valveid": 12,
|
||||
"ETcoef": 0.80000000000000004,
|
||||
"active": false,
|
||||
"type": 2,
|
||||
"internet": true,
|
||||
"savings": 100,
|
||||
"slope": 1,
|
||||
"sun": 1,
|
||||
"soil": 1,
|
||||
"group_id": 1,
|
||||
"history": true,
|
||||
"master": false,
|
||||
"before": 0,
|
||||
"after": 0,
|
||||
"waterSense": {
|
||||
"fieldCapacity": 0.29999999999999999,
|
||||
"rootDepth": 203,
|
||||
"minRuntime": -1,
|
||||
"appEfficiency": 0.69999999999999996,
|
||||
"isTallPlant": false,
|
||||
"permWilting": 0.029999999999999999,
|
||||
"allowedSurfaceAcc": 6.5999999999999996,
|
||||
"maxAllowedDepletion": 0.40000000000000002,
|
||||
"precipitationRate": 35.560000000000002,
|
||||
"currentFieldCapacity": 21.920000000000002,
|
||||
"area": 92.900000000000006,
|
||||
"referenceTime": 761,
|
||||
"detailedMonthsKc": [
|
||||
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
|
||||
],
|
||||
"flowrate": 0.0,
|
||||
"soilIntakeRate": 5.0800000000000001
|
||||
},
|
||||
"customSoilPreset": null,
|
||||
"customVegetationPreset": null,
|
||||
"customSprinklerPreset": null
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,277 @@
|
||||
# serializer version: 1
|
||||
# name: test_binary_sensors[binary_sensor.12345_freeze_restrictions-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'binary_sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'binary_sensor.12345_freeze_restrictions',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Freeze restrictions',
|
||||
'platform': 'rainmachine',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'freeze',
|
||||
'unique_id': 'aa:bb:cc:dd:ee:ff_freeze',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_binary_sensors[binary_sensor.12345_freeze_restrictions-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': '12345 Freeze restrictions',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'binary_sensor.12345_freeze_restrictions',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_binary_sensors[binary_sensor.12345_hourly_restrictions-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'binary_sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'binary_sensor.12345_hourly_restrictions',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Hourly restrictions',
|
||||
'platform': 'rainmachine',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'hourly',
|
||||
'unique_id': 'aa:bb:cc:dd:ee:ff_hourly',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_binary_sensors[binary_sensor.12345_hourly_restrictions-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': '12345 Hourly restrictions',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'binary_sensor.12345_hourly_restrictions',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_binary_sensors[binary_sensor.12345_month_restrictions-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'binary_sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'binary_sensor.12345_month_restrictions',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Month restrictions',
|
||||
'platform': 'rainmachine',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'month',
|
||||
'unique_id': 'aa:bb:cc:dd:ee:ff_month',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_binary_sensors[binary_sensor.12345_month_restrictions-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': '12345 Month restrictions',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'binary_sensor.12345_month_restrictions',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_binary_sensors[binary_sensor.12345_rain_delay_restrictions-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'binary_sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'binary_sensor.12345_rain_delay_restrictions',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Rain delay restrictions',
|
||||
'platform': 'rainmachine',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'raindelay',
|
||||
'unique_id': 'aa:bb:cc:dd:ee:ff_raindelay',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_binary_sensors[binary_sensor.12345_rain_delay_restrictions-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': '12345 Rain delay restrictions',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'binary_sensor.12345_rain_delay_restrictions',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_binary_sensors[binary_sensor.12345_rain_sensor_restrictions-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'binary_sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'binary_sensor.12345_rain_sensor_restrictions',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Rain sensor restrictions',
|
||||
'platform': 'rainmachine',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'rainsensor',
|
||||
'unique_id': 'aa:bb:cc:dd:ee:ff_rainsensor',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_binary_sensors[binary_sensor.12345_rain_sensor_restrictions-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': '12345 Rain sensor restrictions',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'binary_sensor.12345_rain_sensor_restrictions',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_binary_sensors[binary_sensor.12345_weekday_restrictions-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'binary_sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'binary_sensor.12345_weekday_restrictions',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Weekday restrictions',
|
||||
'platform': 'rainmachine',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'weekday',
|
||||
'unique_id': 'aa:bb:cc:dd:ee:ff_weekday',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_binary_sensors[binary_sensor.12345_weekday_restrictions-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': '12345 Weekday restrictions',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'binary_sensor.12345_weekday_restrictions',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
@@ -0,0 +1,48 @@
|
||||
# serializer version: 1
|
||||
# name: test_buttons[button.12345_restart-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'button',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'button.12345_restart',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <ButtonDeviceClass.RESTART: 'restart'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Restart',
|
||||
'platform': 'rainmachine',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'aa:bb:cc:dd:ee:ff_reboot',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_buttons[button.12345_restart-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'restart',
|
||||
'friendly_name': '12345 Restart',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'button.12345_restart',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,60 @@
|
||||
# serializer version: 1
|
||||
# name: test_select_entities[select.12345_freeze_protection_temperature-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'options': list([
|
||||
'0°C',
|
||||
'2°C',
|
||||
'5°C',
|
||||
'10°C',
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'select',
|
||||
'entity_category': <EntityCategory.CONFIG: 'config'>,
|
||||
'entity_id': 'select.12345_freeze_protection_temperature',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Freeze protection temperature',
|
||||
'platform': 'rainmachine',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'freeze_protection_temperature',
|
||||
'unique_id': 'aa:bb:cc:dd:ee:ff_freeze_protection_temperature',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_select_entities[select.12345_freeze_protection_temperature-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': '12345 Freeze protection temperature',
|
||||
'options': list([
|
||||
'0°C',
|
||||
'2°C',
|
||||
'5°C',
|
||||
'10°C',
|
||||
]),
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'select.12345_freeze_protection_temperature',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '2°C',
|
||||
})
|
||||
# ---
|
||||
@@ -0,0 +1,707 @@
|
||||
# serializer version: 1
|
||||
# name: test_sensors[sensor.12345_evening_run_completion_time-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.12345_evening_run_completion_time',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.TIMESTAMP: 'timestamp'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Evening Run Completion Time',
|
||||
'platform': 'rainmachine',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'aa:bb:cc:dd:ee:ff_program_run_completion_time_2',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_evening_run_completion_time-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'timestamp',
|
||||
'friendly_name': '12345 Evening Run Completion Time',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.12345_evening_run_completion_time',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_flower_box_run_completion_time-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.12345_flower_box_run_completion_time',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.TIMESTAMP: 'timestamp'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Flower Box Run Completion Time',
|
||||
'platform': 'rainmachine',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'aa:bb:cc:dd:ee:ff_zone_run_completion_time_2',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_flower_box_run_completion_time-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'timestamp',
|
||||
'friendly_name': '12345 Flower Box Run Completion Time',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.12345_flower_box_run_completion_time',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_landscaping_run_completion_time-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.12345_landscaping_run_completion_time',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.TIMESTAMP: 'timestamp'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Landscaping Run Completion Time',
|
||||
'platform': 'rainmachine',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'aa:bb:cc:dd:ee:ff_zone_run_completion_time_1',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_landscaping_run_completion_time-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'timestamp',
|
||||
'friendly_name': '12345 Landscaping Run Completion Time',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.12345_landscaping_run_completion_time',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_morning_run_completion_time-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.12345_morning_run_completion_time',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.TIMESTAMP: 'timestamp'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Morning Run Completion Time',
|
||||
'platform': 'rainmachine',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'aa:bb:cc:dd:ee:ff_program_run_completion_time_1',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_morning_run_completion_time-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'timestamp',
|
||||
'friendly_name': '12345 Morning Run Completion Time',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.12345_morning_run_completion_time',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_rain_sensor_rain_start-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.12345_rain_sensor_rain_start',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.TIMESTAMP: 'timestamp'>,
|
||||
'original_icon': 'mdi:weather-pouring',
|
||||
'original_name': 'Rain sensor rain start',
|
||||
'platform': 'rainmachine',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'rain_sensor_rain_start',
|
||||
'unique_id': 'aa:bb:cc:dd:ee:ff_rain_sensor_rain_start',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_rain_sensor_rain_start-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'timestamp',
|
||||
'friendly_name': '12345 Rain sensor rain start',
|
||||
'icon': 'mdi:weather-pouring',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.12345_rain_sensor_rain_start',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_test_run_completion_time-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.12345_test_run_completion_time',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.TIMESTAMP: 'timestamp'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'TEST Run Completion Time',
|
||||
'platform': 'rainmachine',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'aa:bb:cc:dd:ee:ff_zone_run_completion_time_3',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_test_run_completion_time-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'timestamp',
|
||||
'friendly_name': '12345 TEST Run Completion Time',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.12345_test_run_completion_time',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_zone_10_run_completion_time-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.12345_zone_10_run_completion_time',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.TIMESTAMP: 'timestamp'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Zone 10 Run Completion Time',
|
||||
'platform': 'rainmachine',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'aa:bb:cc:dd:ee:ff_zone_run_completion_time_10',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_zone_10_run_completion_time-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'timestamp',
|
||||
'friendly_name': '12345 Zone 10 Run Completion Time',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.12345_zone_10_run_completion_time',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_zone_11_run_completion_time-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.12345_zone_11_run_completion_time',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.TIMESTAMP: 'timestamp'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Zone 11 Run Completion Time',
|
||||
'platform': 'rainmachine',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'aa:bb:cc:dd:ee:ff_zone_run_completion_time_11',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_zone_11_run_completion_time-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'timestamp',
|
||||
'friendly_name': '12345 Zone 11 Run Completion Time',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.12345_zone_11_run_completion_time',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_zone_12_run_completion_time-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.12345_zone_12_run_completion_time',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.TIMESTAMP: 'timestamp'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Zone 12 Run Completion Time',
|
||||
'platform': 'rainmachine',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'aa:bb:cc:dd:ee:ff_zone_run_completion_time_12',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_zone_12_run_completion_time-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'timestamp',
|
||||
'friendly_name': '12345 Zone 12 Run Completion Time',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.12345_zone_12_run_completion_time',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_zone_4_run_completion_time-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.12345_zone_4_run_completion_time',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.TIMESTAMP: 'timestamp'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Zone 4 Run Completion Time',
|
||||
'platform': 'rainmachine',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'aa:bb:cc:dd:ee:ff_zone_run_completion_time_4',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_zone_4_run_completion_time-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'timestamp',
|
||||
'friendly_name': '12345 Zone 4 Run Completion Time',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.12345_zone_4_run_completion_time',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_zone_5_run_completion_time-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.12345_zone_5_run_completion_time',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.TIMESTAMP: 'timestamp'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Zone 5 Run Completion Time',
|
||||
'platform': 'rainmachine',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'aa:bb:cc:dd:ee:ff_zone_run_completion_time_5',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_zone_5_run_completion_time-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'timestamp',
|
||||
'friendly_name': '12345 Zone 5 Run Completion Time',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.12345_zone_5_run_completion_time',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_zone_6_run_completion_time-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.12345_zone_6_run_completion_time',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.TIMESTAMP: 'timestamp'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Zone 6 Run Completion Time',
|
||||
'platform': 'rainmachine',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'aa:bb:cc:dd:ee:ff_zone_run_completion_time_6',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_zone_6_run_completion_time-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'timestamp',
|
||||
'friendly_name': '12345 Zone 6 Run Completion Time',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.12345_zone_6_run_completion_time',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_zone_7_run_completion_time-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.12345_zone_7_run_completion_time',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.TIMESTAMP: 'timestamp'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Zone 7 Run Completion Time',
|
||||
'platform': 'rainmachine',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'aa:bb:cc:dd:ee:ff_zone_run_completion_time_7',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_zone_7_run_completion_time-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'timestamp',
|
||||
'friendly_name': '12345 Zone 7 Run Completion Time',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.12345_zone_7_run_completion_time',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_zone_8_run_completion_time-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.12345_zone_8_run_completion_time',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.TIMESTAMP: 'timestamp'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Zone 8 Run Completion Time',
|
||||
'platform': 'rainmachine',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'aa:bb:cc:dd:ee:ff_zone_run_completion_time_8',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_zone_8_run_completion_time-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'timestamp',
|
||||
'friendly_name': '12345 Zone 8 Run Completion Time',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.12345_zone_8_run_completion_time',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_zone_9_run_completion_time-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>,
|
||||
'entity_id': 'sensor.12345_zone_9_run_completion_time',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.TIMESTAMP: 'timestamp'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Zone 9 Run Completion Time',
|
||||
'platform': 'rainmachine',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'aa:bb:cc:dd:ee:ff_zone_run_completion_time_9',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_sensors[sensor.12345_zone_9_run_completion_time-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'timestamp',
|
||||
'friendly_name': '12345 Zone 9 Run Completion Time',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.12345_zone_9_run_completion_time',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,36 @@
|
||||
"""Test RainMachine binary sensors."""
|
||||
|
||||
from typing import Any
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
import pytest
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.rainmachine import DOMAIN
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_binary_sensors(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
config: dict[str, Any],
|
||||
config_entry: MockConfigEntry,
|
||||
client: AsyncMock,
|
||||
) -> None:
|
||||
"""Test binary sensors."""
|
||||
with (
|
||||
patch("homeassistant.components.rainmachine.Client", return_value=client),
|
||||
patch(
|
||||
"homeassistant.components.rainmachine.PLATFORMS", [Platform.BINARY_SENSOR]
|
||||
),
|
||||
):
|
||||
assert await async_setup_component(hass, DOMAIN, config)
|
||||
await hass.async_block_till_done()
|
||||
await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id)
|
||||
32
home-assistant/tests/components/rainmachine/test_button.py
Normal file
32
home-assistant/tests/components/rainmachine/test_button.py
Normal file
@@ -0,0 +1,32 @@
|
||||
"""Test RainMachine buttons."""
|
||||
|
||||
from typing import Any
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.rainmachine import DOMAIN
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
|
||||
|
||||
async def test_buttons(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
config: dict[str, Any],
|
||||
config_entry: MockConfigEntry,
|
||||
client: AsyncMock,
|
||||
) -> None:
|
||||
"""Test buttons."""
|
||||
with (
|
||||
patch("homeassistant.components.rainmachine.Client", return_value=client),
|
||||
patch("homeassistant.components.rainmachine.PLATFORMS", [Platform.BUTTON]),
|
||||
):
|
||||
assert await async_setup_component(hass, DOMAIN, config)
|
||||
await hass.async_block_till_done()
|
||||
await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id)
|
||||
314
home-assistant/tests/components/rainmachine/test_config_flow.py
Normal file
314
home-assistant/tests/components/rainmachine/test_config_flow.py
Normal file
@@ -0,0 +1,314 @@
|
||||
"""Define tests for the OpenUV config flow."""
|
||||
|
||||
from ipaddress import ip_address
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from regenmaschine.errors import RainMachineError
|
||||
|
||||
from homeassistant import config_entries, setup
|
||||
from homeassistant.components import zeroconf
|
||||
from homeassistant.components.rainmachine import (
|
||||
CONF_ALLOW_INACTIVE_ZONES_TO_RUN,
|
||||
CONF_DEFAULT_ZONE_RUN_TIME,
|
||||
CONF_USE_APP_RUN_TIMES,
|
||||
DOMAIN,
|
||||
)
|
||||
from homeassistant.const import CONF_IP_ADDRESS, CONF_PASSWORD, CONF_PORT, CONF_SSL
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
|
||||
async def test_duplicate_error(hass: HomeAssistant, config, config_entry) -> None:
|
||||
"""Test that errors are shown when duplicates are added."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=config
|
||||
)
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
async def test_invalid_password(hass: HomeAssistant, config) -> None:
|
||||
"""Test that an invalid password throws an error."""
|
||||
with patch("regenmaschine.client.Client.load_local", side_effect=RainMachineError):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=config
|
||||
)
|
||||
assert result["errors"] == {CONF_PASSWORD: "invalid_auth"}
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("platform", "entity_name", "entity_id", "old_unique_id", "new_unique_id"),
|
||||
[
|
||||
(
|
||||
"binary_sensor",
|
||||
"Home Flow Sensor",
|
||||
"binary_sensor.home_flow_sensor",
|
||||
"60e32719b6cf_flow_sensor",
|
||||
"60:e3:27:19:b6:cf_flow_sensor",
|
||||
),
|
||||
(
|
||||
"switch",
|
||||
"Home Landscaping",
|
||||
"switch.home_landscaping",
|
||||
"60e32719b6cf_RainMachineZone_1",
|
||||
"60:e3:27:19:b6:cf_zone_1",
|
||||
),
|
||||
],
|
||||
)
|
||||
async def test_migrate_1_2(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
client,
|
||||
config,
|
||||
config_entry,
|
||||
entity_id,
|
||||
entity_name,
|
||||
old_unique_id,
|
||||
new_unique_id,
|
||||
platform,
|
||||
) -> None:
|
||||
"""Test migration from version 1 to 2 (consistent unique IDs)."""
|
||||
# Create entity RegistryEntry using old unique ID format:
|
||||
entity_entry = entity_registry.async_get_or_create(
|
||||
platform,
|
||||
DOMAIN,
|
||||
old_unique_id,
|
||||
suggested_object_id=entity_name,
|
||||
config_entry=config_entry,
|
||||
original_name=entity_name,
|
||||
)
|
||||
assert entity_entry.entity_id == entity_id
|
||||
assert entity_entry.unique_id == old_unique_id
|
||||
|
||||
with (
|
||||
patch(
|
||||
"homeassistant.components.rainmachine.async_setup_entry", return_value=True
|
||||
),
|
||||
patch(
|
||||
"homeassistant.components.rainmachine.config_flow.Client",
|
||||
return_value=client,
|
||||
),
|
||||
):
|
||||
await setup.async_setup_component(hass, DOMAIN, {})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
# Check that new RegistryEntry is using new unique ID format
|
||||
entity_entry = entity_registry.async_get(entity_id)
|
||||
assert entity_entry.unique_id == new_unique_id
|
||||
assert entity_registry.async_get_entity_id(platform, DOMAIN, old_unique_id) is None
|
||||
|
||||
|
||||
async def test_options_flow(hass: HomeAssistant, config, config_entry) -> None:
|
||||
"""Test config flow options."""
|
||||
with patch(
|
||||
"homeassistant.components.rainmachine.async_setup_entry", return_value=True
|
||||
):
|
||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
result = await hass.config_entries.options.async_init(config_entry.entry_id)
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "init"
|
||||
|
||||
result = await hass.config_entries.options.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={
|
||||
CONF_DEFAULT_ZONE_RUN_TIME: 600,
|
||||
CONF_USE_APP_RUN_TIMES: False,
|
||||
CONF_ALLOW_INACTIVE_ZONES_TO_RUN: False,
|
||||
},
|
||||
)
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert config_entry.options == {
|
||||
CONF_DEFAULT_ZONE_RUN_TIME: 600,
|
||||
CONF_USE_APP_RUN_TIMES: False,
|
||||
CONF_ALLOW_INACTIVE_ZONES_TO_RUN: False,
|
||||
}
|
||||
|
||||
|
||||
async def test_show_form(hass: HomeAssistant) -> None:
|
||||
"""Test that the form is served with no input."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_USER},
|
||||
data=None,
|
||||
)
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
|
||||
async def test_step_user(hass: HomeAssistant, config, setup_rainmachine) -> None:
|
||||
"""Test that the user step works."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_USER},
|
||||
data=config,
|
||||
)
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == "12345"
|
||||
assert result["data"] == {
|
||||
CONF_IP_ADDRESS: "192.168.1.100",
|
||||
CONF_PASSWORD: "password",
|
||||
CONF_PORT: 8080,
|
||||
CONF_SSL: True,
|
||||
CONF_DEFAULT_ZONE_RUN_TIME: 600,
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"source", [config_entries.SOURCE_ZEROCONF, config_entries.SOURCE_HOMEKIT]
|
||||
)
|
||||
async def test_step_homekit_zeroconf_ip_already_exists(
|
||||
hass: HomeAssistant, client, config, config_entry, source
|
||||
) -> None:
|
||||
"""Test homekit and zeroconf with an ip that already exists."""
|
||||
with patch(
|
||||
"homeassistant.components.rainmachine.config_flow.Client", return_value=client
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": source},
|
||||
data=zeroconf.ZeroconfServiceInfo(
|
||||
ip_address=ip_address("192.168.1.100"),
|
||||
ip_addresses=[ip_address("192.168.1.100")],
|
||||
hostname="mock_hostname",
|
||||
name="mock_name",
|
||||
port=None,
|
||||
properties={},
|
||||
type="mock_type",
|
||||
),
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"source", [config_entries.SOURCE_ZEROCONF, config_entries.SOURCE_HOMEKIT]
|
||||
)
|
||||
async def test_step_homekit_zeroconf_ip_change(
|
||||
hass: HomeAssistant, client, config_entry, source
|
||||
) -> None:
|
||||
"""Test zeroconf with an ip change."""
|
||||
with patch(
|
||||
"homeassistant.components.rainmachine.config_flow.Client", return_value=client
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": source},
|
||||
data=zeroconf.ZeroconfServiceInfo(
|
||||
ip_address=ip_address("192.168.1.2"),
|
||||
ip_addresses=[ip_address("192.168.1.2")],
|
||||
hostname="mock_hostname",
|
||||
name="mock_name",
|
||||
port=None,
|
||||
properties={},
|
||||
type="mock_type",
|
||||
),
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
assert result["reason"] == "already_configured"
|
||||
assert config_entry.data[CONF_IP_ADDRESS] == "192.168.1.2"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"source", [config_entries.SOURCE_ZEROCONF, config_entries.SOURCE_HOMEKIT]
|
||||
)
|
||||
async def test_step_homekit_zeroconf_new_controller_when_some_exist(
|
||||
hass: HomeAssistant, client, config, source
|
||||
) -> None:
|
||||
"""Test homekit and zeroconf for a new controller when one already exists."""
|
||||
with patch(
|
||||
"homeassistant.components.rainmachine.config_flow.Client", return_value=client
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": source},
|
||||
data=zeroconf.ZeroconfServiceInfo(
|
||||
ip_address=ip_address("192.168.1.100"),
|
||||
ip_addresses=[ip_address("192.168.1.100")],
|
||||
hostname="mock_hostname",
|
||||
name="mock_name",
|
||||
port=None,
|
||||
properties={},
|
||||
type="mock_type",
|
||||
),
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
with (
|
||||
patch(
|
||||
"homeassistant.components.rainmachine.async_setup_entry", return_value=True
|
||||
),
|
||||
patch(
|
||||
"homeassistant.components.rainmachine.config_flow.Client",
|
||||
return_value=client,
|
||||
),
|
||||
):
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
{
|
||||
CONF_IP_ADDRESS: "192.168.1.100",
|
||||
CONF_PASSWORD: "password",
|
||||
CONF_PORT: 8080,
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert result2["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert result2["title"] == "12345"
|
||||
assert result2["data"] == {
|
||||
CONF_IP_ADDRESS: "192.168.1.100",
|
||||
CONF_PASSWORD: "password",
|
||||
CONF_PORT: 8080,
|
||||
CONF_SSL: True,
|
||||
CONF_DEFAULT_ZONE_RUN_TIME: 600,
|
||||
}
|
||||
|
||||
|
||||
async def test_discovery_by_homekit_and_zeroconf_same_time(
|
||||
hass: HomeAssistant, client
|
||||
) -> None:
|
||||
"""Test the same controller gets discovered by two different methods."""
|
||||
with patch(
|
||||
"homeassistant.components.rainmachine.config_flow.Client", return_value=client
|
||||
):
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_ZEROCONF},
|
||||
data=zeroconf.ZeroconfServiceInfo(
|
||||
ip_address=ip_address("192.168.1.100"),
|
||||
ip_addresses=[ip_address("192.168.1.100")],
|
||||
hostname="mock_hostname",
|
||||
name="mock_name",
|
||||
port=None,
|
||||
properties={},
|
||||
type="mock_type",
|
||||
),
|
||||
)
|
||||
|
||||
assert result["type"] is FlowResultType.FORM
|
||||
assert result["step_id"] == "user"
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.rainmachine.config_flow.Client", return_value=client
|
||||
):
|
||||
result2 = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": config_entries.SOURCE_HOMEKIT},
|
||||
data=zeroconf.ZeroconfServiceInfo(
|
||||
ip_address=ip_address("192.168.1.100"),
|
||||
ip_addresses=[ip_address("192.168.1.100")],
|
||||
hostname="mock_hostname",
|
||||
name="mock_name",
|
||||
port=None,
|
||||
properties={},
|
||||
type="mock_type",
|
||||
),
|
||||
)
|
||||
|
||||
assert result2["type"] is FlowResultType.ABORT
|
||||
assert result2["reason"] == "already_in_progress"
|
||||
@@ -0,0 +1,38 @@
|
||||
"""Test RainMachine diagnostics."""
|
||||
|
||||
from regenmaschine.errors import RainMachineError
|
||||
from syrupy import SnapshotAssertion
|
||||
from syrupy.filters import props
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_entry_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
config_entry,
|
||||
hass_client: ClientSessionGenerator,
|
||||
setup_rainmachine,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test config entry diagnostics."""
|
||||
assert await get_diagnostics_for_config_entry(
|
||||
hass, hass_client, config_entry
|
||||
) == snapshot(exclude=props("created_at", "modified_at"))
|
||||
|
||||
|
||||
async def test_entry_diagnostics_failed_controller_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
config_entry,
|
||||
controller,
|
||||
hass_client: ClientSessionGenerator,
|
||||
setup_rainmachine,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test config entry diagnostics when the controller diagnostics API call fails."""
|
||||
controller.diagnostics.current.side_effect = RainMachineError
|
||||
assert await get_diagnostics_for_config_entry(
|
||||
hass, hass_client, config_entry
|
||||
) == snapshot(exclude=props("created_at", "modified_at"))
|
||||
32
home-assistant/tests/components/rainmachine/test_select.py
Normal file
32
home-assistant/tests/components/rainmachine/test_select.py
Normal file
@@ -0,0 +1,32 @@
|
||||
"""Test RainMachine select entities."""
|
||||
|
||||
from typing import Any
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.rainmachine import DOMAIN
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
|
||||
|
||||
async def test_select_entities(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
config: dict[str, Any],
|
||||
config_entry: MockConfigEntry,
|
||||
client: AsyncMock,
|
||||
) -> None:
|
||||
"""Test select entities."""
|
||||
with (
|
||||
patch("homeassistant.components.rainmachine.Client", return_value=client),
|
||||
patch("homeassistant.components.rainmachine.PLATFORMS", [Platform.SELECT]),
|
||||
):
|
||||
assert await async_setup_component(hass, DOMAIN, config)
|
||||
await hass.async_block_till_done()
|
||||
await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id)
|
||||
34
home-assistant/tests/components/rainmachine/test_sensor.py
Normal file
34
home-assistant/tests/components/rainmachine/test_sensor.py
Normal file
@@ -0,0 +1,34 @@
|
||||
"""Test RainMachine sensors."""
|
||||
|
||||
from typing import Any
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
import pytest
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.rainmachine import DOMAIN
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_sensors(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
config: dict[str, Any],
|
||||
config_entry: MockConfigEntry,
|
||||
client: AsyncMock,
|
||||
) -> None:
|
||||
"""Test sensors."""
|
||||
with (
|
||||
patch("homeassistant.components.rainmachine.Client", return_value=client),
|
||||
patch("homeassistant.components.rainmachine.PLATFORMS", [Platform.SENSOR]),
|
||||
):
|
||||
assert await async_setup_component(hass, DOMAIN, config)
|
||||
await hass.async_block_till_done()
|
||||
await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id)
|
||||
34
home-assistant/tests/components/rainmachine/test_switch.py
Normal file
34
home-assistant/tests/components/rainmachine/test_switch.py
Normal file
@@ -0,0 +1,34 @@
|
||||
"""Test RainMachine switches."""
|
||||
|
||||
from typing import Any
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
import pytest
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.rainmachine import DOMAIN
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
async def test_switches(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
snapshot: SnapshotAssertion,
|
||||
config: dict[str, Any],
|
||||
config_entry: MockConfigEntry,
|
||||
client: AsyncMock,
|
||||
) -> None:
|
||||
"""Test switches."""
|
||||
with (
|
||||
patch("homeassistant.components.rainmachine.Client", return_value=client),
|
||||
patch("homeassistant.components.rainmachine.PLATFORMS", [Platform.SWITCH]),
|
||||
):
|
||||
assert await async_setup_component(hass, DOMAIN, config)
|
||||
await hass.async_block_till_done()
|
||||
await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id)
|
||||
Reference in New Issue
Block a user