『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 213|回复: 7

[技术探讨] 格力风管机加入后实体不可用

[复制链接]

1

主题

23

帖子

107

积分

注册会员

Rank: 2

积分
107
金钱
84
HASS币
0
发表于 2025-1-11 14:26:13 | 显示全部楼层 |阅读模式
本帖最后由 Doctor666 于 2025-1-11 14:34 编辑

事件经过:
我家网络使用AC+吸顶AP,有三台格力K+系列风管机,均使用面板控制,面板型号:XC71-24/HCB1带wifi带背光面板,面板均成功加入格力+app!
我尝试用HA官方格力插件,运行后提示未发现网络设备,前后尝试很多次,以为是网络问题,期间我把HA和三个空调面板均连接至同一个路由器,多次尝试,仍旧不行!我就开始爬论坛帖子,论坛有两个第三方插件,地址如下:
第一个:https://github.com/RobHofmann/HomeAssistant-GreeClimateComponent第二个:https://github.com/xcy1231/Ha-GreeCentralClimate
第二个按照说明,配置后无可用实体,尝试几次后放弃!

第一个按照说明配置后,开始没有实体可用,后面我固定三个空调ip,重新按要求配置,重启HA,显示有三个实体,点进去,显示不可用!具体见下图:

空调实体图片

空调实体图片

