Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
6b46938
Merge pull request #1 from mypalg/test
mypal Jun 28, 2019
9fd3f74
Update README.md
mypal Jun 28, 2019
2fb7a6d
Merge pull request #2 from mypalg/test
mypal Jul 25, 2019
d8d7103
Merge pull request #3 from mypalg/test
mypal Jul 29, 2019
11e98ce
Merge pull request #6 from mypal/test
mypal Jul 10, 2021
aa9ea91
Merge pull request #8 from mypal/test
mypal Jul 16, 2021
7ad154d
Merge pull request #10 from mypal/test
mypal Jul 19, 2021
0c40550
Merge pull request #11 from mypal/test
mypal Jul 19, 2021
92aaeee
Merge pull request #13 from mypal/test
mypal Jul 24, 2021
99356e3
Merge pull request #14 from mypal/test
mypal Jul 24, 2021
7c987fd
Merge pull request #16 from mypal/test
mypal Jul 25, 2021
d8dd871
Merge pull request #18 from mypal/test
mypal Jul 29, 2021
a5193e9
Merge pull request #19 from mypal/test
mypal Jul 29, 2021
67928f3
Merge pull request #20 from mypal/test
mypal Jul 29, 2021
398f546
Merge pull request #21 from mypal/test
mypal Jul 29, 2021
7863d50
Merge pull request #22 from mypal/test
mypal Jul 30, 2021
112c6d8
Merge pull request #23 from mypal/test
mypal Jul 30, 2021
bb0313e
Merge pull request #25 from mypal/test
mypal Oct 10, 2021
e602fe4
Ventilator detection and power control
ypwub5 Aug 19, 2022
a9c504c
small vam test
ypwub5 Sep 20, 2022
6838f05
Merge pull request #39 from mypal/test
mypal Nov 11, 2022
2f2deb1
Merge branch 'master' into smallVAM
ypwub5 Nov 14, 2022
820e802
Merge branch 'mypal:test' into vent
ypwub5 Nov 23, 2022
d504899
feat: add suport for smallVAM
lightrabbit Oct 7, 2023
2204af0
Merge branch 'test' into smallVAM
lightrabbit Oct 7, 2023
304bef8
fix: device info
lightrabbit Oct 7, 2023
117dded
fix: bug
lightrabbit Oct 7, 2023
b4d4806
fix: 网关兼容性问题
lightrabbit Oct 21, 2023
863efbc
feat: 让标准VAM也支持修改模式和风速
lightrabbit Oct 21, 2023
b957b41
feat: 支持SmallVAM的传感器
lightrabbit Oct 21, 2023
9b47bd1
fix: fix ventilation sensor unavailable when ventilation status changed
lightrabbit Oct 22, 2023
1635ec0
fix: 户外温度低于0度时出现下溢出的问题
lightrabbit Jan 5, 2024
b0ab209
Merge branch 'mypal:test' into vent
ypwub5 Jul 28, 2024
fd276b9
Merge branch 'mypal:test' into vent
ypwub5 Jan 9, 2025
df4573a
Merge branch 'test' of github.com:mypal/ha-dsair into smallVAM
llcc01 Jan 24, 2025
d1cbe76
Merge remote-tracking branch 'lightrabbit/smallVAM' into vent
misaka4e21 Jan 27, 2025
2839f7f
fix: Update fan.py to use small VAM on HA 2025.01
misaka4e21 Jan 27, 2025
f3b060a
vam: bump version to 1.3.5
llcc01 Feb 3, 2025
b44c5d8
修复标准VAM的风量和电源开关
llcc01 Feb 3, 2025
6b8954e
修复标准VAM风量控制逻辑并确保开关状态正确
llcc01 Feb 3, 2025
5d73f59
Merge remote-tracking branch 'llcc01/smallVAM' into smallVAM
misaka4e21 Feb 8, 2025
a75dc82
fix: Fix C611 gateways and standards VAMs.
misaka4e21 Feb 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
或使用hacs载入自定义存储库,设置URL```https://github.com/mypal/ha-dsair``` ,类别 ```集成```
2. 本集成已支持ha可视化配置,在配置-集成-添加集成中选择```DS-AIR``` ,依次填入网关IP、端口号、设备型号提交即可

