Add Samsung EHS (Eco Heating System) heat pump support
Adds a device registry for the TP1X_DA_AC_EHS board family: separate zone1 (space heating/cooling) and dhw (domestic hot water) loops. zone1 is exposed as power switch + mode select + current/target temperature sensor/number -- it's a leaving-water-temperature setpoint, not a thermostat, so no HA platform fits it better. dhw gets a composite water_heater entity, using the same primary-resource-plus-sibling-reads shape climate.py already uses for the AC (PR #247 review feedback: "Having water heaters automatically leverage the right platform would be pretty cool!"). The unit's away mode is a device-wide switch, not the water_heater AWAY_MODE feature -- /option/outgoing/vs/0 has no dhw-scoped sibling and covers zone1 too, so presenting it on the DHW card would misstate its scope. Operation modes (Eco/Std/Force/Power) map onto HA's own standard water_heater states, the same mapping HA core's smartthings integration uses for this exact Samsung capability over the cloud API. Device codes are matched case-insensitively on the read side. The DHW entity takes a catalog name ("Hot water") rather than the bare device name -- unlike the AC's climate card, it is one loop of a two-loop device. Both temperature ranges fall back as a pair: a resource reporting a minimum but no maximum yields no range at all rather than mixing a device bound with an invented default, matching climate._range(). Increment fallbacks test for None instead of using `or`, so a genuine 0 survives. set_temperature honours the optional operation_mode HA's water_heater service schema forwards, setting the mode (and powering the loop on) before the setpoint, the same way climate's set_temperature handles hvac_mode. Entity names are translated into Czech and Dutch following each file's existing terminology conventions. Verified against a real TP1X_DA_AC_EHS_01001_0000 diagnostics dump (firmware AEH-WW-TP1-22-AE6000_17260402); golden-regression fixture and full test coverage included.
This commit is contained in:
1 parent
e309d3e7b8
commit
6efee761d9
17 files changed
+1807
-4
No files matched your search
Vendored
+759
@@ -0,0 +1,759 @@
|
||||
{
|
||||
"device0": [
|
||||
{
|
||||
"rt": [
|
||||
"x.com.samsung.devcol",
|
||||
"oic.wk.col"
|
||||
],
|
||||
"if": [
|
||||
"oic.if.baseline",
|
||||
"oic.if.ll",
|
||||
"oic.if.b"
|
||||
]
|
||||
},
|
||||
{
|
||||
"href": "/realtimenotiforclient/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.timeforshortnoti": "0",
|
||||
"x.com.samsung.da.longnotisubscription": "false",
|
||||
"x.com.samsung.da.periodicnotisubscription": "true"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/alarms/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.items": [
|
||||
{
|
||||
"x.com.samsung.da.id": "0",
|
||||
"x.com.samsung.da.description": "Alarm",
|
||||
"x.com.samsung.da.alarmType": "Device",
|
||||
"x.com.samsung.da.code": "ErrorCode_OFF",
|
||||
"x.com.samsung.da.triggeredTime": "2026-08-01T21:32:45",
|
||||
"x.com.samsung.da.state": "Deleted"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/temperatures/indoor/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.type": "Water",
|
||||
"x.com.samsung.da.desired": "5.0",
|
||||
"x.com.samsung.da.current": "30.0",
|
||||
"x.com.samsung.da.maximum": "25.0",
|
||||
"x.com.samsung.da.minimum": "5.0",
|
||||
"x.com.samsung.da.increment": "0.5",
|
||||
"x.com.samsung.da.offset": "0.0",
|
||||
"x.com.samsung.da.unit": "Celsius"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/temperatures/dhw/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.type": "Water",
|
||||
"x.com.samsung.da.unit": "Celsius",
|
||||
"x.com.samsung.da.desired": "40.0",
|
||||
"x.com.samsung.da.current": "38.0",
|
||||
"x.com.samsung.da.maximum": "62.0",
|
||||
"x.com.samsung.da.minimum": "40.0",
|
||||
"x.com.samsung.da.increment": "0.5"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/diagnosis/vs/0",
|
||||
"rep": {}
|
||||
},
|
||||
{
|
||||
"href": "/energy/consumption/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.cumulativePower": "2448844",
|
||||
"x.com.samsung.da.cumulativeSavedPower": "0",
|
||||
"x.com.samsung.da.cumulativeUnit": "Wh",
|
||||
"x.com.samsung.da.cumulativePowerType": "individual"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/mode/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.supportedModes": [
|
||||
"Cool",
|
||||
"Heat",
|
||||
"Auto"
|
||||
],
|
||||
"x.com.samsung.da.modes": [
|
||||
"Cool"
|
||||
],
|
||||
"x.com.samsung.da.options": [
|
||||
"OutdoorTemp_80",
|
||||
"KeyInputPermit_On",
|
||||
"ModePermit_NoLimit",
|
||||
"Thermostat_CoolHeat_Off"
|
||||
],
|
||||
"x.com.samsung.da.supportedOptions": [
|
||||
"Thermostat_CoolHeat",
|
||||
"DurationOn",
|
||||
"KeyInputPermit",
|
||||
"ModePermit",
|
||||
"Volume",
|
||||
"OutdoorTemp"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/mode/dhw/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.supportedModes": [
|
||||
"Eco",
|
||||
"Std",
|
||||
"Power",
|
||||
"Force"
|
||||
],
|
||||
"x.com.samsung.da.modes": [
|
||||
"Eco"
|
||||
],
|
||||
"x.com.samsung.da.options": [
|
||||
"Thermostat_Dhw_Off",
|
||||
"KeyInputPermit_On"
|
||||
],
|
||||
"x.com.samsung.da.supportedOptions": [
|
||||
"Thermostat_Dhw",
|
||||
"KeyInputPermit"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/power/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.power": "Off",
|
||||
"causeSource": "SMTS"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/power/dhw/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.power": "On",
|
||||
"causeSource": "SMTS"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/information/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.modelNum": "TP1X_DA_AC_EHS_01001_0000|10250141|60070105001711034A00010000002000",
|
||||
"x.com.samsung.da.description": "TP1X_DA_AC_EHS_01001_0000",
|
||||
"x.com.samsung.da.serialNum": "**REDACTED**",
|
||||
"x.com.samsung.da.otnDUID": "**REDACTED**",
|
||||
"x.com.samsung.da.diagProtocolType": "BLE_OCF",
|
||||
"x.com.samsung.da.diagLogType": [
|
||||
"errCode",
|
||||
"dump"
|
||||
],
|
||||
"x.com.samsung.da.diagDumpType": "file",
|
||||
"x.com.samsung.da.diagEndPoint": "SSM",
|
||||
"x.com.samsung.da.diagMnid": "0AJT",
|
||||
"x.com.samsung.da.diagSetupid": "AE0",
|
||||
"x.com.samsung.da.diagMinVersion": "3.0",
|
||||
"x.com.samsung.da.diagTsId": "DA01",
|
||||
"x.com.samsung.da.serialNumOption": "**REDACTED**",
|
||||
"x.com.samsung.da.items": [
|
||||
{
|
||||
"x.com.samsung.da.id": "0",
|
||||
"x.com.samsung.da.description": "Version",
|
||||
"x.com.samsung.da.type": "Software",
|
||||
"x.com.samsung.da.number": "02504A260402",
|
||||
"x.com.samsung.da.newVersionAvailable": "0"
|
||||
},
|
||||
{
|
||||
"x.com.samsung.da.id": "1",
|
||||
"x.com.samsung.da.description": "Version",
|
||||
"x.com.samsung.da.type": "Firmware",
|
||||
"x.com.samsung.da.number": "02501A24062401,FFFFFFFFFFFFFF",
|
||||
"x.com.samsung.da.newVersionAvailable": "0"
|
||||
},
|
||||
{
|
||||
"x.com.samsung.da.id": "2",
|
||||
"x.com.samsung.da.description": "Version",
|
||||
"x.com.samsung.da.type": "Outdoor",
|
||||
"x.com.samsung.da.number": "02572A23081000,02549A10000800"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/file/information/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.timeoffset": "+01:00",
|
||||
"x.com.samsung.supprtedtype": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/configuration/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.region": "0000000000"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/drlc/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.drlcLevel": "0",
|
||||
"x.com.samsung.da.durationminutes": "0",
|
||||
"x.com.samsung.da.drlcStartTime": "1970-01-01T00:00:00Z",
|
||||
"x.com.samsung.da.override": "Off",
|
||||
"x.com.samsung.da.realSaving": "Off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/availablecontrolsets/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.sets": "0001003200FA0B0190026C0C0000CE32",
|
||||
"x.com.samsung.da.id": "EHS",
|
||||
"x.com.samsung.da.version": "1.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/da/softreset/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.softwarereset": "false"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/otninformation/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.target": "",
|
||||
"x.com.samsung.da.newVersionAvailable": "false",
|
||||
"x.com.samsung.da.newVersionNo": "00000000",
|
||||
"x.com.samsung.da.currentVersionInfo": "00000000",
|
||||
"otnStatus": "None",
|
||||
"flashingProgress": "",
|
||||
"otnTarget": "main",
|
||||
"otnCompleteDate": "noHistory",
|
||||
"otnList": [
|
||||
{
|
||||
"type": "WIFI",
|
||||
"modelId": "AEH-WW-TP1-22-AE6000",
|
||||
"versions": [
|
||||
"17260402"
|
||||
],
|
||||
"visVersion": "260402"
|
||||
},
|
||||
{
|
||||
"type": "Micom",
|
||||
"modelId": "040010250141FFFFFFFF",
|
||||
"versions": [
|
||||
"24062401",
|
||||
"FFFFFFFF"
|
||||
],
|
||||
"visVersion": "240624"
|
||||
},
|
||||
{
|
||||
"type": "Micom",
|
||||
"modelId": "04001025724110254941",
|
||||
"versions": [
|
||||
"23081000",
|
||||
"10000800"
|
||||
],
|
||||
"visVersion": "230810"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/timezone/vs/0",
|
||||
"rep": {
|
||||
"timezoneid": "Europe/London",
|
||||
"offset": "+01:00",
|
||||
"DST": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/option/muteonce/vs/0",
|
||||
"rep": {
|
||||
"muteonce": "Off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/reserverulesets/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.sets": "0EFFFFFFFF05190F370B283E",
|
||||
"x.com.samsung.da.id": "EHS",
|
||||
"x.com.samsung.da.version": "1.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/connectionconfig/vs/0",
|
||||
"rep": {
|
||||
"autoReconnectionMinVersion": "1.0",
|
||||
"autoReconnection": "true",
|
||||
"autoReconnectionProtocolType": [
|
||||
"helper_hotspot",
|
||||
"ble_ocf"
|
||||
],
|
||||
"supportedWiFiAuthType": [
|
||||
"OPEN",
|
||||
"WEP",
|
||||
"WPA-PSK",
|
||||
"WPA2-PSK",
|
||||
"SAE"
|
||||
],
|
||||
"supportedWiFiCryptoType": [
|
||||
"TKIP",
|
||||
"AES",
|
||||
"WEP-64",
|
||||
"WEP-128"
|
||||
],
|
||||
"supportedWiFiFreq": [
|
||||
"2.4G"
|
||||
],
|
||||
"calmConnectionCare": {
|
||||
"version": "1.0",
|
||||
"role": [
|
||||
"things"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/option/outgoing/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.away": "Off"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/sac/installationinfo/vs/0",
|
||||
"rep": {
|
||||
"installationOptions": [
|
||||
{
|
||||
"id": "0",
|
||||
"option": "12300000000000000000"
|
||||
},
|
||||
{
|
||||
"id": "1",
|
||||
"option": "20010000000000000000"
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"option": "50000000000000000000"
|
||||
},
|
||||
{
|
||||
"id": "3",
|
||||
"option": "30000000000000000000"
|
||||
}
|
||||
],
|
||||
"installationDeviceNum": [
|
||||
{
|
||||
"id": "0",
|
||||
"number": "01"
|
||||
},
|
||||
{
|
||||
"id": "1",
|
||||
"number": "01"
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"number": "00"
|
||||
}
|
||||
],
|
||||
"outdoorInfo": [
|
||||
{
|
||||
"id": "0",
|
||||
"info": "02572A230810",
|
||||
"serial": "**REDACTED**"
|
||||
},
|
||||
{
|
||||
"id": "1",
|
||||
"info": "000000000000",
|
||||
"serial": "**REDACTED**"
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"info": "000000000000",
|
||||
"serial": "**REDACTED**"
|
||||
},
|
||||
{
|
||||
"id": "3",
|
||||
"info": "000000000000",
|
||||
"serial": "**REDACTED**"
|
||||
}
|
||||
],
|
||||
"mcuInfo": [
|
||||
{
|
||||
"id": "0",
|
||||
"info": "000000000000"
|
||||
},
|
||||
{
|
||||
"id": "1",
|
||||
"info": "000000000000"
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"info": "000000000000"
|
||||
},
|
||||
{
|
||||
"id": "3",
|
||||
"info": "000000000000"
|
||||
},
|
||||
{
|
||||
"id": "4",
|
||||
"info": "000000000000"
|
||||
},
|
||||
{
|
||||
"id": "5",
|
||||
"info": "000000000000"
|
||||
},
|
||||
{
|
||||
"id": "6",
|
||||
"info": "000000000000"
|
||||
},
|
||||
{
|
||||
"id": "7",
|
||||
"info": "000000000000"
|
||||
},
|
||||
{
|
||||
"id": "8",
|
||||
"info": "000000000000"
|
||||
},
|
||||
{
|
||||
"id": "9",
|
||||
"info": "000000000000"
|
||||
},
|
||||
{
|
||||
"id": "10",
|
||||
"info": "000000000000"
|
||||
},
|
||||
{
|
||||
"id": "11",
|
||||
"info": "000000000000"
|
||||
},
|
||||
{
|
||||
"id": "12",
|
||||
"info": "000000000000"
|
||||
},
|
||||
{
|
||||
"id": "13",
|
||||
"info": "000000000000"
|
||||
},
|
||||
{
|
||||
"id": "14",
|
||||
"info": "000000000000"
|
||||
},
|
||||
{
|
||||
"id": "15",
|
||||
"info": "000000000000"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/ehsfsv/vs/0",
|
||||
"rep": {
|
||||
"items": [
|
||||
{
|
||||
"setting": "0407010A01017202EE02260101"
|
||||
},
|
||||
{
|
||||
"setting": "0408010A010096017200960101"
|
||||
},
|
||||
{
|
||||
"setting": "041B010A0101F402BC026C0101"
|
||||
},
|
||||
{
|
||||
"setting": "041C010A01012C019001900101"
|
||||
},
|
||||
{
|
||||
"setting": "07DB010A01FF380032FFE20101"
|
||||
},
|
||||
{
|
||||
"setting": "07DC010A01006400C800960101"
|
||||
},
|
||||
{
|
||||
"setting": "07E5010A0100AA02EE01540101"
|
||||
},
|
||||
{
|
||||
"setting": "07E6010A0100AA02EE014A0101"
|
||||
},
|
||||
{
|
||||
"setting": "07EF010A0100AA02EE028A0101"
|
||||
},
|
||||
{
|
||||
"setting": "07F0010A0100AA02EE00AA0101"
|
||||
},
|
||||
{
|
||||
"setting": "082B0101000000000400000101"
|
||||
},
|
||||
{
|
||||
"setting": "082C0101000000000400000101"
|
||||
},
|
||||
{
|
||||
"setting": "082D0101000001000400040101"
|
||||
},
|
||||
{
|
||||
"setting": "0BC30101000000000200020101"
|
||||
},
|
||||
{
|
||||
"setting": "0BFF0101000000000100000101"
|
||||
},
|
||||
{
|
||||
"setting": "0FAB0101000000000100000101"
|
||||
},
|
||||
{
|
||||
"setting": "0FAC010A01FF6A00C800000101"
|
||||
},
|
||||
{
|
||||
"setting": "0FB50101000000000200000101"
|
||||
},
|
||||
{
|
||||
"setting": "0FCA010A010032009600640101"
|
||||
},
|
||||
{
|
||||
"setting": "0FDD0101000000000100000101"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/ehscycle/vs/0",
|
||||
"rep": {
|
||||
"indoor": [
|
||||
{
|
||||
"cycledata": "4B055455050500000000000000000000000000000004CCA70000005D05054B",
|
||||
"datetime": "2026-08-01T21:23:08"
|
||||
},
|
||||
{
|
||||
"cycledata": "4B055454050500000000000000000000000000000004CCAC0000005D05054B",
|
||||
"datetime": "2026-08-01T21:28:08"
|
||||
}
|
||||
],
|
||||
"outdoor": [
|
||||
{
|
||||
"cycledata": "00000000555A4A53490207D000000000FFFF00480046325700000000",
|
||||
"datetime": "2026-08-01T21:23:08"
|
||||
},
|
||||
{
|
||||
"cycledata": "00000000555A4952490207D000000000000000480046325600000000",
|
||||
"datetime": "2026-08-01T21:28:08"
|
||||
}
|
||||
],
|
||||
"unit": "Celsius"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/option/dhwdisplay/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.dhwdisplay": "Show"
|
||||
}
|
||||
},
|
||||
{
|
||||
"href": "/actions/zone1/vs/0",
|
||||
"rep": {}
|
||||
},
|
||||
{
|
||||
"href": "/actions/dhw/vs/0",
|
||||
"rep": {
|
||||
"x.com.samsung.da.items": [
|
||||
{
|
||||
"x.com.samsung.da.timelineId": "0",
|
||||
"x.com.samsung.da.module": "DHW",
|
||||
"x.com.samsung.da.temperatureType": "Water",
|
||||
"x.com.samsung.da.dayofWeek": [
|
||||
"Sun"
|
||||
],
|
||||
"x.com.samsung.da.timeblocks": [
|
||||
{
|
||||
"x.com.samsung.da.timeblockId": "0",
|
||||
"x.com.samsung.da.start": [
|
||||
{
|
||||
"x.com.samsung.da.time": "03:00",
|
||||
"x.com.samsung.da.power": "On",
|
||||
"x.com.samsung.da.mode": "Std",
|
||||
"x.com.samsung.da.desired": "45.0"
|
||||
}
|
||||
],
|
||||
"x.com.samsung.da.end": [
|
||||
{
|
||||
"x.com.samsung.da.time": "05:00",
|
||||
"x.com.samsung.da.power": "On",
|
||||
"x.com.samsung.da.mode": "Eco",
|
||||
"x.com.samsung.da.desired": "40.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"x.com.samsung.da.timelineId": "1",
|
||||
"x.com.samsung.da.module": "DHW",
|
||||
"x.com.samsung.da.temperatureType": "Water",
|
||||
"x.com.samsung.da.dayofWeek": [
|
||||
"Mon"
|
||||
],
|
||||
"x.com.samsung.da.timeblocks": [
|
||||
{
|
||||
"x.com.samsung.da.timeblockId": "0",
|
||||
"x.com.samsung.da.start": [
|
||||
{
|
||||
"x.com.samsung.da.time": "03:00",
|
||||
"x.com.samsung.da.power": "On",
|
||||
"x.com.samsung.da.mode": "Std",
|
||||
"x.com.samsung.da.desired": "45.0"
|
||||
}
|
||||
],
|
||||
"x.com.samsung.da.end": [
|
||||
{
|
||||
"x.com.samsung.da.time": "05:00",
|
||||
"x.com.samsung.da.power": "On",
|
||||
"x.com.samsung.da.mode": "Eco",
|
||||
"x.com.samsung.da.desired": "40.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"x.com.samsung.da.timelineId": "2",
|
||||
"x.com.samsung.da.module": "DHW",
|
||||
"x.com.samsung.da.temperatureType": "Water",
|
||||
"x.com.samsung.da.dayofWeek": [
|
||||
"Tue"
|
||||
],
|
||||
"x.com.samsung.da.timeblocks": [
|
||||
{
|
||||
"x.com.samsung.da.timeblockId": "0",
|
||||
"x.com.samsung.da.start": [
|
||||
{
|
||||
"x.com.samsung.da.time": "03:00",
|
||||
"x.com.samsung.da.power": "On",
|
||||
"x.com.samsung.da.mode": "Std",
|
||||
"x.com.samsung.da.desired": "45.0"
|
||||
}
|
||||
],
|
||||
"x.com.samsung.da.end": [
|
||||
{
|
||||
"x.com.samsung.da.time": "05:00",
|
||||
"x.com.samsung.da.power": "On",
|
||||
"x.com.samsung.da.mode": "Eco",
|
||||
"x.com.samsung.da.desired": "40.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"x.com.samsung.da.timelineId": "3",
|
||||
"x.com.samsung.da.module": "DHW",
|
||||
"x.com.samsung.da.temperatureType": "Water",
|
||||
"x.com.samsung.da.dayofWeek": [
|
||||
"Wed"
|
||||
],
|
||||
"x.com.samsung.da.timeblocks": [
|
||||
{
|
||||
"x.com.samsung.da.timeblockId": "0",
|
||||
"x.com.samsung.da.start": [
|
||||
{
|
||||
"x.com.samsung.da.time": "03:00",
|
||||
"x.com.samsung.da.power": "On",
|
||||
"x.com.samsung.da.mode": "Std",
|
||||
"x.com.samsung.da.desired": "45.0"
|
||||
}
|
||||
],
|
||||
"x.com.samsung.da.end": [
|
||||
{
|
||||
"x.com.samsung.da.time": "05:00",
|
||||
"x.com.samsung.da.power": "On",
|
||||
"x.com.samsung.da.mode": "Eco",
|
||||
"x.com.samsung.da.desired": "40.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"x.com.samsung.da.timelineId": "4",
|
||||
"x.com.samsung.da.module": "DHW",
|
||||
"x.com.samsung.da.temperatureType": "Water",
|
||||
"x.com.samsung.da.dayofWeek": [
|
||||
"Thu"
|
||||
],
|
||||
"x.com.samsung.da.timeblocks": [
|
||||
{
|
||||
"x.com.samsung.da.timeblockId": "0",
|
||||
"x.com.samsung.da.start": [
|
||||
{
|
||||
"x.com.samsung.da.time": "03:00",
|
||||
"x.com.samsung.da.power": "On",
|
||||
"x.com.samsung.da.mode": "Std",
|
||||
"x.com.samsung.da.desired": "45.0"
|
||||
}
|
||||
],
|
||||
"x.com.samsung.da.end": [
|
||||
{
|
||||
"x.com.samsung.da.time": "05:00",
|
||||
"x.com.samsung.da.power": "On",
|
||||
"x.com.samsung.da.mode": "Eco",
|
||||
"x.com.samsung.da.desired": "40.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"x.com.samsung.da.timelineId": "5",
|
||||
"x.com.samsung.da.module": "DHW",
|
||||
"x.com.samsung.da.temperatureType": "Water",
|
||||
"x.com.samsung.da.dayofWeek": [
|
||||
"Fri"
|
||||
],
|
||||
"x.com.samsung.da.timeblocks": [
|
||||
{
|
||||
"x.com.samsung.da.timeblockId": "0",
|
||||
"x.com.samsung.da.start": [
|
||||
{
|
||||
"x.com.samsung.da.time": "03:00",
|
||||
"x.com.samsung.da.power": "On",
|
||||
"x.com.samsung.da.mode": "Std",
|
||||
"x.com.samsung.da.desired": "45.0"
|
||||
}
|
||||
],
|
||||
"x.com.samsung.da.end": [
|
||||
{
|
||||
"x.com.samsung.da.time": "05:00",
|
||||
"x.com.samsung.da.power": "On",
|
||||
"x.com.samsung.da.mode": "Eco",
|
||||
"x.com.samsung.da.desired": "40.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"x.com.samsung.da.timelineId": "6",
|
||||
"x.com.samsung.da.module": "DHW",
|
||||
"x.com.samsung.da.temperatureType": "Water",
|
||||
"x.com.samsung.da.dayofWeek": [
|
||||
"Sat"
|
||||
],
|
||||
"x.com.samsung.da.timeblocks": [
|
||||
{
|
||||
"x.com.samsung.da.timeblockId": "0",
|
||||
"x.com.samsung.da.start": [
|
||||
{
|
||||
"x.com.samsung.da.time": "03:00",
|
||||
"x.com.samsung.da.power": "On",
|
||||
"x.com.samsung.da.mode": "Std",
|
||||
"x.com.samsung.da.desired": "45.0"
|
||||
}
|
||||
],
|
||||
"x.com.samsung.da.end": [
|
||||
{
|
||||
"x.com.samsung.da.time": "05:00",
|
||||
"x.com.samsung.da.power": "On",
|
||||
"x.com.samsung.da.mode": "Eco",
|
||||
"x.com.samsung.da.desired": "40.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"state_keys": [
|
||||
"alarm_code",
|
||||
"away_mode",
|
||||
"energy_kwh",
|
||||
"energy_saved_kwh",
|
||||
"firmware_update",
|
||||
"mute_once",
|
||||
"water_heater",
|
||||
"zone_mode",
|
||||
"zone_power",
|
||||
"zone_target_temperature",
|
||||
"zone_temperature"
|
||||
]
|
||||
}
|
||||
@@ -337,6 +337,20 @@ class TestForDeviceByModel:
|
||||
assert reg is not None
|
||||
assert reg.name == 'dehumidifier'
|
||||
|
||||
def test_ehs_via_ehs_token(self):
|
||||
"""A Samsung EHS air-to-water heat pump (TP1X_DA_AC_EHS_01001_0000)
|
||||
shares the DA_AC_ board family with the room-AC models but reports
|
||||
no oneUiVersion and carries the '_EHS_' (Eco Heating System) token
|
||||
instead of '_RAC_'/'_PRAC_'/'_WAC_'/'_DHM_'; falls back to the
|
||||
'_EHS_' token in modelNum."""
|
||||
from custom_components.localthings.registry.by_type import for_device_by_model
|
||||
reg = for_device_by_model(
|
||||
'TP1X_DA_AC_EHS_01001_0000|10250141|60070105001711034A00010000002000',
|
||||
'TP1X_DA_AC_EHS_01001_0000',
|
||||
)
|
||||
assert reg is not None
|
||||
assert reg.name == 'ehs'
|
||||
|
||||
def test_water_purifier_via_waterpurifier_token(self):
|
||||
"""Issue #90: a water purifier (TP2X_WATERPURIFIER_20K) reports no
|
||||
oneUiVersion and no consumer-prefix match; falls back to the
|
||||
|
||||
@@ -0,0 +1,199 @@
|
||||
"""Tests for Samsung EHS (Eco Heating System) heat pump support
|
||||
(TP1X_DA_AC_EHS_01001_0000).
|
||||
|
||||
HA-free like the rest of the suite: exercises the registry, discovery/
|
||||
flatten, and the zone/dhw mode and temperature write contracts.
|
||||
"""
|
||||
from custom_components.localthings.registry.adapter import flatten
|
||||
from custom_components.localthings.registry.by_type import for_device_by_model
|
||||
from custom_components.localthings.registry.discovery import discover
|
||||
from custom_components.localthings.registry.entities import NumberDesc, SelectDesc, WaterHeaterDesc
|
||||
|
||||
from tests.conftest import _load_device
|
||||
|
||||
|
||||
def _ehs():
|
||||
resources = _load_device('ehs')
|
||||
info = resources['/information/vs/0']
|
||||
reg = for_device_by_model(
|
||||
info['x.com.samsung.da.modelNum'], info['x.com.samsung.da.description'],
|
||||
)
|
||||
return reg, resources
|
||||
|
||||
|
||||
def _bound():
|
||||
reg, resources = _ehs()
|
||||
return discover(resources, reg.capabilities, reg.pattern_capabilities), resources
|
||||
|
||||
|
||||
def _state():
|
||||
bound, resources = _bound()
|
||||
return flatten(bound, resources)
|
||||
|
||||
|
||||
def _desc(key):
|
||||
bound, _ = _bound()
|
||||
return next(b.desc for b in bound if b.desc.key == key)
|
||||
|
||||
|
||||
def test_model_resolves_to_ehs_registry():
|
||||
reg, _ = _ehs()
|
||||
assert reg is not None and reg.name == 'ehs'
|
||||
|
||||
|
||||
def test_no_unbound_hrefs():
|
||||
"""Every resource in the real TP1X_DA_AC_EHS_01001_0000 dump binds or is
|
||||
covered -- clears the coverage-gap repair a device_type='unknown' entry
|
||||
raises."""
|
||||
reg, resources = _ehs()
|
||||
unbound = []
|
||||
discover(resources, reg.capabilities, reg.pattern_capabilities, log=unbound.append)
|
||||
assert unbound == []
|
||||
|
||||
|
||||
def test_expected_state_keys_present():
|
||||
state = _state()
|
||||
for key in ('zone_power', 'zone_mode', 'zone_temperature', 'zone_target_temperature',
|
||||
'water_heater', 'away_mode', 'mute_once', 'alarm_code', 'energy_kwh'):
|
||||
assert key in state, key
|
||||
|
||||
|
||||
def test_zone_temperature_reads_current_value():
|
||||
state = _state()
|
||||
assert state['zone_temperature'] == 30.0
|
||||
|
||||
|
||||
def test_zone_target_temperature_reads_desired_value():
|
||||
state = _state()
|
||||
assert state['zone_target_temperature'] == 5.0
|
||||
|
||||
|
||||
def test_zone_mode_reads_first_mode():
|
||||
state = _state()
|
||||
assert state['zone_mode'] == 'Cool'
|
||||
|
||||
|
||||
def test_zone_mode_select_options_come_from_live_supported_modes():
|
||||
"""Options are read live from x.com.samsung.da.supportedModes, not a
|
||||
hardcoded tuple -- so a future firmware with a different mode set is
|
||||
handled automatically."""
|
||||
desc = _desc('zone_mode')
|
||||
assert isinstance(desc, SelectDesc)
|
||||
assert desc.options_field == 'x.com.samsung.da.supportedModes'
|
||||
assert desc.options == ()
|
||||
|
||||
|
||||
def test_zone_mode_write_contract():
|
||||
desc = _desc('zone_mode')
|
||||
path, body = desc.write_fn('Heat', {})
|
||||
assert path == ['mode', 'vs', '0']
|
||||
assert body == {'x.com.samsung.da.modes': ['Heat']}
|
||||
|
||||
|
||||
def test_zone_power_reads_off():
|
||||
state = _state()
|
||||
assert state['zone_power'] is False
|
||||
|
||||
|
||||
def test_zone_power_write_contract():
|
||||
desc = _desc('zone_power')
|
||||
path, body = desc.write_fn('On', {})
|
||||
assert path == ['power', 'vs', '0']
|
||||
assert body == {'x.com.samsung.da.power': 'On'}
|
||||
|
||||
|
||||
def test_zone_target_temperature_write_contract():
|
||||
desc = _desc('zone_target_temperature')
|
||||
assert isinstance(desc, NumberDesc)
|
||||
path, body = desc.write_fn('21.5', {})
|
||||
assert path == ['temperatures', 'indoor', 'vs', '0']
|
||||
assert body == {'x.com.samsung.da.desired': '21.5'}
|
||||
|
||||
|
||||
def test_zone_target_temperature_bounds_read_live():
|
||||
"""min/max/step come from the device's own resource fields rather than
|
||||
a hardcoded constant -- see the adding-device-support skill's 'never
|
||||
hard-code the one dump's values' section."""
|
||||
desc = _desc('zone_target_temperature')
|
||||
rep = {'x.com.samsung.da.minimum': '5.0', 'x.com.samsung.da.maximum': '25.0'}
|
||||
assert desc.native_min_fn(rep) == 5.0
|
||||
assert desc.native_max_fn(rep) == 25.0
|
||||
assert desc.step_fn({'x.com.samsung.da.increment': '0.5'}) == 0.5
|
||||
# No live field: falls back to a sane default rather than raising.
|
||||
assert desc.native_min_fn({}) == 5.0
|
||||
assert desc.native_max_fn({}) == 30.0
|
||||
assert desc.step_fn({}) == 0.5
|
||||
|
||||
|
||||
def test_zone_target_temperature_bounds_fall_back_together():
|
||||
"""One end without the other is not a usable range: pairing a real
|
||||
device minimum with an invented default maximum looks plausible and is
|
||||
silently wrong, so a half-reported range falls back whole."""
|
||||
desc = _desc('zone_target_temperature')
|
||||
half = {'x.com.samsung.da.minimum': '10.0'}
|
||||
assert desc.native_min_fn(half) == 5.0
|
||||
assert desc.native_max_fn(half) == 30.0
|
||||
|
||||
|
||||
def test_zone_target_temperature_zero_increment_is_not_collapsed():
|
||||
"""`or` would turn a genuine 0 into the 0.5 default (issue #160)."""
|
||||
desc = _desc('zone_target_temperature')
|
||||
assert desc.step_fn({'x.com.samsung.da.increment': '0'}) == 0.0
|
||||
|
||||
|
||||
def test_water_heater_entity_is_bound():
|
||||
"""The composite water_heater entity binds the primary /mode/dhw/vs/0
|
||||
resource -- same primary-plus-siblings shape as the AC's ClimateDesc
|
||||
(see test_airconditioner_capabilities.py's test_climate_entity_is_bound)."""
|
||||
bound, _ = _bound()
|
||||
water_heaters = [b for b in bound if isinstance(b.desc, WaterHeaterDesc)]
|
||||
assert len(water_heaters) == 1
|
||||
assert water_heaters[0].href == '/mode/dhw/vs/0'
|
||||
|
||||
|
||||
def test_water_heater_reads_first_mode():
|
||||
"""The flattened/golden state exposes the same representative scalar
|
||||
the entity's current_operation is derived from -- see climate.py's
|
||||
_first_mode for the identical pattern on the AC side."""
|
||||
state = _state()
|
||||
assert state['water_heater'] == 'Eco'
|
||||
|
||||
|
||||
def test_water_heater_write_targets():
|
||||
"""DHW.entities[0].write_fn maps each (kind, value) command to the right
|
||||
vendor POST target and body -- power, mode and temperature only, no fan/
|
||||
swing/preset (the AC's climate.py has those; the DHW loop doesn't)."""
|
||||
write = _desc('water_heater').write_fn
|
||||
assert write(('power', True), {}) == (
|
||||
['power', 'dhw', 'vs', '0'], {'x.com.samsung.da.power': 'On'})
|
||||
assert write(('power', False), {}) == (
|
||||
['power', 'dhw', 'vs', '0'], {'x.com.samsung.da.power': 'Off'})
|
||||
assert write(('mode', 'Force'), {}) == (
|
||||
['mode', 'dhw', 'vs', '0'], {'x.com.samsung.da.modes': ['Force']})
|
||||
assert write(('temperature', 45.0), {}) == (
|
||||
['temperatures', 'dhw', 'vs', '0'], {'x.com.samsung.da.desired': '45.0'})
|
||||
assert write(('bogus', 1), {}) is None
|
||||
|
||||
|
||||
def test_dhw_power_and_temperature_declared_as_coverage():
|
||||
"""/power/dhw/vs/0 and /temperatures/dhw/vs/0 are read by the composite
|
||||
water_heater entity (via water_heater.py's sibling reads), not given
|
||||
their own entities -- declared as no-entity coverage caps so discover()
|
||||
reports no gap, same pattern as the AC's CLIMATE_CONSUMED_HREFS."""
|
||||
reg, _ = _ehs()
|
||||
for href in ('/power/dhw/vs/0', '/temperatures/dhw/vs/0'):
|
||||
caps = reg.capabilities.get(href)
|
||||
assert caps, href
|
||||
assert all(c.entities == () for c in caps), href
|
||||
|
||||
|
||||
def test_away_mode_reads_off():
|
||||
state = _state()
|
||||
assert state['away_mode'] is False
|
||||
|
||||
|
||||
def test_away_mode_write_contract():
|
||||
desc = _desc('away_mode')
|
||||
path, body = desc.write_fn('On', {})
|
||||
assert path == ['option', 'outgoing', 'vs', '0']
|
||||
assert body == {'x.com.samsung.da.away': 'On'}
|
||||
@@ -49,6 +49,18 @@ def test_registry_reproduces_golden_state_keys_for_washer():
|
||||
)
|
||||
|
||||
|
||||
def test_registry_reproduces_golden_state_keys_for_ehs():
|
||||
from tests.conftest import _load_device
|
||||
resources = _load_device('ehs')
|
||||
golden = json.loads((GOLDEN / 'ehs.json').read_text())
|
||||
state_keys = _new_state_keys('ehs', resources)
|
||||
assert set(state_keys) == set(golden['state_keys']), (
|
||||
f"state_keys mismatch:\n"
|
||||
f" extra: {sorted(set(state_keys) - set(golden['state_keys']))}\n"
|
||||
f" missing: {sorted(set(golden['state_keys']) - set(state_keys))}"
|
||||
)
|
||||
|
||||
|
||||
def test_registry_reproduces_golden_state_keys_for_washer_wa8000t():
|
||||
"""Top-load washer (WA8000T, issue #106) reports no oneUiVersion and
|
||||
used the 'WA' consumer-model prefix, previously unmapped in
|
||||
|
||||
@@ -129,7 +129,17 @@ def test_no_catalog_carries_unresolved_core_references():
|
||||
# so it presents as the device itself, and never reads a catalog name. Same
|
||||
# for the ARTIK051 air-purifier's airflow_fan (issue #56) -- ordered speed
|
||||
# levels, no presets, same _attr_name = None treatment.
|
||||
UNNAMED_DESCRIPTORS = {("fan", "fan"), ("fan", "airflow_fan")}
|
||||
#
|
||||
# The EHS DHW water_heater is deliberately NOT in here: it is one loop of a
|
||||
# two-loop device rather than the device itself, so it carries a catalog
|
||||
# name like everything else (entity.water_heater.dhw, via the descriptor's
|
||||
# translation_key). That is independent of its *states* -- those are all
|
||||
# HA's own standard water_heater states (STATE_ECO/HEAT_PUMP/HIGH_DEMAND/
|
||||
# PERFORMANCE/OFF), which Home Assistant translates itself via the
|
||||
# entity_component fallback, so no per-state entry is needed either way.
|
||||
UNNAMED_DESCRIPTORS = {
|
||||
("fan", "fan"), ("fan", "airflow_fan"),
|
||||
}
|
||||
|
||||
|
||||
def test_every_descriptor_has_an_entity_catalog_entry():
|
||||
|
||||
@@ -0,0 +1,212 @@
|
||||
"""HA water_heater-entity mapping tests for the EHS DHW loop."""
|
||||
|
||||
from homeassistant.components.water_heater import (
|
||||
STATE_ECO,
|
||||
STATE_HEAT_PUMP,
|
||||
STATE_HIGH_DEMAND,
|
||||
STATE_PERFORMANCE,
|
||||
WaterHeaterEntity,
|
||||
)
|
||||
from homeassistant.const import STATE_OFF, UnitOfTemperature
|
||||
|
||||
from custom_components.localthings.registry.by_type import ehs
|
||||
from custom_components.localthings.registry.discovery import discover
|
||||
from custom_components.localthings.registry.entities import WaterHeaterDesc
|
||||
from custom_components.localthings.water_heater import LocalThingsWaterHeater
|
||||
from tests.conftest import _load_device
|
||||
|
||||
|
||||
class _FakeCoordinator:
|
||||
device_serial = 'TEST-EHS-SERIAL'
|
||||
device_info = {}
|
||||
data = {}
|
||||
|
||||
def __init__(self, resources):
|
||||
self.last_resources = resources
|
||||
self.commands = []
|
||||
|
||||
def resource(self, href):
|
||||
return self.last_resources.get(href, {})
|
||||
|
||||
def canonical_resources(self, subdevice):
|
||||
# Every bound entity in this test uses the default MAIN subdevice,
|
||||
# so the canonical view is just the raw snapshot (issue #177 --
|
||||
# see LocalThingsEntity._resources).
|
||||
return self.last_resources
|
||||
|
||||
async def async_send_command(self, bound, payload):
|
||||
self.commands.append((bound, payload))
|
||||
|
||||
|
||||
def _entity(resources, coordinator=None):
|
||||
bound = discover(
|
||||
resources, ehs.REGISTRY.capabilities, ehs.REGISTRY.pattern_capabilities,
|
||||
)
|
||||
water_heater_bound = next(item for item in bound if isinstance(item.desc, WaterHeaterDesc))
|
||||
return LocalThingsWaterHeater(coordinator or _FakeCoordinator(resources), water_heater_bound)
|
||||
|
||||
|
||||
def test_current_operation_reads_eco_when_on():
|
||||
entity = _entity(_load_device('ehs'))
|
||||
assert entity.current_operation == STATE_ECO
|
||||
|
||||
|
||||
def test_current_operation_is_off_when_powered_off():
|
||||
resources = _load_device('ehs')
|
||||
resources['/power/dhw/vs/0']['x.com.samsung.da.power'] = 'Off'
|
||||
entity = _entity(resources)
|
||||
assert entity.current_operation == STATE_OFF
|
||||
|
||||
|
||||
def test_operation_list_includes_off_and_mapped_modes():
|
||||
"""Fixture's supportedModes is Eco/Std/Power/Force -- all four map onto
|
||||
HA's own standard water_heater states (see water_heater.py's module
|
||||
docstring for the SmartThings-cloud precedent this mirrors)."""
|
||||
entity = _entity(_load_device('ehs'))
|
||||
assert entity.operation_list == [
|
||||
STATE_OFF, STATE_ECO, STATE_HEAT_PUMP, STATE_PERFORMANCE, STATE_HIGH_DEMAND,
|
||||
]
|
||||
|
||||
|
||||
def test_temperature_reads_current_and_target():
|
||||
entity = _entity(_load_device('ehs'))
|
||||
assert entity.current_temperature == 38.0
|
||||
assert entity.target_temperature == 40.0
|
||||
assert entity.temperature_unit == UnitOfTemperature.CELSIUS
|
||||
assert entity.min_temp == 40.0
|
||||
assert entity.max_temp == 62.0
|
||||
assert entity.target_temperature_step == 0.5
|
||||
|
||||
|
||||
def test_temperature_bounds_fall_back_together():
|
||||
"""A board reporting only one end of the range must not pair a real
|
||||
device bound with an HA default -- both ends or neither, same rule as
|
||||
climate._range()."""
|
||||
resources = _load_device('ehs')
|
||||
del resources['/temperatures/dhw/vs/0']['x.com.samsung.da.maximum']
|
||||
entity = _entity(resources)
|
||||
|
||||
# Neither end comes from the device: the device minimum (40.0) is
|
||||
# dropped along with the missing maximum, so both fall back to HA's own
|
||||
# water_heater defaults rather than being mixed.
|
||||
assert entity.min_temp != 40.0
|
||||
assert (entity.min_temp, entity.max_temp) == (
|
||||
WaterHeaterEntity.min_temp.fget(entity),
|
||||
WaterHeaterEntity.max_temp.fget(entity),
|
||||
)
|
||||
|
||||
|
||||
def test_zero_increment_is_not_collapsed_into_the_default():
|
||||
"""`or` would turn a genuine 0 into 0.5 (issue #160)."""
|
||||
resources = _load_device('ehs')
|
||||
resources['/temperatures/dhw/vs/0']['x.com.samsung.da.increment'] = '0'
|
||||
entity = _entity(resources)
|
||||
|
||||
assert entity.target_temperature_step == 0.0
|
||||
|
||||
|
||||
def test_current_operation_tolerates_lowercase_device_codes():
|
||||
resources = _load_device('ehs')
|
||||
resources['/mode/dhw/vs/0']['x.com.samsung.da.modes'] = ['eco']
|
||||
entity = _entity(resources)
|
||||
|
||||
assert entity.current_operation == STATE_ECO
|
||||
|
||||
|
||||
def test_entity_is_named_rather_than_taking_the_device_name():
|
||||
"""Unlike climate.py's AC, DHW is one loop of a two-loop device, so it
|
||||
takes a catalog name instead of presenting as the device itself."""
|
||||
entity = _entity(_load_device('ehs'))
|
||||
|
||||
# No _attr_name override (that would present as the bare device name,
|
||||
# and would also beat the catalog); the name comes from the catalog key.
|
||||
assert '_attr_name' not in entity.__dict__
|
||||
assert entity.translation_key == 'dhw'
|
||||
|
||||
|
||||
async def test_set_temperature_writes_dhw_temperature():
|
||||
resources = _load_device('ehs')
|
||||
coordinator = _FakeCoordinator(resources)
|
||||
entity = _entity(resources, coordinator)
|
||||
|
||||
await entity.async_set_temperature(temperature=45.0)
|
||||
|
||||
assert coordinator.commands == [(entity._bound, ('temperature', 45.0))]
|
||||
|
||||
|
||||
async def test_set_temperature_honours_operation_mode():
|
||||
"""water_heater.set_temperature carries an optional operation_mode
|
||||
(SET_TEMPERATURE_SCHEMA); dropping it would move the setpoint without
|
||||
ever changing mode -- same bug fixed for climate's hvac_mode."""
|
||||
resources = _load_device('ehs')
|
||||
resources['/power/dhw/vs/0']['x.com.samsung.da.power'] = 'Off'
|
||||
coordinator = _FakeCoordinator(resources)
|
||||
entity = _entity(resources, coordinator)
|
||||
|
||||
await entity.async_set_temperature(temperature=55.0,
|
||||
operation_mode=STATE_HIGH_DEMAND)
|
||||
|
||||
assert coordinator.commands == [
|
||||
(entity._bound, ('power', True)),
|
||||
(entity._bound, ('mode', 'Force')),
|
||||
(entity._bound, ('temperature', 55.0)),
|
||||
]
|
||||
|
||||
|
||||
async def test_set_temperature_with_off_mode_skips_the_setpoint_write():
|
||||
resources = _load_device('ehs')
|
||||
coordinator = _FakeCoordinator(resources)
|
||||
entity = _entity(resources, coordinator)
|
||||
|
||||
await entity.async_set_temperature(temperature=55.0, operation_mode=STATE_OFF)
|
||||
|
||||
assert coordinator.commands == [(entity._bound, ('power', False))]
|
||||
|
||||
|
||||
async def test_turn_on_and_off_write_dhw_power():
|
||||
resources = _load_device('ehs')
|
||||
coordinator = _FakeCoordinator(resources)
|
||||
entity = _entity(resources, coordinator)
|
||||
|
||||
await entity.async_turn_on()
|
||||
await entity.async_turn_off()
|
||||
|
||||
assert coordinator.commands == [
|
||||
(entity._bound, ('power', True)),
|
||||
(entity._bound, ('power', False)),
|
||||
]
|
||||
|
||||
|
||||
async def test_set_operation_mode_off_turns_off_without_writing_mode():
|
||||
resources = _load_device('ehs')
|
||||
coordinator = _FakeCoordinator(resources)
|
||||
entity = _entity(resources, coordinator)
|
||||
|
||||
await entity.async_set_operation_mode(STATE_OFF)
|
||||
|
||||
assert coordinator.commands == [(entity._bound, ('power', False))]
|
||||
|
||||
|
||||
async def test_set_operation_mode_writes_mapped_device_code():
|
||||
resources = _load_device('ehs')
|
||||
coordinator = _FakeCoordinator(resources)
|
||||
entity = _entity(resources, coordinator)
|
||||
|
||||
await entity.async_set_operation_mode(STATE_HIGH_DEMAND)
|
||||
|
||||
# DHW power is already on (fixture default) -- no extra power write.
|
||||
assert coordinator.commands == [(entity._bound, ('mode', 'Force'))]
|
||||
|
||||
|
||||
async def test_set_operation_mode_powers_on_first_when_off():
|
||||
resources = _load_device('ehs')
|
||||
resources['/power/dhw/vs/0']['x.com.samsung.da.power'] = 'Off'
|
||||
coordinator = _FakeCoordinator(resources)
|
||||
entity = _entity(resources, coordinator)
|
||||
|
||||
await entity.async_set_operation_mode(STATE_PERFORMANCE)
|
||||
|
||||
assert coordinator.commands == [
|
||||
(entity._bound, ('power', True)),
|
||||
(entity._bound, ('mode', 'Power')),
|
||||
]
|
||||
Reference in new issue
Block a user