三个实体都是显示不可用!
下面是运行日:
2025-01-10 02:48:37.590 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2025-01-10 02:48:37.593 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration gree which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2025-01-10 02:48:37.596 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration webrtc which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2025-01-10 02:48:37.599 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration candy which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2025-01-10 02:48:37.602 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration ezviz which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2025-01-10 02:48:37.605 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration deebot which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2025-01-10 02:48:37.608 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration nodered which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2025-01-10 02:48:37.611 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration ds_air which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2025-01-10 02:48:37.614 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration haier which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2025-01-10 02:48:37.617 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration midea_ac_lan which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2025-01-10 02:48:37.619 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration colorfulclouds which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2025-01-10 02:48:41.721 INFO (MainThread) [custom_components.gree.climate] Setting up Gree climate platform
2025-01-10 02:48:41.722 INFO (MainThread) [custom_components.gree.climate] Adding Gree climate device to hass
2025-01-10 02:48:41.722 INFO (MainThread) [custom_components.gree.climate] Initialize the GREE climate device
2025-01-10 02:48:41.723 INFO (MainThread) [custom_components.gree.climate] name(): 客厅空调
2025-01-10 02:48:41.723 INFO (MainThread) [custom_components.gree.climate] name(): 客厅空调
2025-01-10 02:48:41.723 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:48:41.723 INFO (MainThread) [custom_components.gree.climate] temperature_unit(): °C
2025-01-10 02:48:41.723 INFO (MainThread) [custom_components.gree.climate] hvac_modes(): [<HVACMode.AUTO: 'auto'>, <HVACMode.COOL: 'cool'>, <HVACMode.DRY: 'dry'>, <HVACMode.FAN_ONLY: 'fan_only'>, <HVACMode.HEAT: 'heat'>, <HVACMode.OFF: 'off'>]
2025-01-10 02:48:41.724 INFO (MainThread) [custom_components.gree.climate] min_temp(): 16
2025-01-10 02:48:41.724 INFO (MainThread) [custom_components.gree.climate] max_temp(): 30
2025-01-10 02:48:41.724 INFO (MainThread) [custom_components.gree.climate] target_temperature_step(): 1.0
2025-01-10 02:48:41.724 INFO (MainThread) [custom_components.gree.climate] fan_list(): ['Auto', 'Low', 'Medium-Low', 'Medium', 'Medium-High', 'High', 'Turbo', 'Quiet']
2025-01-10 02:48:41.724 INFO (MainThread) [custom_components.gree.climate] swing_modes(): ['Default', 'Swing in full range', 'Fixed in the upmost position', 'Fixed in the middle-up position', 'Fixed in the middle position', 'Fixed in the middle-low position', 'Fixed in the lowest position', 'Swing in the downmost region', 'Swing in the middle-low region', 'Swing in the middle region', 'Swing in the middle-up region', 'Swing in the upmost region']
2025-01-10 02:48:41.725 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:48:41.725 INFO (MainThread) [custom_components.gree.climate] Gree climate device added to hass()
2025-01-10 02:48:41.726 INFO (MainThread) [custom_components.gree.climate] update()
2025-01-10 02:48:41.727 INFO (MainThread) [custom_components.gree.climate] Retrieving HVAC encryption key
2025-01-10 02:48:41.751 INFO (MainThread) [custom_components.gree.climate] Fetching(192.168.0.7, 7000, 10, {"cid": "app","i": 1,"pack": "Jtod3XIt89Lqss6DOHEWBZp1vYcAzgfkbQU3H+DJn/zDIm9XjlNrft3x9aCGHseEwf35XMKtIPQDq97Iev6J","t":"pack","tcid":"9424b8c2545d","uid": 0, "tag" : "Sou3N51DfdQbAyf3RGcrMQ=="})
2025-01-10 02:48:51.770 INFO (MainThread) [custom_components.gree.climate] Error getting device encryption key!
2025-01-10 02:48:51.772 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:48:51.773 INFO (MainThread) [custom_components.gree.climate] temperature_unit(): °C
2025-01-10 02:48:51.774 INFO (MainThread) [custom_components.gree.climate] hvac_modes(): [<HVACMode.AUTO: 'auto'>, <HVACMode.COOL: 'cool'>, <HVACMode.DRY: 'dry'>, <HVACMode.FAN_ONLY: 'fan_only'>, <HVACMode.HEAT: 'heat'>, <HVACMode.OFF: 'off'>]
2025-01-10 02:48:51.774 INFO (MainThread) [custom_components.gree.climate] min_temp(): 16
2025-01-10 02:48:51.774 INFO (MainThread) [custom_components.gree.climate] max_temp(): 30
2025-01-10 02:48:51.775 INFO (MainThread) [custom_components.gree.climate] target_temperature_step(): 1.0
2025-01-10 02:48:51.775 INFO (MainThread) [custom_components.gree.climate] fan_list(): ['Auto', 'Low', 'Medium-Low', 'Medium', 'Medium-High', 'High', 'Turbo', 'Quiet']
2025-01-10 02:48:51.775 INFO (MainThread) [custom_components.gree.climate] swing_modes(): ['Default', 'Swing in full range', 'Fixed in the upmost position', 'Fixed in the middle-up position', 'Fixed in the middle position', 'Fixed in the middle-low position', 'Fixed in the lowest position', 'Swing in the downmost region', 'Swing in the middle-low region', 'Swing in the middle region', 'Swing in the middle-up region', 'Swing in the upmost region']
2025-01-10 02:48:51.775 INFO (MainThread) [custom_components.gree.climate] available(): Device is offline
2025-01-10 02:48:51.776 INFO (MainThread) [custom_components.gree.climate] name(): 客厅空调
2025-01-10 02:48:51.776 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:48:51.778 INFO (MainThread) [custom_components.gree.climate] should_poll()
2025-01-10 02:48:51.780 INFO (MainThread) [custom_components.gree.climate] Setting up Gree climate platform
2025-01-10 02:48:51.781 INFO (MainThread) [custom_components.gree.climate] Adding Gree climate device to hass
2025-01-10 02:48:51.781 INFO (MainThread) [custom_components.gree.climate] Initialize the GREE climate device
2025-01-10 02:48:51.781 INFO (MainThread) [custom_components.gree.climate] name(): 主卧空调
2025-01-10 02:48:51.782 INFO (MainThread) [custom_components.gree.climate] name(): 主卧空调
2025-01-10 02:48:51.782 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:48:51.782 INFO (MainThread) [custom_components.gree.climate] temperature_unit(): °C
2025-01-10 02:48:51.782 INFO (MainThread) [custom_components.gree.climate] hvac_modes(): [<HVACMode.AUTO: 'auto'>, <HVACMode.COOL: 'cool'>, <HVACMode.DRY: 'dry'>, <HVACMode.FAN_ONLY: 'fan_only'>, <HVACMode.HEAT: 'heat'>, <HVACMode.OFF: 'off'>]
2025-01-10 02:48:51.782 INFO (MainThread) [custom_components.gree.climate] min_temp(): 16
2025-01-10 02:48:51.782 INFO (MainThread) [custom_components.gree.climate] max_temp(): 30
2025-01-10 02:48:51.783 INFO (MainThread) [custom_components.gree.climate] target_temperature_step(): 1.0
2025-01-10 02:48:51.783 INFO (MainThread) [custom_components.gree.climate] fan_list(): ['Auto', 'Low', 'Medium-Low', 'Medium', 'Medium-High', 'High', 'Turbo', 'Quiet']
2025-01-10 02:48:51.783 INFO (MainThread) [custom_components.gree.climate] swing_modes(): ['Default', 'Swing in full range', 'Fixed in the upmost position', 'Fixed in the middle-up position', 'Fixed in the middle position', 'Fixed in the middle-low position', 'Fixed in the lowest position', 'Swing in the downmost region', 'Swing in the middle-low region', 'Swing in the middle region', 'Swing in the middle-up region', 'Swing in the upmost region']
2025-01-10 02:48:51.783 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:48:51.784 INFO (MainThread) [custom_components.gree.climate] Gree climate device added to hass()
2025-01-10 02:48:51.784 INFO (MainThread) [custom_components.gree.climate] update()
2025-01-10 02:48:51.784 INFO (MainThread) [custom_components.gree.climate] Retrieving HVAC encryption key
2025-01-10 02:48:51.791 INFO (MainThread) [custom_components.gree.climate] Fetching(192.168.0.5, 7000, 10, {"cid": "app","i": 1,"pack": "Jtod3XIt89Lqss6DOHEWBZp37dIAzgfkbQU3H+DJn/zDIm9XjlNrfI2k9aCGHseEwf35XMKtIPQDq97Iev6J","t":"pack","tcid":"9424b8c256e1","uid": 0, "tag" : "37SN26TCSrVzi7SbxD9SbA=="})
2025-01-10 02:49:01.803 INFO (MainThread) [custom_components.gree.climate] Error getting device encryption key!
2025-01-10 02:49:01.806 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:49:01.806 INFO (MainThread) [custom_components.gree.climate] temperature_unit(): °C
2025-01-10 02:49:01.807 INFO (MainThread) [custom_components.gree.climate] hvac_modes(): [<HVACMode.AUTO: 'auto'>, <HVACMode.COOL: 'cool'>, <HVACMode.DRY: 'dry'>, <HVACMode.FAN_ONLY: 'fan_only'>, <HVACMode.HEAT: 'heat'>, <HVACMode.OFF: 'off'>]
2025-01-10 02:49:01.807 INFO (MainThread) [custom_components.gree.climate] min_temp(): 16
2025-01-10 02:49:01.807 INFO (MainThread) [custom_components.gree.climate] max_temp(): 30
2025-01-10 02:49:01.807 INFO (MainThread) [custom_components.gree.climate] target_temperature_step(): 1.0
2025-01-10 02:49:01.808 INFO (MainThread) [custom_components.gree.climate] fan_list(): ['Auto', 'Low', 'Medium-Low', 'Medium', 'Medium-High', 'High', 'Turbo', 'Quiet']
2025-01-10 02:49:01.808 INFO (MainThread) [custom_components.gree.climate] swing_modes(): ['Default', 'Swing in full range', 'Fixed in the upmost position', 'Fixed in the middle-up position', 'Fixed in the middle position', 'Fixed in the middle-low position', 'Fixed in the lowest position', 'Swing in the downmost region', 'Swing in the middle-low region', 'Swing in the middle region', 'Swing in the middle-up region', 'Swing in the upmost region']
2025-01-10 02:49:01.808 INFO (MainThread) [custom_components.gree.climate] available(): Device is offline
2025-01-10 02:49:01.809 INFO (MainThread) [custom_components.gree.climate] name(): 主卧空调
2025-01-10 02:49:01.809 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:49:01.823 INFO (MainThread) [custom_components.gree.climate] Setting up Gree climate platform
2025-01-10 02:49:01.824 INFO (MainThread) [custom_components.gree.climate] Adding Gree climate device to hass
2025-01-10 02:49:01.824 INFO (MainThread) [custom_components.gree.climate] Initialize the GREE climate device
2025-01-10 02:49:01.824 INFO (MainThread) [custom_components.gree.climate] name(): 次卧空调
2025-01-10 02:49:01.825 INFO (MainThread) [custom_components.gree.climate] name(): 次卧空调
2025-01-10 02:49:01.825 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:49:01.825 INFO (MainThread) [custom_components.gree.climate] temperature_unit(): °C
2025-01-10 02:49:01.826 INFO (MainThread) [custom_components.gree.climate] hvac_modes(): [<HVACMode.AUTO: 'auto'>, <HVACMode.COOL: 'cool'>, <HVACMode.DRY: 'dry'>, <HVACMode.FAN_ONLY: 'fan_only'>, <HVACMode.HEAT: 'heat'>, <HVACMode.OFF: 'off'>]
2025-01-10 02:49:01.826 INFO (MainThread) [custom_components.gree.climate] min_temp(): 16
2025-01-10 02:49:01.826 INFO (MainThread) [custom_components.gree.climate] max_temp(): 30
2025-01-10 02:49:01.826 INFO (MainThread) [custom_components.gree.climate] target_temperature_step(): 1.0
2025-01-10 02:49:01.826 INFO (MainThread) [custom_components.gree.climate] fan_list(): ['Auto', 'Low', 'Medium-Low', 'Medium', 'Medium-High', 'High', 'Turbo', 'Quiet']
2025-01-10 02:49:01.826 INFO (MainThread) [custom_components.gree.climate] swing_modes(): ['Default', 'Swing in full range', 'Fixed in the upmost position', 'Fixed in the middle-up position', 'Fixed in the middle position', 'Fixed in the middle-low position', 'Fixed in the lowest position', 'Swing in the downmost region', 'Swing in the middle-low region', 'Swing in the middle region', 'Swing in the middle-up region', 'Swing in the upmost region']
2025-01-10 02:49:01.827 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:49:01.827 INFO (MainThread) [custom_components.gree.climate] Gree climate device added to hass()
2025-01-10 02:49:01.827 INFO (MainThread) [custom_components.gree.climate] update()
2025-01-10 02:49:01.827 INFO (MainThread) [custom_components.gree.climate] Retrieving HVAC encryption key
2025-01-10 02:49:01.833 INFO (MainThread) [custom_components.gree.climate] Fetching(192.168.0.6, 7000, 10, {"cid": "app","i": 1,"pack": "Jtod3XIt89Lqss6DOHEUVp4gu9sAzgfkbQU3H+DJn/zDIm9XjABvK9ut9aCGHseEwf35XMKtIPQDq97Iev6J","t":"pack","tcid":"9424b8aa1a38","uid": 0, "tag" : "Ig+O04Cjn1qxAFjUINsBrg=="})
2025-01-10 02:49:11.844 INFO (MainThread) [custom_components.gree.climate] Error getting device encryption key!
2025-01-10 02:49:11.847 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:49:11.847 INFO (MainThread) [custom_components.gree.climate] temperature_unit(): °C
2025-01-10 02:49:11.848 INFO (MainThread) [custom_components.gree.climate] hvac_modes(): [<HVACMode.AUTO: 'auto'>, <HVACMode.COOL: 'cool'>, <HVACMode.DRY: 'dry'>, <HVACMode.FAN_ONLY: 'fan_only'>, <HVACMode.HEAT: 'heat'>, <HVACMode.OFF: 'off'>]
2025-01-10 02:49:11.848 INFO (MainThread) [custom_components.gree.climate] min_temp(): 16
2025-01-10 02:49:11.848 INFO (MainThread) [custom_components.gree.climate] max_temp(): 30
2025-01-10 02:49:11.849 INFO (MainThread) [custom_components.gree.climate] target_temperature_step(): 1.0
2025-01-10 02:49:11.849 INFO (MainThread) [custom_components.gree.climate] fan_list(): ['Auto', 'Low', 'Medium-Low', 'Medium', 'Medium-High', 'High', 'Turbo', 'Quiet']
2025-01-10 02:49:11.849 INFO (MainThread) [custom_components.gree.climate] swing_modes(): ['Default', 'Swing in full range', 'Fixed in the upmost position', 'Fixed in the middle-up position', 'Fixed in the middle position', 'Fixed in the middle-low position', 'Fixed in the lowest position', 'Swing in the downmost region', 'Swing in the middle-low region', 'Swing in the middle region', 'Swing in the middle-up region', 'Swing in the upmost region']
2025-01-10 02:49:11.850 INFO (MainThread) [custom_components.gree.climate] available(): Device is offline
2025-01-10 02:49:11.850 INFO (MainThread) [custom_components.gree.climate] name(): 次卧空调
2025-01-10 02:49:11.850 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:49:51.781 INFO (MainThread) [custom_components.gree.climate] should_poll()
2025-01-10 02:49:51.783 INFO (SyncWorker_3) [custom_components.gree.climate] update()
2025-01-10 02:49:51.784 INFO (SyncWorker_3) [custom_components.gree.climate] Retrieving HVAC encryption key
2025-01-10 02:49:51.792 INFO (SyncWorker_3) [custom_components.gree.climate] Fetching(192.168.0.7, 7000, 10, {"cid": "app","i": 1,"pack": "Jtod3XIt89Lqss6DOHEWBZp1vYcAzgfkbQU3H+DJn/zDIm9XjlNrft3x9aCGHseEwf35XMKtIPQDq97Iev6J","t":"pack","tcid":"9424b8c2545d","uid": 0, "tag" : "Sou3N51DfdQbAyf3RGcrMQ=="})
2025-01-10 02:50:01.802 INFO (SyncWorker_3) [custom_components.gree.climate] Error getting device encryption key!
2025-01-10 02:50:01.805 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:50:01.806 INFO (MainThread) [custom_components.gree.climate] temperature_unit(): °C
2025-01-10 02:50:01.806 INFO (MainThread) [custom_components.gree.climate] hvac_modes(): [<HVACMode.AUTO: 'auto'>, <HVACMode.COOL: 'cool'>, <HVACMode.DRY: 'dry'>, <HVACMode.FAN_ONLY: 'fan_only'>, <HVACMode.HEAT: 'heat'>, <HVACMode.OFF: 'off'>]
2025-01-10 02:50:01.807 INFO (MainThread) [custom_components.gree.climate] min_temp(): 16
2025-01-10 02:50:01.807 INFO (MainThread) [custom_components.gree.climate] max_temp(): 30
2025-01-10 02:50:01.807 INFO (MainThread) [custom_components.gree.climate] target_temperature_step(): 1.0
2025-01-10 02:50:01.807 INFO (MainThread) [custom_components.gree.climate] fan_list(): ['Auto', 'Low', 'Medium-Low', 'Medium', 'Medium-High', 'High', 'Turbo', 'Quiet']
2025-01-10 02:50:01.808 INFO (MainThread) [custom_components.gree.climate] swing_modes(): ['Default', 'Swing in full range', 'Fixed in the upmost position', 'Fixed in the middle-up position', 'Fixed in the middle position', 'Fixed in the middle-low position', 'Fixed in the lowest position', 'Swing in the downmost region', 'Swing in the middle-low region', 'Swing in the middle region', 'Swing in the middle-up region', 'Swing in the upmost region']
2025-01-10 02:50:01.808 INFO (MainThread) [custom_components.gree.climate] available(): Device is offline
2025-01-10 02:50:01.808 INFO (MainThread) [custom_components.gree.climate] name(): 客厅空调
2025-01-10 02:50:01.808 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:50:01.809 INFO (MainThread) [custom_components.gree.climate] should_poll()
2025-01-10 02:50:01.810 INFO (SyncWorker_2) [custom_components.gree.climate] update()
2025-01-10 02:50:01.810 INFO (SyncWorker_2) [custom_components.gree.climate] Retrieving HVAC encryption key
2025-01-10 02:50:01.817 INFO (SyncWorker_2) [custom_components.gree.climate] Fetching(192.168.0.5, 7000, 10, {"cid": "app","i": 1,"pack": "Jtod3XIt89Lqss6DOHEWBZp37dIAzgfkbQU3H+DJn/zDIm9XjlNrfI2k9aCGHseEwf35XMKtIPQDq97Iev6J","t":"pack","tcid":"9424b8c256e1","uid": 0, "tag" : "37SN26TCSrVzi7SbxD9SbA=="})
2025-01-10 02:50:11.829 INFO (SyncWorker_2) [custom_components.gree.climate] Error getting device encryption key!
2025-01-10 02:50:11.833 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:50:11.833 INFO (MainThread) [custom_components.gree.climate] temperature_unit(): °C
2025-01-10 02:50:11.834 INFO (MainThread) [custom_components.gree.climate] hvac_modes(): [<HVACMode.AUTO: 'auto'>, <HVACMode.COOL: 'cool'>, <HVACMode.DRY: 'dry'>, <HVACMode.FAN_ONLY: 'fan_only'>, <HVACMode.HEAT: 'heat'>, <HVACMode.OFF: 'off'>]
2025-01-10 02:50:11.834 INFO (MainThread) [custom_components.gree.climate] min_temp(): 16
2025-01-10 02:50:11.834 INFO (MainThread) [custom_components.gree.climate] max_temp(): 30
2025-01-10 02:50:11.834 INFO (MainThread) [custom_components.gree.climate] target_temperature_step(): 1.0
2025-01-10 02:50:11.835 INFO (MainThread) [custom_components.gree.climate] fan_list(): ['Auto', 'Low', 'Medium-Low', 'Medium', 'Medium-High', 'High', 'Turbo', 'Quiet']
2025-01-10 02:50:11.835 INFO (MainThread) [custom_components.gree.climate] swing_modes(): ['Default', 'Swing in full range', 'Fixed in the upmost position', 'Fixed in the middle-up position', 'Fixed in the middle position', 'Fixed in the middle-low position', 'Fixed in the lowest position', 'Swing in the downmost region', 'Swing in the middle-low region', 'Swing in the middle region', 'Swing in the middle-up region', 'Swing in the upmost region']
2025-01-10 02:50:11.835 INFO (MainThread) [custom_components.gree.climate] available(): Device is offline
2025-01-10 02:50:11.835 INFO (MainThread) [custom_components.gree.climate] name(): 主卧空调
2025-01-10 02:50:11.836 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:50:11.836 INFO (MainThread) [custom_components.gree.climate] should_poll()
2025-01-10 02:50:11.838 INFO (SyncWorker_5) [custom_components.gree.climate] update()
2025-01-10 02:50:11.839 INFO (SyncWorker_5) [custom_components.gree.climate] Retrieving HVAC encryption key
2025-01-10 02:50:11.846 INFO (SyncWorker_5) [custom_components.gree.climate] Fetching(192.168.0.6, 7000, 10, {"cid": "app","i": 1,"pack": "Jtod3XIt89Lqss6DOHEUVp4gu9sAzgfkbQU3H+DJn/zDIm9XjABvK9ut9aCGHseEwf35XMKtIPQDq97Iev6J","t":"pack","tcid":"9424b8aa1a38","uid": 0, "tag" : "Ig+O04Cjn1qxAFjUINsBrg=="})
2025-01-10 02:50:21.859 INFO (SyncWorker_5) [custom_components.gree.climate] Error getting device encryption key!
2025-01-10 02:50:21.862 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:50:21.863 INFO (MainThread) [custom_components.gree.climate] temperature_unit(): °C
2025-01-10 02:50:21.863 INFO (MainThread) [custom_components.gree.climate] hvac_modes(): [<HVACMode.AUTO: 'auto'>, <HVACMode.COOL: 'cool'>, <HVACMode.DRY: 'dry'>, <HVACMode.FAN_ONLY: 'fan_only'>, <HVACMode.HEAT: 'heat'>, <HVACMode.OFF: 'off'>]
2025-01-10 02:50:21.863 INFO (MainThread) [custom_components.gree.climate] min_temp(): 16
2025-01-10 02:50:21.864 INFO (MainThread) [custom_components.gree.climate] max_temp(): 30
2025-01-10 02:50:21.864 INFO (MainThread) [custom_components.gree.climate] target_temperature_step(): 1.0
2025-01-10 02:50:21.864 INFO (MainThread) [custom_components.gree.climate] fan_list(): ['Auto', 'Low', 'Medium-Low', 'Medium', 'Medium-High', 'High', 'Turbo', 'Quiet']
2025-01-10 02:50:21.865 INFO (MainThread) [custom_components.gree.climate] swing_modes(): ['Default', 'Swing in full range', 'Fixed in the upmost position', 'Fixed in the middle-up position', 'Fixed in the middle position', 'Fixed in the middle-low position', 'Fixed in the lowest position', 'Swing in the downmost region', 'Swing in the middle-low region', 'Swing in the middle region', 'Swing in the middle-up region', 'Swing in the upmost region']
2025-01-10 02:50:21.865 INFO (MainThread) [custom_components.gree.climate] available(): Device is offline
2025-01-10 02:50:21.865 INFO (MainThread) [custom_components.gree.climate] name(): 次卧空调
2025-01-10 02:50:21.865 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:50:51.782 INFO (MainThread) [custom_components.gree.climate] should_poll()
2025-01-10 02:50:51.784 INFO (SyncWorker_2) [custom_components.gree.climate] update()
2025-01-10 02:50:51.785 INFO (SyncWorker_2) [custom_components.gree.climate] Retrieving HVAC encryption key
2025-01-10 02:50:51.792 INFO (SyncWorker_2) [custom_components.gree.climate] Fetching(192.168.0.7, 7000, 10, {"cid": "app","i": 1,"pack": "Jtod3XIt89Lqss6DOHEWBZp1vYcAzgfkbQU3H+DJn/zDIm9XjlNrft3x9aCGHseEwf35XMKtIPQDq97Iev6J","t":"pack","tcid":"9424b8c2545d","uid": 0, "tag" : "Sou3N51DfdQbAyf3RGcrMQ=="})
2025-01-10 02:51:01.803 INFO (SyncWorker_2) [custom_components.gree.climate] Error getting device encryption key!
2025-01-10 02:51:01.807 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:51:01.807 INFO (MainThread) [custom_components.gree.climate] temperature_unit(): °C
2025-01-10 02:51:01.807 INFO (MainThread) [custom_components.gree.climate] hvac_modes(): [<HVACMode.AUTO: 'auto'>, <HVACMode.COOL: 'cool'>, <HVACMode.DRY: 'dry'>, <HVACMode.FAN_ONLY: 'fan_only'>, <HVACMode.HEAT: 'heat'>, <HVACMode.OFF: 'off'>]
2025-01-10 02:51:01.808 INFO (MainThread) [custom_components.gree.climate] min_temp(): 16
2025-01-10 02:51:01.808 INFO (MainThread) [custom_components.gree.climate] max_temp(): 30
2025-01-10 02:51:01.808 INFO (MainThread) [custom_components.gree.climate] target_temperature_step(): 1.0
2025-01-10 02:51:01.808 INFO (MainThread) [custom_components.gree.climate] fan_list(): ['Auto', 'Low', 'Medium-Low', 'Medium', 'Medium-High', 'High', 'Turbo', 'Quiet']
2025-01-10 02:51:01.809 INFO (MainThread) [custom_components.gree.climate] swing_modes(): ['Default', 'Swing in full range', 'Fixed in the upmost position', 'Fixed in the middle-up position', 'Fixed in the middle position', 'Fixed in the middle-low position', 'Fixed in the lowest position', 'Swing in the downmost region', 'Swing in the middle-low region', 'Swing in the middle region', 'Swing in the middle-up region', 'Swing in the upmost region']
2025-01-10 02:51:01.809 INFO (MainThread) [custom_components.gree.climate] available(): Device is offline
2025-01-10 02:51:01.809 INFO (MainThread) [custom_components.gree.climate] name(): 客厅空调
2025-01-10 02:51:01.810 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:51:01.810 INFO (MainThread) [custom_components.gree.climate] should_poll()
2025-01-10 02:51:01.812 INFO (SyncWorker_1) [custom_components.gree.climate] update()
2025-01-10 02:51:01.812 INFO (SyncWorker_1) [custom_components.gree.climate] Retrieving HVAC encryption key
2025-01-10 02:51:01.819 INFO (SyncWorker_1) [custom_components.gree.climate] Fetching(192.168.0.5, 7000, 10, {"cid": "app","i": 1,"pack": "Jtod3XIt89Lqss6DOHEWBZp37dIAzgfkbQU3H+DJn/zDIm9XjlNrfI2k9aCGHseEwf35XMKtIPQDq97Iev6J","t":"pack","tcid":"9424b8c256e1","uid": 0, "tag" : "37SN26TCSrVzi7SbxD9SbA=="})
2025-01-10 02:51:11.822 INFO (SyncWorker_1) [custom_components.gree.climate] Error getting device encryption key!
2025-01-10 02:51:11.825 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:51:11.826 INFO (MainThread) [custom_components.gree.climate] temperature_unit(): °C
2025-01-10 02:51:11.826 INFO (MainThread) [custom_components.gree.climate] hvac_modes(): [<HVACMode.AUTO: 'auto'>, <HVACMode.COOL: 'cool'>, <HVACMode.DRY: 'dry'>, <HVACMode.FAN_ONLY: 'fan_only'>, <HVACMode.HEAT: 'heat'>, <HVACMode.OFF: 'off'>]
2025-01-10 02:51:11.826 INFO (MainThread) [custom_components.gree.climate] min_temp(): 16
2025-01-10 02:51:11.827 INFO (MainThread) [custom_components.gree.climate] max_temp(): 30
2025-01-10 02:51:11.827 INFO (MainThread) [custom_components.gree.climate] target_temperature_step(): 1.0
2025-01-10 02:51:11.827 INFO (MainThread) [custom_components.gree.climate] fan_list(): ['Auto', 'Low', 'Medium-Low', 'Medium', 'Medium-High', 'High', 'Turbo', 'Quiet']
2025-01-10 02:51:11.827 INFO (MainThread) [custom_components.gree.climate] swing_modes(): ['Default', 'Swing in full range', 'Fixed in the upmost position', 'Fixed in the middle-up position', 'Fixed in the middle position', 'Fixed in the middle-low position', 'Fixed in the lowest position', 'Swing in the downmost region', 'Swing in the middle-low region', 'Swing in the middle region', 'Swing in the middle-up region', 'Swing in the upmost region']
2025-01-10 02:51:11.828 INFO (MainThread) [custom_components.gree.climate] available(): Device is offline
2025-01-10 02:51:11.828 INFO (MainThread) [custom_components.gree.climate] name(): 主卧空调
2025-01-10 02:51:11.828 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:51:11.828 INFO (MainThread) [custom_components.gree.climate] should_poll()
2025-01-10 02:51:11.830 INFO (SyncWorker_5) [custom_components.gree.climate] update()
2025-01-10 02:51:11.831 INFO (SyncWorker_5) [custom_components.gree.climate] Retrieving HVAC encryption key
2025-01-10 02:51:11.835 INFO (SyncWorker_5) [custom_components.gree.climate] Fetching(192.168.0.6, 7000, 10, {"cid": "app","i": 1,"pack": "Jtod3XIt89Lqss6DOHEUVp4gu9sAzgfkbQU3H+DJn/zDIm9XjABvK9ut9aCGHseEwf35XMKtIPQDq97Iev6J","t":"pack","tcid":"9424b8aa1a38","uid": 0, "tag" : "Ig+O04Cjn1qxAFjUINsBrg=="})
2025-01-10 02:51:21.848 INFO (SyncWorker_5) [custom_components.gree.climate] Error getting device encryption key!
2025-01-10 02:51:21.852 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:51:21.852 INFO (MainThread) [custom_components.gree.climate] temperature_unit(): °C
2025-01-10 02:51:21.853 INFO (MainThread) [custom_components.gree.climate] hvac_modes(): [<HVACMode.AUTO: 'auto'>, <HVACMode.COOL: 'cool'>, <HVACMode.DRY: 'dry'>, <HVACMode.FAN_ONLY: 'fan_only'>, <HVACMode.HEAT: 'heat'>, <HVACMode.OFF: 'off'>]
2025-01-10 02:51:21.853 INFO (MainThread) [custom_components.gree.climate] min_temp(): 16
2025-01-10 02:51:21.853 INFO (MainThread) [custom_components.gree.climate] max_temp(): 30
2025-01-10 02:51:21.854 INFO (MainThread) [custom_components.gree.climate] target_temperature_step(): 1.0
2025-01-10 02:51:21.854 INFO (MainThread) [custom_components.gree.climate] fan_list(): ['Auto', 'Low', 'Medium-Low', 'Medium', 'Medium-High', 'High', 'Turbo', 'Quiet']
2025-01-10 02:51:21.854 INFO (MainThread) [custom_components.gree.climate] swing_modes(): ['Default', 'Swing in full range', 'Fixed in the upmost position', 'Fixed in the middle-up position', 'Fixed in the middle position', 'Fixed in the middle-low position', 'Fixed in the lowest position', 'Swing in the downmost region', 'Swing in the middle-low region', 'Swing in the middle region', 'Swing in the middle-up region', 'Swing in the upmost region']
2025-01-10 02:51:21.854 INFO (MainThread) [custom_components.gree.climate] available(): Device is offline
2025-01-10 02:51:21.855 INFO (MainThread) [custom_components.gree.climate] name(): 次卧空调
2025-01-10 02:51:21.855 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:51:51.785 INFO (MainThread) [custom_components.gree.climate] should_poll()
2025-01-10 02:51:51.787 INFO (SyncWorker_2) [custom_components.gree.climate] update()
2025-01-10 02:51:51.787 INFO (SyncWorker_2) [custom_components.gree.climate] Retrieving HVAC encryption key
2025-01-10 02:51:51.794 INFO (SyncWorker_2) [custom_components.gree.climate] Fetching(192.168.0.7, 7000, 10, {"cid": "app","i": 1,"pack": "Jtod3XIt89Lqss6DOHEWBZp1vYcAzgfkbQU3H+DJn/zDIm9XjlNrft3x9aCGHseEwf35XMKtIPQDq97Iev6J","t":"pack","tcid":"9424b8c2545d","uid": 0, "tag" : "Sou3N51DfdQbAyf3RGcrMQ=="})
2025-01-10 02:52:01.806 INFO (SyncWorker_2) [custom_components.gree.climate] Error getting device encryption key!
2025-01-10 02:52:01.809 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:52:01.810 INFO (MainThread) [custom_components.gree.climate] temperature_unit(): °C
2025-01-10 02:52:01.811 INFO (MainThread) [custom_components.gree.climate] hvac_modes(): [<HVACMode.AUTO: 'auto'>, <HVACMode.COOL: 'cool'>, <HVACMode.DRY: 'dry'>, <HVACMode.FAN_ONLY: 'fan_only'>, <HVACMode.HEAT: 'heat'>, <HVACMode.OFF: 'off'>]
2025-01-10 02:52:01.811 INFO (MainThread) [custom_components.gree.climate] min_temp(): 16
2025-01-10 02:52:01.811 INFO (MainThread) [custom_components.gree.climate] max_temp(): 30
2025-01-10 02:52:01.811 INFO (MainThread) [custom_components.gree.climate] target_temperature_step(): 1.0
2025-01-10 02:52:01.812 INFO (MainThread) [custom_components.gree.climate] fan_list(): ['Auto', 'Low', 'Medium-Low', 'Medium', 'Medium-High', 'High', 'Turbo', 'Quiet']
2025-01-10 02:52:01.812 INFO (MainThread) [custom_components.gree.climate] swing_modes(): ['Default', 'Swing in full range', 'Fixed in the upmost position', 'Fixed in the middle-up position', 'Fixed in the middle position', 'Fixed in the middle-low position', 'Fixed in the lowest position', 'Swing in the downmost region', 'Swing in the middle-low region', 'Swing in the middle region', 'Swing in the middle-up region', 'Swing in the upmost region']
2025-01-10 02:52:01.812 INFO (MainThread) [custom_components.gree.climate] available(): Device is offline
2025-01-10 02:52:01.812 INFO (MainThread) [custom_components.gree.climate] name(): 客厅空调
2025-01-10 02:52:01.813 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2025-01-10 02:52:01.813 INFO (MainThread) [custom_components.gree.climate] should_poll()
2025-01-10 02:52:01.815 INFO (SyncWorker_1) [custom_components.gree.climate] update()
2025-01-10 02:52:01.815 INFO (SyncWorker_1) [custom_components.gree.climate] Retrieving HVAC encryption key
2025-01-10 02:52:01.822 INFO (SyncWorker_1) [custom_components.gree.climate] Fetching(192.168.0.5, 7000, 10, {"cid": "app","i": 1,"pack": "Jtod3XIt89Lqss6DOHEWBZp37dIAzgfkbQU3H+DJn/zDIm9XjlNrfI2k9aCGHseEwf35XMKtIPQDq97Iev6J","t":"pack","tcid":"9424b8c256e1","uid": 0, "tag" : "37SN26TCSrVzi7SbxD9SbA=="})