# TODO

根据APP反解显示,网关可控制新风、地暖、HD(不知道是个啥设备)、新版空调、老版空调和浴室设备。由于我家只有新版室内机,所以目前只实现了这个。其他设备实现没写完,理论上都不能够支持。

# 开发过程

本组件开发过程可在[blog](https://www.mypal.wang/blog/lun-yi-ci-jia-yong-kong-diao-jie-ru-hazhe-teng-jing-li/)查看
7 changes: 4 additions & 3 deletions custom_components/ds_air/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
from homeassistant.core import HomeAssistant

from .hass_inst import GetHass
from .const import CONF_GW, DEFAULT_HOST, DEFAULT_PORT, DEFAULT_GW, DOMAIN
from .const import CONF_GW, DEFAULT_HOST, DEFAULT_PORT, C611, D611, DOMAIN
from .ds_air_service.config import Config

_LOGGER = logging.getLogger(__name__)
PLATFORMS = ["climate", "sensor"]
PLATFORMS = ["climate", "sensor", "fan"]


def _log(s: str):
Expand Down Expand Up @@ -43,7 +43,8 @@ async def async_setup_entry(
hass.data[DOMAIN][CONF_GW] = gw
hass.data[DOMAIN][CONF_SCAN_INTERVAL] = scan_interval

Config.is_c611 = gw == DEFAULT_GW
Config.is_c611 = gw == C611
Config.is_d611 = gw == D611

from .ds_air_service.service import Service
await hass.async_add_executor_job(Service.init, host, port, scan_interval)
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ds_air/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def current_temperature(self):
if self._link_cur_temp:
return self._cur_temp
else:
if Config.is_c611:
if Config.is_c611 or Config.is_d611:
return None
else:
return self._device_info.status.current_temp / 10
Expand Down
16 changes: 14 additions & 2 deletions custom_components/ds_air/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@
CONF_GW = "gw"
DEFAULT_HOST = "192.168.1."
DEFAULT_PORT = 8008
DEFAULT_GW = "DTA117C611"
GW_LIST = ["DTA117C611", "DTA117B611"]

B611 = "DTA117B611"
C611 = "DTA117C611"
D611 = "DTA117D611"
DEFAULT_GW = C611
GW_LIST = [C611, B611, D611]

SENSOR_TYPES = {
"temp": [UnitOfTemperature.CELSIUS, None, SensorDeviceClass.TEMPERATURE, 10],
"humidity": [PERCENTAGE, None, SensorDeviceClass.HUMIDITY, 10],
Expand All @@ -19,3 +24,10 @@
"voc": [None, None, SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS_PARTS, EnumSensor.Voc],
"hcho": [CONCENTRATION_MILLIGRAMS_PER_CUBIC_METER, None, None, 100],
}

SMALL_VAM_SENSOR_TYPES = {
"in_door_temp": [UnitOfTemperature.CELSIUS, None, SensorDeviceClass.TEMPERATURE, 10],
"out_door_temp": [UnitOfTemperature.CELSIUS, None, SensorDeviceClass.TEMPERATURE, 10],
"out_door_humidity": [PERCENTAGE, None, SensorDeviceClass.HUMIDITY, 1],
"pm25": [CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, None, SensorDeviceClass.PM25, 1],
}
1 change: 1 addition & 0 deletions custom_components/ds_air/ds_air_service/config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
class Config:
is_new_version: bool = False
is_c611: bool = True # 金制空气c611 or ds-air b611
is_d611: bool = False # 金制空气d611
29 changes: 28 additions & 1 deletion custom_components/ds_air/ds_air_service/ctrl_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class EnumCmdType(IntEnum):
HCHO_SET_INFO = 151
HCHO_GET_SENSORS = 152
SYS_ADDRESS_ALLOCATION = 218
SMALL_VAM_QUERY_AIR_QUALITY = 52
SMALL_VAM_QUERY_COMPOSITE_SITUATION = 52
SMALL_VAM_LINKAGE_CONTROL = 53
SMALL_VAM_LINKAGE_STATUS = 54
HUMIDIFIER_GET_ALL_DEVICES = 4
Expand Down Expand Up @@ -243,6 +243,7 @@ class AirFlow(IntEnum):

#_AIR_FLOW_NAME_LIST = ['最弱', '稍弱', '中等', '稍强', '最强', '自动']
_AIR_FLOW_NAME_LIST = [FAN_LOW, '稍弱', FAN_MEDIUM, '稍强', FAN_HIGH, FAN_AUTO]
_VENT_AIR_FLOW_NAME_LIST = ['INVALID', '静音', '中速', '高速', '暴风']

class Breathe(IntEnum):
CLOSE = 0
Expand Down Expand Up @@ -304,6 +305,8 @@ class Mode(IntEnum):
HVACMode.DRY, HVACMode.AUTO, HVACMode.AUTO, HVACMode.HEAT, HVACMode.DRY]
_MODE_ACTION_LIST = [HVACAction.COOLING, HVACAction.DRYING, HVACAction.FAN, None, HVACAction.HEATING,
HVACAction.DRYING, None, None, HVACAction.PREHEATING, HVACAction.DRYING]
_MODE_VENT_NAME_LIST_SMALL_VAM = ["内循环", "热交换", "自动", "防污染", "排异味"]
_MODE_VENT_NAME_LIST_STANDARD_VAM = ["旁通", "热交换", "自动"]

class Switch(IntEnum):
OFF = 0
Expand Down Expand Up @@ -345,13 +348,37 @@ def get_action_name(idx):
def get_mode_enum(name):
return Mode(_MODE_NAME_LIST.index(name))

@staticmethod
def get_vent_mode_name_small_vam(idx):
return _MODE_VENT_NAME_LIST_SMALL_VAM[idx]

@staticmethod
def get_vent_mode_enum_small_vam(name: str):
return Mode(_MODE_VENT_NAME_LIST_SMALL_VAM.index(name))

@staticmethod
def get_vent_mode_name_standard_vam(idx):
return _MODE_VENT_NAME_LIST_STANDARD_VAM[idx]

@staticmethod
def get_vent_mode_enum_standard_vam(name: str):
return Mode(_MODE_VENT_NAME_LIST_STANDARD_VAM.index(name))

@staticmethod
def get_air_flow_name(idx):
return _AIR_FLOW_NAME_LIST[idx]

@staticmethod
def get_air_flow_enum(name):
return AirFlow(_AIR_FLOW_NAME_LIST.index(name))

@staticmethod
def get_vent_air_flow_name(idx):
return _VENT_AIR_FLOW_NAME_LIST[idx]

@staticmethod
def get_vent_air_flow_enum(name):
return AirFlow(_VENT_AIR_FLOW_NAME_LIST.index(name))

@staticmethod
def get_fan_direction_name(idx):
Expand Down
28 changes: 26 additions & 2 deletions custom_components/ds_air/ds_air_service/dao.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def get_device_by_aircon(aircon: AirCon):
else:
return EnumDevice.AIRCON


class Geothermic(Device):
"""do nothing"""

Expand All @@ -86,6 +85,31 @@ class Ventilation(Device):
def __init__(self):
Device.__init__(self)
self.is_small_vam = False # type: bool
self.capability = 0 # type: int
self.status = VentilationStatus() #type: VentilationStatus

def get_device_by_vent(vent: Ventilation):
if vent.is_small_vam:
return EnumDevice.SMALL_VAM
else:
return EnumDevice.VENTILATION

class VentilationStatus:
def __init__(self,
switch: EnumControl.Switch = None,
mode: EnumControl.Mode = None,
air_flow: EnumControl.AirFlow = None,
in_door_temp: int = None,
out_door_temp: int = None,
out_door_humidity: int = None,
pm25: int = None):
self.switch: EnumControl.Switch = switch
self.mode: EnumControl.Mode = mode
self.air_flow: EnumControl.AirFlow = air_flow
self.in_door_temp: int = in_door_temp
self.out_door_temp: int = out_door_temp
self.out_door_humidity: int = out_door_humidity
self.pm25: int = pm25


class HD(Device):
Expand Down Expand Up @@ -148,4 +172,4 @@ def __init__(self):
self.id = 0 # type: int
self.name = '' # type: str
self.type = 0 # type: int
self.ventilation = Ventilation() # type: Optional[Ventilation]
self.ventilation = None # type: Optional[Ventilation]
Loading