diff --git a/tests/test_legacy.py b/tests/test_legacy.py
index 098e4e6..68cf31d 100644
--- a/tests/test_legacy.py
+++ b/tests/test_legacy.py
@@ -11,304 +11,155 @@
@fixture
def customer_details():
yield {
- "boc_topology_desired": {"boc_gateways": []},
- "boc_topology_actual": {"boc_gateways": []},
+ "controller_id": 52496,
+ "customer_id": 47076,
+ "current_controller": "Home Controller",
"controllers": [
{
"name": "Home Controller",
- "last_contact": 1519572810,
- "serial_number": "05fc9d5a",
+ "last_contact": 1693292420,
+ "serial_number": "0310b36090",
"controller_id": 52496,
- "sw_version": "2.18",
- "hardware": "hydrawise76",
- "is_boc": False,
- "address": "122 Chadwick Dr, Peachtree City, GA 30269, USA",
- "timezone": "America\/New_York",
- "device_id": 52496,
- "parent_device_id": None,
- "image": "https:\/\/app.hydrawise.com\/config\/images\/pro-hc.png",
- "description": "Pro HC 6 Station Controller",
- "customer_id": 47076,
- "latitude": 33.357814788818,
- "longitude": -84.53751373291,
- "last_contact_readable": "Feb 25, 2018 at 10:33 am",
- "status": "All good!",
- "status_icon": "ok.png",
- "online": True,
- "tags": [
- "05fc9d5a",
- "Home Controller",
- "id=52496",
- "sw=2.18",
- "online",
- ],
+ "status": "Unknown",
}
],
- "current_controller": "Home Controller",
- "is_boc": False,
- "tandc": 0,
- "controller_id": 52496,
- "customer_id": 47076,
- "session_id": "bvs3gj23sod6iolh4rq6f9sji0",
- "hardwareVersion": "hydrawise76",
- "device_id": 52496,
- "tandc_version": 2,
- "features": {
- "plan_array": [
- {
- "id": "0",
- "planType": "Home",
- "planType_key": "plan.name.home",
- "sku": None,
- "discount": "0",
- "cost": "0",
- "cost_us": "0",
- "cost_au": "0",
- "cost_eu": "0",
- "cost_ca": "0",
- "cost_uk": "0",
- "active": "1",
- "controller_qty": "3",
- "rainfall": "1",
- "sms_qty": "0",
- "scheduled_reports": "0",
- "email_alerts": "0",
- "define_sensor": "1",
- "add_user": "0",
- "contractor": "0",
- "description": "The Home plan is free and includes -\n
\n- Internet control from your iPhone, Android or web browser<\/li>\n
- Hydrawise Predictive Watering based on forecast temperature and probability of rainfall - don't water when it's going to rain or is cold!<\/li>\n
- Support for 1 Airport Based Weather Station with rainfall updated daily<\/li>\n
- Up to 3 Hydrawise controllers per account<\/li>\n<\/ul>",
- "sensor_pack": "0",
- "filelimit": "25",
- "filetypeall": "0",
- "plan_type": "0",
- "push_notification": "1",
- "weather_qty": "0",
- "weather_free_qty": "1",
- "reporting_days": "30",
- "weather_hourly_updates": "0",
- "free_enthusiast_plans": "0",
- "visible": "0",
- "contractor_purchasable": "0",
- "boc": "0",
- "expiry": "1656373907",
- "start": "1498693907",
- "customerplan_id": "72966",
- }
- ],
- "id": None,
- "planType": "Home",
- "planType_key": "plan.name.home",
- "sku": None,
- "discount": "0",
- "cost": "0",
- "cost_us": "0",
- "cost_au": "0",
- "cost_eu": "0",
- "cost_ca": "0",
- "cost_uk": "0",
- "active": "1",
- "controller_qty": "3",
- "rainfall": "1",
- "sms_qty": "0",
- "scheduled_reports": "0",
- "email_alerts": "0",
- "define_sensor": "1",
- "add_user": "0",
- "contractor": "0",
- "description": None,
- "sensor_pack": "0",
- "filelimit": "25",
- "filetypeall": "0",
- "plan_type": "0",
- "push_notification": "1",
- "weather_qty": "0",
- "weather_free_qty": "1",
- "reporting_days": "30",
- "weather_hourly_updates": "0",
- "free_enthusiast_plans": "0",
- "visible": "0",
- "contractor_purchasable": None,
- "boc": 0,
- "expiry": None,
- "start": None,
- "customerplan_id": "72966",
- "sms_used": 0,
- },
}
@fixture
def status_schedule():
yield {
- "controller_id": 52496,
- "customer_id": 47076,
- "user_id": 49841,
- "nextpoll": 300,
- "sensors": [
- {
- "input": 0,
- "type": 1,
- "mode": 1,
- "timer": 0,
- "offtimer": 0,
- "name": "Rain",
- "offlevel": 1,
- "active": 1,
- "relays": [
- {"id": 428639},
- {"id": 428641},
- {"id": 428642},
- {"id": 428643},
- {"id": 428651},
- {"id": 428653},
- ],
- }
- ],
+ "expanders": [],
+ "master": 0,
+ "master_post_timer": 0,
+ "master_timer": 0,
"message": "",
- "obs_rain": "0.0 in",
- "obs_rain_week": "0.0 in",
- "obs_maxtemp": "",
- "obs_rain_upgrade": 0,
- "obs_rain_text": "Yesterday",
- "obs_currenttemp": "",
- "watering_time": "0 min",
- "water_saving": 100,
- "last_contact": "41 seconds ago",
- "forecast": [
- {
- "temp_hi": "66 F",
- "temp_lo": "66 F",
- "conditions": "Rain",
- "day": "Sunday",
- "pop": 90,
- "humidity": 86,
- "wind": "8 m\/h",
- "icon": "http:\/\/icons.wxug.com\/i\/c\/k\/rain.gif",
- "icon_local": "images\/wug\/rain.gif",
- },
- {
- "temp_hi": "71 F",
- "temp_lo": "71 F",
- "conditions": "Rain",
- "day": "Monday",
- "pop": 100,
- "humidity": 74,
- "wind": "7 m\/h",
- "icon": "http:\/\/icons.wxug.com\/i\/c\/k\/rain.gif",
- "icon_local": "images\/wug\/rain.gif",
- },
- {
- "temp_hi": "70 F",
- "temp_lo": "70 F",
- "conditions": "Clear",
- "day": "Tuesday",
- "pop": 10,
- "humidity": 63,
- "wind": "9 m\/h",
- "icon": "http:\/\/icons.wxug.com\/i\/c\/k\/clear.gif",
- "icon_local": "images\/wug\/clear.gif",
- },
- {
- "temp_hi": "65 F",
- "temp_lo": "60 F",
- "conditions": "Rain",
- "day": "Wednesday",
- "pop": 100,
- "humidity": 92,
- "wind": "7 m\/h",
- "icon": "http:\/\/icons.wxug.com\/i\/c\/k\/rain.gif",
- "icon_local": "images\/wug\/rain.gif",
- },
- ],
- "status": "All good!",
- "status_icon": "ok.png",
- "name": "Home Controller",
+ "nextpoll": 60,
+ "options": 1,
"relays": [
{
- "relay_id": 428639,
+ "name": "Drips - House",
+ "period": 259200,
"relay": 1,
- "name": "Right yard",
- "icon": "leaf.png",
- "lastwater": "Never",
- "message": "Suspended for 1 month 29 days",
- "suspended": "1524675721",
- "time": 157680000,
- "run": "",
- "type": 110,
- "id": "428639",
- "nicetime": "Not scheduled",
+ "relay_id": 5965394,
+ "run": 1800,
+ "stop": 1,
+ "time": 330597,
+ "timestr": "Sat",
+ "type": 1,
},
{
- "relay_id": 428641,
+ "name": "Drips - Fence",
+ "period": 259200,
"relay": 2,
- "name": "Far right yard",
- "icon": "leaf.png",
- "lastwater": "Never",
- "message": "Suspended for 1 month 29 days",
- "suspended": "1524675721",
- "time": 157680000,
- "run": "",
- "type": 110,
- "id": "428641",
- "nicetime": "Not scheduled",
+ "relay_id": 5965395,
+ "run": 1788,
+ "stop": 1,
+ "time": 1,
+ "timestr": "Now",
+ "type": 106,
},
{
- "relay_id": 428642,
+ "name": "Rotary - Front",
+ "period": 259200,
"relay": 3,
- "name": "Backyard",
- "icon": "leaf.png",
- "lastwater": "Never",
- "message": "Suspended for 1 month 29 days",
- "suspended": "1524675721",
- "time": 157680000,
- "run": "",
- "type": 110,
- "id": "428642",
- "nicetime": "Not scheduled",
+ "relay_id": 5965396,
+ "run": 1800,
+ "stop": 1,
+ "time": 334197,
+ "timestr": "Sat",
+ "type": 1,
},
{
- "relay_id": 428643,
+ "name": "Sprays - Side L",
+ "period": 259200,
"relay": 4,
- "name": "Driveway",
- "icon": "leaf.png",
- "lastwater": "Never",
- "message": "Suspended for 1 month 29 days",
- "suspended": "1524675721",
- "time": 157680000,
- "run": "",
- "type": 110,
- "id": "428643",
- "nicetime": "Not scheduled",
+ "relay_id": 5965397,
+ "run": 180,
+ "stop": 1,
+ "time": 335997,
+ "timestr": "Sat",
+ "type": 1,
},
{
- "relay_id": 428651,
+ "name": "Rotary - Back N",
+ "period": 259200,
"relay": 5,
- "name": "Far left yard",
- "icon": "leaf.png",
- "lastwater": "Never",
- "message": "Suspended for 1 month 29 days",
- "suspended": "1524675721",
- "time": 157680000,
- "run": "",
- "type": 110,
- "id": "428651",
- "nicetime": "Not scheduled",
+ "relay_id": 5965398,
+ "run": 1800,
+ "stop": 1,
+ "time": 336177,
+ "timestr": "Sat",
+ "type": 1,
},
{
- "relay_id": 428653,
+ "name": "Rotary - Back C",
+ "period": 259200,
"relay": 6,
- "name": "Left yard",
- "icon": "leaf.png",
- "lastwater": "Never",
- "message": "Suspended for 1 month 29 days",
- "suspended": "1524675721",
- "time": 157680000,
- "run": "",
- "type": 110,
- "id": "428653",
- "nicetime": "Not scheduled",
+ "relay_id": 5965399,
+ "run": 1800,
+ "stop": 1,
+ "time": 337977,
+ "timestr": "Sat",
+ "type": 1,
},
+ {
+ "name": "Rotary - Back F",
+ "period": 259200,
+ "relay": 7,
+ "relay_id": 5965400,
+ "run": 1200,
+ "stop": 1,
+ "time": 339777,
+ "timestr": "Sat",
+ "type": 1,
+ },
+ {
+ "name": "Sprays - Side R",
+ "period": 259200,
+ "relay": 8,
+ "relay_id": 5965401,
+ "run": 480,
+ "stop": 1,
+ "time": 340977,
+ "timestr": "Sat",
+ "type": 1,
+ },
+ {
+ "name": "Sprays - Drivew",
+ "period": 259200,
+ "relay": 9,
+ "relay_id": 5965402,
+ "run": 900,
+ "stop": 1,
+ "time": 341457,
+ "timestr": "Sat",
+ "type": 1,
+ },
+ ],
+ "sensors": [
+ {
+ "input": 0,
+ "mode": 1,
+ "offtimer": 0,
+ "relays": [
+ {"id": 5965394},
+ {"id": 5965395},
+ {"id": 5965396},
+ {"id": 5965397},
+ {"id": 5965398},
+ {"id": 5965399},
+ {"id": 5965400},
+ {"id": 5965401},
+ {"id": 5965402},
+ ],
+ "timer": 0,
+ "type": 1,
+ }
],
+ "simRelays": 1,
+ "stupdate": 0,
+ "time": 1693303803,
}
@@ -351,20 +202,23 @@ def test_update(mock_request, customer_details, status_schedule):
def test_attributes(mock_request, customer_details, status_schedule):
client = legacy.LegacyHydrawise(API_KEY)
assert client.current_controller == customer_details["controllers"][0]
- assert client.status == "All good!"
+ assert client.status == "Unknown"
assert client.controller_id == 52496
assert client.customer_id == 47076
- assert client.num_relays == 6
+ assert client.num_relays == 9
assert client.relays == status_schedule["relays"]
assert list(client.relays_by_id.keys()) == [
- 428639,
- 428641,
- 428642,
- 428643,
- 428651,
- 428653,
+ 5965394,
+ 5965395,
+ 5965396,
+ 5965397,
+ 5965398,
+ 5965399,
+ 5965400,
+ 5965401,
+ 5965402,
]
- assert list(client.relays_by_zone_number.keys()) == [1, 2, 3, 4, 5, 6]
+ assert list(client.relays_by_zone_number.keys()) == [1, 2, 3, 4, 5, 6, 7, 8, 9]
assert client.name == "Home Controller"
assert client.sensors == status_schedule["sensors"]
assert client.running is None
@@ -405,7 +259,7 @@ def test_suspend_zone(mock_request, success_status):
"action": "suspend",
"custom": 1672617600,
"period_id": 999,
- "relay_id": 428639,
+ "relay_id": 5965394,
},
timeout=10,
)
@@ -426,7 +280,7 @@ def test_suspend_zone_unsuspend(mock_request, success_status):
"api_key": API_KEY,
"action": "suspend",
"period_id": 0,
- "relay_id": 428639,
+ "relay_id": 5965394,
},
timeout=10,
)
@@ -469,7 +323,7 @@ def test_run_zone(mock_request, success_status):
"action": "run",
"custom": 60,
"period_id": 999,
- "relay_id": 428639,
+ "relay_id": 5965394,
},
timeout=10,
)
@@ -511,7 +365,7 @@ def test_run_zone_stop(mock_request, success_status):
"api_key": API_KEY,
"action": "stop",
"period_id": 0,
- "relay_id": 428639,
+ "relay_id": 5965394,
},
timeout=10,
)