回复

使用道具 举报

1

主题

23

帖子

107

积分

注册会员

Rank: 2

积分
107
金钱
84
HASS币
0
 楼主| 发表于 2025-1-11 14:26:45 | 显示全部楼层
求教各位大神,另外我的HA是装在电视盒子上的!
回复

使用道具 举报

1

主题

24

帖子

143

积分

注册会员

Rank: 2

积分
143
金钱
119
HASS币
10
发表于 2025-1-11 16:57:20 | 显示全部楼层
我是装了两个插件,一个官方的插件可以控制冷静王,还有一个centralclimate的需要在confgration yaml中设置一个假服务器可以控制风管机
回复

使用道具 举报

1

主题

23

帖子

107

积分

注册会员

Rank: 2

积分
107
金钱
84
HASS币
0
 楼主| 发表于 2025-1-11 18:11:14 | 显示全部楼层
extations 发表于 2025-1-11 16:57
我是装了两个插件,一个官方的插件可以控制冷静王,还有一个centralclimate的需要在confgration yaml中设置 ...

方便指导一下不?格力风管机搞了3天了,还是不行!
回复

使用道具 举报

1

主题

24

帖子

143

积分

注册会员

Rank: 2

积分
143
金钱
119
HASS币
10
发表于 2025-1-11 19:21:40 | 显示全部楼层
Doctor666 发表于 2025-1-11 18:11
方便指导一下不?格力风管机搞了3天了,还是不行!

