Skip to content

Commit

Permalink
add support for furnaces (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
zlangbert authored Jun 18, 2023
1 parent 41e6903 commit 56ff60a
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 19 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ If you have a Daikin One+ system and your equipment is not listed here, please o

* [DZ9VC](https://daikincomfort.com/products/heating-cooling/whole-house/heat-pump/dz9vc)

### Air Conditioners

* [DX6VS](https://daikincomfort.com/products/heating-cooling/whole-house/air-conditioner/daikin-fit-dx6vs)

### Furnaces

None yet!
* [DM80VC](https://daikincomfort.com/products/heating-cooling/whole-house/gas-furnaces/dm80vc)

## Installation

Expand Down
41 changes: 38 additions & 3 deletions custom_components/daikinone/daikinone.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,17 @@ class DaikinEquipment(DaikinDevice):


@dataclass
class DaikinAirHandler(DaikinEquipment):
class DaikinIndoorUnit(DaikinEquipment):
mode: str
current_airflow: int
fan_demand_requested_percent: int
fan_demand_current_percent: int
heat_demand_requested_percent: int
heat_demand_current_percent: int
cool_demand_requested_percent: int | None
cool_demand_current_percent: int | None
humidification_demand_requested_percent: int
dehumidification_demand_requested_percent: int | None
power_usage: float


Expand Down Expand Up @@ -262,11 +265,12 @@ def __map_equipment(self, payload: DaikinDeviceDataResponse) -> dict[str, Daikin
model = payload.data["ctAHModelNoCharacter1_15"].strip()
serial = payload.data["ctAHSerialNoCharacter1_15"].strip()
eid = f"{model}-{serial}"
name = "Air Handler"

equipment[eid] = DaikinAirHandler(
equipment[eid] = DaikinIndoorUnit(
id=eid,
thermostat_id=payload.id,
name="Air Handler",
name=name,
model=model,
firmware_version=payload.data["ctAHControlSoftwareVersion"].strip(),
serial=serial,
Expand All @@ -276,10 +280,41 @@ def __map_equipment(self, payload: DaikinDeviceDataResponse) -> dict[str, Daikin
fan_demand_current_percent=payload.data["ctAHFanCurrentDemandStatus"] / 2,
heat_demand_requested_percent=payload.data["ctAHHeatRequestedDemand"] / 2,
heat_demand_current_percent=payload.data["ctAHHeatCurrentDemandStatus"] / 2,
cool_demand_requested_percent=None,
cool_demand_current_percent=None,
humidification_demand_requested_percent=payload.data["ctAHHumidificationRequestedDemand"] / 2,
dehumidification_demand_requested_percent=None,
power_usage=payload.data["ctIndoorPower"] / 10,
)

# furnace
if payload.data["ctIFCUnitType"] < 255:
model = payload.data["ctIFCModelNoCharacter1_15"].strip()
serial = payload.data["ctIFCSerialNoCharacter1_15"].strip()
eid = f"{model}-{serial}"
name = "Furnace"

equipment[eid] = DaikinIndoorUnit(
id=eid,
thermostat_id=payload.id,
name=name,
model=model,
firmware_version=payload.data["ctIFCControlSoftwareVersion"].strip(),
serial=serial,
mode=payload.data["ctIFCOperatingHeatCoolMode"].strip().capitalize(),
current_airflow=payload.data["ctIFCIndoorBlowerAirflow"],
fan_demand_requested_percent=payload.data["ctIFCFanRequestedDemandPercent"] / 2,
fan_demand_current_percent=payload.data["ctIFCCurrentFanActualStatus"] / 2,
heat_demand_requested_percent=payload.data["ctIFCHeatRequestedDemandPercent"] / 2,
heat_demand_current_percent=payload.data["ctIFCCurrentHeatActualStatus"] / 2,
cool_demand_requested_percent=payload.data["ctIFCCoolRequestedDemandPercent"] / 2,
cool_demand_current_percent=payload.data["ctIFCCurrentCoolActualStatus"] / 2,
humidification_demand_requested_percent=payload.data["ctIFCHumRequestedDemandPercent"] / 2,
dehumidification_demand_requested_percent=payload.data["ctIFCDehumRequestedDemandPercent"] / 2,
power_usage=payload.data["ctIndoorPower"] / 10,
)

# outdoor unit
if payload.data["ctOutdoorUnitType"] < 255:
model = payload.data["ctOutdoorModelNoCharacter1_15"].strip()
serial = payload.data["ctOutdoorSerialNoCharacter1_15"].strip()
Expand Down
56 changes: 54 additions & 2 deletions custom_components/daikinone/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from custom_components.daikinone.daikinone import (
DaikinDevice,
DaikinThermostat,
DaikinAirHandler,
DaikinIndoorUnit,
DaikinEquipment,
DaikinOutdoorUnit,
)
Expand Down Expand Up @@ -63,7 +63,7 @@ async def async_setup_entry(
for equipment in thermostat.equipment.values():
match equipment:
# air handler sensors
case DaikinAirHandler():
case DaikinIndoorUnit():
entities += [
DaikinOneEquipmentSensor(
description=SensorEntityDescription(
Expand Down Expand Up @@ -170,6 +170,58 @@ async def async_setup_entry(
),
]

# optional indoor unit sensors
if equipment.cool_demand_requested_percent is not None:
entities.append(
DaikinOneEquipmentSensor(
description=SensorEntityDescription(
key="cool_demand_requested",
name="Cool Demand Requested",
has_entity_name=True,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=PERCENTAGE,
icon="mdi:snowflake-thermometer",
),
data=data,
device=equipment,
attribute=lambda e: e.cool_demand_requested_percent,
)
)

if equipment.cool_demand_current_percent is not None:
entities.append(
DaikinOneEquipmentSensor(
description=SensorEntityDescription(
key="cool_demand_current",
name="Cool Demand Current",
has_entity_name=True,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=PERCENTAGE,
icon="mdi:snowflake-thermometer",
),
data=data,
device=equipment,
attribute=lambda e: e.cool_demand_current_percent,
)
)

if equipment.dehumidification_demand_requested_percent is not None:
entities.append(
DaikinOneEquipmentSensor(
description=SensorEntityDescription(
key="dehumidification_demand_requested",
name="Dehumidification Demand Requested",
has_entity_name=True,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=PERCENTAGE,
icon="mdi:air-humidifier",
),
data=data,
device=equipment,
attribute=lambda e: e.dehumidification_demand_requested_percent,
)
)

# outdoor unit sensors
case DaikinOutdoorUnit():
entities += [
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = "Add a short description here"
authors = [
{ name = "Zach Langbert", email = "[email protected]" }
]
dependencies = ["homeassistant~=2023.5.4", "pydantic~=1.10.8", "backoff~=2.2.1"]
dependencies = ["homeassistant~=2023.6.1", "pydantic~=1.10.8", "backoff~=2.2.1"]
readme = "README.md"
requires-python = ">= 3.11"

Expand All @@ -18,7 +18,7 @@ managed = true
dev-dependencies = [
"setuptools~=67.8.0",
"ruff~=0.0.270",
"pyright~=1.1.311",
"pyright~=1.1.314",
"black[d]~=23.3.0",
]

Expand Down
12 changes: 6 additions & 6 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,30 @@ cryptography==40.0.2
frozenlist==1.3.3
h11==0.14.0
home-assistant-bluetooth==1.10.0
homeassistant==2023.5.4
homeassistant==2023.6.2
httpcore==0.17.2
httpx==0.24.1
idna==3.4
ifaddr==0.1.7
ifaddr==0.2.0
jinja2==3.1.2
lru-dict==1.1.8
markupsafe==2.1.2
multidict==6.0.4
mypy-extensions==1.0.0
nodeenv==1.8.0
orjson==3.8.10
orjson==3.8.12
packaging==23.1
pathspec==0.11.1
platformdirs==3.5.1
pycparser==2.21
pydantic==1.10.8
pyjwt==2.6.0
pyjwt==2.7.0
pyopenssl==23.1.0
pyright==1.1.311
pyright==1.1.314
python-slugify==4.0.1
pytz==2023.3
pyyaml==6.0
requests==2.28.2
requests==2.31.0
ruff==0.0.270
sniffio==1.3.0
text-unidecode==1.3
Expand Down
10 changes: 5 additions & 5 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,24 @@ cryptography==40.0.2
frozenlist==1.3.3
h11==0.14.0
home-assistant-bluetooth==1.10.0
homeassistant==2023.5.4
homeassistant==2023.6.2
httpcore==0.17.2
httpx==0.24.1
idna==3.4
ifaddr==0.1.7
ifaddr==0.2.0
jinja2==3.1.2
lru-dict==1.1.8
markupsafe==2.1.2
multidict==6.0.4
orjson==3.8.10
orjson==3.8.12
pycparser==2.21
pydantic==1.10.8
pyjwt==2.6.0
pyjwt==2.7.0
pyopenssl==23.1.0
python-slugify==4.0.1
pytz==2023.3
pyyaml==6.0
requests==2.28.2
requests==2.31.0
sniffio==1.3.0
text-unidecode==1.3
typing-extensions==4.6.2
Expand Down

0 comments on commit 56ff60a

Please sign in to comment.