/homeassistant/custom_components/gree2/device.py

import logging
import asyncio

from homeassistant.core import Event, EventStateChangedData, callback
from homeassistant.components.climate import ClimateEntity
from homeassistant.helpers.event import async_track_state_change_event

from homeassistant.components.climate.const import (
    HVACMode, ClimateEntityFeature,
    FAN_AUTO, FAN_LOW, FAN_MIDDLE, FAN_HIGH,
    PRESET_NONE, PRESET_SLEEP)

from homeassistant.const import (
    ATTR_UNIT_OF_MEASUREMENT, ATTR_TEMPERATURE, CONF_SCAN_INTERVAL,
    CONF_NAME, CONF_HOST, CONF_PORT, CONF_MAC, CONF_TIMEOUT, CONF_CUSTOMIZE,
    STATE_ON, STATE_OFF, STATE_UNKNOWN,
    UnitOfTemperature, PRECISION_WHOLE, PRECISION_TENTHS)

import logging
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
    HVACMode, ClimateEntityFeature,
    FAN_AUTO, FAN_LOW, FAN_MIDDLE, FAN_HIGH,
    PRESET_NONE, PRESET_SLEEP)
from homeassistant.const import (
    ATTR_TEMPERATURE, CONF_NAME, CONF_HOST, CONF_MAC, UnitOfTemperature)

_LOGGER = logging.getLogger(__name__)

# 固定值
MIN_TEMP = 16
MAX_TEMP = 30
HVAC_MODES = [HVACMode.AUTO, HVACMode.COOL, HVACMode.DRY,
              HVACMode.FAN_ONLY, HVACMode.HEAT, HVACMode.OFF]
FAN_MODES = [FAN_AUTO, FAN_LOW, 'medium-low',
             FAN_MIDDLE, 'medium-high', FAN_HIGH]
PRESET_MODES = [PRESET_NONE, PRESET_SLEEP]
SUPPORT_FLAGS = ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE | ClimateEntityFeature.PRESET_MODE | ClimateEntityFeature.TURN_OFF | ClimateEntityFeature.TURN_ON

class Gree2Climate(ClimateEntity):
    def __init__(self, hass, name, mac, bridge, temp_sensor=None, temp_step=1):
        """Initialize the Gree climate device."""
        self.hass = hass
        self.mac = mac
        self._unique_id = f'com.gree2.{mac}'
        self.entity_id = f"climate.gree_{mac.replace(':', '')}"  # 显式设置entity_id
        self._available = False
        self._name = name
        self._bridge = bridge
        self._unit_of_measurement = UnitOfTemperature.CELSIUS
        self._target_temperature = 26
        self._current_temperature = 26
        self._target_temperature_step = temp_step
        self._hvac_mode = HVACMode.OFF
        self._fan_mode = FAN_AUTO
        self._preset_mode = PRESET_NONE
        self._hvac_modes = HVAC_MODES
        self._fan_modes = FAN_MODES
        self._preset_modes = PRESET_MODES
        self._temp_sensor = temp_sensor
        self._acOptions = {
            'Pow': 0,
            'Mod': str(self._hvac_mode.index(HVACMode.OFF)),
            'WdSpd': 0,
            'SetTem': 26,
            'SwhSlp': 0,
        }

        if temp_sensor:
            async_track_state_change_event(
                hass, temp_sensor, self._async_temp_sensor_changed)
            temp_state = hass.states.get(temp_sensor)
            if temp_state:
                self._async_update_current_temp(temp_state)

    @property
    def should_poll(self):
        # Return the polling state.
        return False

    @property
    def unique_id(self) -> str:
        # Return a unique ID.
        return self._unique_id

    @property
    def available(self):
        # Return available of the climate device.
        return self._available

    @property
    def hidden(self):
        # Return hidden of the climate device.
        return not self._available

    @property
    def name(self):
        # Return the name of the climate device.
        return self._name

    @property
    def temperature_unit(self):
        # Return the unit of measurement.
        return self._unit_of_measurement

    @property
    def current_temperature(self):
        # Return the current temperature.
        return self._current_temperature

    @property
    def target_temperature(self):
        # Return the temperature we try to reach.
        return self._target_temperature

    @property
    def target_temperature_step(self):
        # Return the supported step of target temperature.
        return self._target_temperature_step

    @property
    def min_temp(self):
        # Return the minimum temperature.
        return MIN_TEMP

    @property
    def max_temp(self):
        # Return the maximum temperature.
        return MAX_TEMP

    @property
    def hvac_mode(self):
        # Return current operation mode ie. heat, cool, idle.
        return self._hvac_mode

    @property
    def hvac_modes(self):
        # Return the list of available operation modes.
        return self._hvac_modes

    @property
    def fan_mode(self):
        # Return the fan mode.
        return self._fan_mode

    @property
    def fan_modes(self):
        # Return the list of available fan modes.
        return self._fan_modes

    @property
    def preset_mode(self):
        # Return the preset mode.
        if self._acOptions['SwhSlp'] != 0:
            return PRESET_SLEEP
        return PRESET_NONE

    @property
    def preset_modes(self):
        # Return the list of available preset modes.
        return self._preset_modes

    @property
    def supported_features(self):
        # Return the list of supported features.
        return SUPPORT_FLAGS

    def turn_on(self):
        _LOGGER.info('turn_on(): ')
        # Turn on.
        self.syncState({'Pow': 1})

    def turn_off(self):
        _LOGGER.info('turn_off(): ')
        # Turn on.
        self.syncState({'Pow': 0})

    def set_temperature(self, **kwargs):
        _LOGGER.info('set_temperature(): ' + str(kwargs.get(ATTR_TEMPERATURE)))
        # Set new target temperatures.
        if kwargs.get(ATTR_TEMPERATURE) is not None:
            # do nothing if temperature is none
            if not (self._acOptions['Pow'] == 0):
                # do nothing if HVAC is switched off
                _LOGGER.info('syncState with SetTem=' +
                             str(kwargs.get(ATTR_TEMPERATURE)))
                tem, decimal = str(kwargs.get(ATTR_TEMPERATURE)).split('.')
                self.syncState({'SetTem': int(tem), 'Add0.1': int(decimal)})

    def set_fan_mode(self, fan):
        _LOGGER.info('set_fan_mode(): ' + str(fan))
        # Set the fan mode.
        if not (self._acOptions['Pow'] == 0):
            _LOGGER.info('Setting normal fan mode to ' +
                         str(self._fan_modes.index(fan)))
            self.syncState({'WdSpd': str(self._fan_modes.index(fan))})

    def set_hvac_mode(self, hvac_mode):
        _LOGGER.info('set_hvac_mode(): ' + str(hvac_mode))
        # Set new operation mode.
        if (hvac_mode == HVACMode.OFF):
            self.syncState({'Pow': 0})
        else:
            self.syncState(
                {'Mod': self._hvac_modes.index(hvac_mode), 'Pow': 1})

    def set_preset_mode(self, preset_mode):
        _LOGGER.info('set_preset_mode(): ' + str(preset_mode))
        # Set the fan mode.
        if self._acOptions['Pow'] == 0:
            return

        if preset_mode == PRESET_SLEEP:
            _LOGGER.info('Setting SwhSlp mode to 1')
            self.syncState({'SwhSlp': 1, 'Quiet': 1})
            return

        self.syncState({'SwhSlp': 0, 'Quiet': 0})

    async def async_added_to_hass(self):
        _LOGGER.info('Gree climate device added to hass()')
        await super().async_added_to_hass()  # 调用父类方法
        self.syncStatus()

    def syncStatus(self, now=None):
        cmds = ['Pow', 'Mod', 'SetTem', 'WdSpd', 'Air', 'Blo',
                'Health', 'SwhSlp', 'SwingLfRig', 'Quiet', 'SvSt', 'Add0.1']
        message = {
            'cols': cmds,
            'mac': self.mac,
            't': 'status'
        }
        self._bridge.sync_status(message)

    def dealStatusPack(self, statusPack):
        if statusPack is not None:
            self._available = True
            for i, val in enumerate(statusPack['cols']):
                self._acOptions[val] = statusPack['dat']
            _LOGGER.info('Climate {} status: {}'.format(
                self._name, self._acOptions))
            self.UpdateHAStateToCurrentACState()
            self.schedule_update_ha_state()

    def dealResPack(self, resPack):
        if resPack is not None:
            for i, val in enumerate(resPack['opt']):
                self._acOptions[val] = resPack['val']
            self.UpdateHAStateToCurrentACState()
            self.schedule_update_ha_state()

    def syncState(self, options):
        commands = []
        values = []
        for cmd in options.keys():
            commands.append(cmd)
            values.append(int(options[cmd]))
        message = {
            'opt': commands,
            'p': values,
            't': 'cmd',
            'sub': self.mac
        }
        self._bridge.sync_status(message)

    def UpdateHATargetTemperature(self):
        # Sync set temperature to HA
        tem = int(self._acOptions['SetTem'])
        if 'Add0.1' in self._acOptions:
            decimal = self._acOptions['Add0.1']
            if decimal:
                tem = tem + int(decimal) * 0.1
        self._target_temperature = tem
        _LOGGER.info('{} HA target temp set according to HVAC state to: {}'.format(
            self._name, str(tem)))

    def UpdateHAHvacMode(self):
        # Sync current HVAC operation mode to HA
        if (self._acOptions['Pow'] == 0):
            self._hvac_mode = HVACMode.OFF
        else:
            self._hvac_mode = self._hvac_modes[self._acOptions['Mod']]
        _LOGGER.info('{} HA operation mode set according to HVAC state to: {}'.format(
            self._name, str(self._hvac_mode)))

    def UpdateHAFanMode(self):
        # Sync current HVAC Fan mode state to HA
        index = int(self._acOptions['WdSpd'])
        if index < len(self._fan_modes):
            self._fan_mode = self._fan_modes[int(self._acOptions['WdSpd'])]
            _LOGGER.info('{} HA fan mode set according to HVAC state to: {}'.format(
                self._name, str(self._fan_mode)))
        else:
            _LOGGER.info('{} HA fan mode set WdSpd to: {}'.format(
                self._name, str(self._acOptions['WdSpd'])))

    def UpdateHAStateToCurrentACState(self):
        self.UpdateHATargetTemperature()
        self.UpdateHAHvacMode()
        self.UpdateHAFanMode()

    @callback
    def _async_update_current_temp(self, state):
        try:
            float(state.state)
            pass
        except ValueError:
            return
        """Update thermostat with latest state from sensor."""
        try:
            self._current_temperature = self.hass.config.units.temperature(
                float(state.state), self._unit_of_measurement)
        except ValueError as ex:
            _LOGGER.error('Unable to update from sensor: %s', ex)

    @callback
    def _async_temp_sensor_changed(self, event: Event[EventStateChangedData]):
        entity_id = event.data["entity_id"]
        old_state = event.data["old_state"]
        new_state = event.data["new_state"]
        _LOGGER.info('temp_sensor state changed |' + str(entity_id) +
                     '|' + str(old_state) + '|' + str(new_state))
        if new_state is None:
            return
        self._async_update_current_temp(new_state)
        self.schedule_update_ha_state()

async def async_setup_entry(hass, config_entry, async_add_entities):
    """Set up the Gree climate devices."""
    devices = config_entry.data.get("devices", [])
    bridge = config_entry.data.get("bridge")
    entities = []

    for device in devices:
        name = device.get(CONF_NAME)
        mac = device.get(CONF_MAC)
        temp_sensor = device.get("temp_sensor")
        temp_step = device.get("temp_step", 1)

        entity = Gree2Climate(hass, name, mac, bridge, temp_sensor, temp_step)
        entities.append(entity)

    async_add_entities(entities)

/homeassistant/configuration.yaml

        
climate:
  - platform: gree2
    host: 风管机ip 查一下路由器应该能找到
    scan_interval: 20
    temp_step: 0.5
    fake_server: 192.168.31.85

我记得是有啥报错复制给deepseek改了下gree2里的device.py
回复

使用道具 举报

1

主题

23

帖子

107

积分

注册会员

Rank: 2

积分
107
金钱
84
HASS币
0
 楼主| 发表于 2025-1-11 19:37:43 | 显示全部楼层
extations 发表于 2025-1-11 19:21
/homeassistant/custom_components/gree2/device.py

import logging

大神,我不是专业搞这个的,很尴尬看不懂,有没有具体的插件地址和说明文档,我学习一哈
回复

使用道具 举报

1

主题

23

帖子

107

积分

注册会员

Rank: 2

积分
107
金钱
84
HASS币
0
 楼主| 发表于 2025-1-11 19:41:59 | 显示全部楼层
extations 发表于 2025-1-11 19:21
/homeassistant/custom_components/gree2/device.py

import logging

我看了哈,你这个用的是Ha-GreeCentralClimate,这个插件,修改了原本的device.py文件内容,是这样吗?大神
回复

使用道具 举报

1

主题

24

帖子

143

积分

注册会员

Rank: 2

积分
143
金钱
119
HASS币
10
发表于 2025-1-11 21:16:04 | 显示全部楼层
Doctor666 发表于 2025-1-11 19:41
我看了哈,你这个用的是Ha-GreeCentralClimate,这个插件,修改了原本的device.py文件内容,是这样吗?大 ...

对的,印象里应该是的
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2025-2-3 00:03 , Processed in 0.059268 second(s), 33 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表