找回密码
 立即注册

微信扫码登录

搜索
楼主: elwin_chen

[插件集成] 威能网关接入HA

[复制链接]

2

主题

199

回帖

1365

积分

金牌会员

积分
1365
金钱
1164
HASS币
0
发表于 2025-8-16 15:15:32 | 显示全部楼层
rmyyzf 发表于 2025-8-15 19:43
出现同样的问题!威能家app 老是被踢!登录一会儿就要重新登录!!有解吗????? ...

该问题已经解决!!!蛮好的插件哦!!谢谢楼主!!!
回复

使用道具 举报

1

主题

19

回帖

251

积分

中级会员

积分
251
金钱
231
HASS币
0
发表于 2025-8-18 22:12:29 | 显示全部楼层
想咨询一下,burn_status的数值都代表什么意思呢?我的日志显示该sensor状态值在31、23、24、27之间切换。
回复

使用道具 举报

4

主题

98

回帖

983

积分

高级会员

积分
983
金钱
881
HASS币
0
发表于 2025-9-10 21:14:19 | 显示全部楼层
本帖最后由 kuoyeh 于 2025-9-10 21:23 编辑
rmyyzf 发表于 2025-8-15 17:19
搞定!!谢谢楼主!!!

我也搞定了,哈哈
回复

使用道具 举报

0

主题

5

回帖

53

积分

注册会员

积分
53
金钱
48
HASS币
0
发表于 2025-10-26 22:40:36 | 显示全部楼层
为什么我无法加载配置
回复

使用道具 举报

0

主题

3

回帖

51

积分

注册会员

积分
51
金钱
48
HASS币
0
发表于 2025-11-2 11:53:05 | 显示全部楼层
rmyyzf 发表于 2025-8-16 15:15
该问题已经解决!!!蛮好的插件哦!!谢谢楼主!!!

您好,想问一下最后是怎么解决威能家app掉线的问题的?
回复

使用道具 举报

2

主题

199

回帖

1365

积分

金牌会员

积分
1365
金钱
1164
HASS币
0
发表于 2025-11-2 15:25:17 | 显示全部楼层
QYDHS 发表于 2025-11-2 11:53
您好,想问一下最后是怎么解决威能家app掉线的问题的?

家人的手机号码注册一个威能的帐号,然后把你的威能的网关分享给家人的帐号,HA登录就用家人的帐号!!其实就是说APP登录的账号和HA的账号不能是同一个!!!
回复

使用道具 举报

0

主题

3

回帖

51

积分

注册会员

积分
51
金钱
48
HASS币
0
发表于 2025-11-2 21:00:27 | 显示全部楼层
rmyyzf 发表于 2025-11-2 15:25
家人的手机号码注册一个威能的帐号,然后把你的威能的网关分享给家人的帐号,HA登录就用家人的帐号!!其 ...

好的好的,万分感谢!
回复

使用道具 举报

0

主题

5

回帖

65

积分

注册会员

积分
65
金钱
60
HASS币
0
发表于 2025-11-4 18:51:10 来自手机 | 显示全部楼层
我咸鱼上买了个自制版,自己建模了个3d打印壳子,用AI转换了一个ha插件出来。终于解决了威能万年连不上的问题
回复

使用道具 举报

0

主题

7

回帖

99

积分

注册会员

积分
99
金钱
92
HASS币
0
发表于 2025-11-10 11:24:45 | 显示全部楼层
guxingtianya 发表于 2025-6-28 22:56
大佬,有现成的可以分享吗

替换sensor.py文件内容
"""Vaillant sensors."""
from __future__ import annotations

import logging
from typing import Any

from homeassistant.components.sensor import (
    SensorDeviceClass,
    SensorEntity,
    SensorEntityDescription,
    SensorStateClass,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from homeassistant.const import (
    UnitOfTemperature
)

from .client import VaillantClient
from .const import CONF_DID, DISPATCHERS, DOMAIN, EVT_DEVICE_CONNECTED, API_CLIENT
from .entity import VaillantEntity

_LOGGER = logging.getLogger(__name__)


SENSOR_DESCRIPTIONS = (

        SensorEntityDescription(
        key="water_pressure",
        name="供暖水压",
        device_class=SensorDeviceClass.PRESSURE,
        state_class=SensorStateClass.MEASUREMENT,
      native_unit_of_measurement="bar",
    ),
        SensorEntityDescription(
        key="indoor_temperature",
        name="室内温度",
        device_class=SensorDeviceClass.TEMPERATURE,
        state_class=SensorStateClass.MEASUREMENT,
      native_unit_of_measurement=UnitOfTemperature.CELSIUS,
    ),
    SensorEntityDescription(
        key="Tank_temperature",
        name="水箱温度",
        device_class=SensorDeviceClass.TEMPERATURE,
        state_class=SensorStateClass.MEASUREMENT,
      native_unit_of_measurement=UnitOfTemperature.CELSIUS,
    ),
    SensorEntityDescription(
        key="Outdoor_Temperature",
        name="室外温度",
        device_class=SensorDeviceClass.TEMPERATURE,
        state_class=SensorStateClass.MEASUREMENT,
      native_unit_of_measurement=UnitOfTemperature.CELSIUS,
    ),
    SensorEntityDescription(
        key="DHW_setpoint",
        name="生活热水设置温度",
        device_class=SensorDeviceClass.TEMPERATURE,
        state_class=SensorStateClass.MEASUREMENT,
      native_unit_of_measurement=UnitOfTemperature.CELSIUS,
    ),
    SensorEntityDescription(
        key="Lower_Limitation_of_CH_Setpoint",
        name="暖气最小设置温度",
        device_class=SensorDeviceClass.TEMPERATURE,
        state_class=SensorStateClass.MEASUREMENT,
      native_unit_of_measurement=UnitOfTemperature.CELSIUS,
    ),
    SensorEntityDescription(
        key="Upper_Limitation_of_CH_Setpoint",
        name="暖气最大设置温度",
        device_class=SensorDeviceClass.TEMPERATURE,
        state_class=SensorStateClass.MEASUREMENT,
      native_unit_of_measurement=UnitOfTemperature.CELSIUS,
    ),
    SensorEntityDescription(
        key="Lower_Limitation_of_DHW_Setpoint",
        name="生活热水最小设置温度",
        device_class=SensorDeviceClass.TEMPERATURE,
        state_class=SensorStateClass.MEASUREMENT,
      native_unit_of_measurement=UnitOfTemperature.CELSIUS,
    ),
    SensorEntityDescription(
        key="Upper_Limitation_of_DHW_Setpoint",
        name="生活热水最大设置温度",
        device_class=SensorDeviceClass.TEMPERATURE,
        state_class=SensorStateClass.MEASUREMENT,
      native_unit_of_measurement=UnitOfTemperature.CELSIUS,
    ),
    SensorEntityDescription(
        key="Flow_Temperature_Setpoint",
        name="暖气设置温度",
        device_class=SensorDeviceClass.TEMPERATURE,
        state_class=SensorStateClass.MEASUREMENT,
      native_unit_of_measurement=UnitOfTemperature.CELSIUS,
    ),
    SensorEntityDescription(
        key="Flow_temperature",
        name="供暖出水温度",
        device_class=SensorDeviceClass.TEMPERATURE,
        state_class=SensorStateClass.MEASUREMENT,
      native_unit_of_measurement=UnitOfTemperature.CELSIUS,
    ),
    SensorEntityDescription(
        key="return_temperature",
        name="供暖回水温度",
        device_class=SensorDeviceClass.TEMPERATURE,
        state_class=SensorStateClass.MEASUREMENT,
      native_unit_of_measurement=UnitOfTemperature.CELSIUS,
    ),
    SensorEntityDescription(
        key="Mode_Setting_CH",
        name="暖气模式设置",
    ),

     SensorEntityDescription(
        key="Heating_System_Setting",
        name="供暖系统设置",
    ),
      SensorEntityDescription(
        key="burn_status",
        name="燃烧器状态",
    ),
)


async def async_setup_entry(
    hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) -> bool:
    """Set up Vaillant sensors."""
    device_id = entry.data.get(CONF_DID)
    client: VaillantClient = hass.data[DOMAIN][API_CLIENT][
        entry.entry_id
    ]

    added_entities = []

    @callback
    def async_new_entities(device_attrs: dict[str, Any]):
        _LOGGER.debug("add vaillant sensor entities. device attrs: %s", device_attrs)
        new_entities = []
        for description in SENSOR_DESCRIPTIONS:
            if (
                description.key in device_attrs
                and description.key not in added_entities
            ):
                new_entities.append(VaillantSensorEntity(client, description))
                added_entities.append(description.key)

        if len(new_entities) > 0:
            async_add_entities(new_entities)

    unsub = async_dispatcher_connect(
        hass, EVT_DEVICE_CONNECTED.format(device_id), async_new_entities
    )

    hass.data[DOMAIN][DISPATCHERS][device_id].append(unsub)

    return True


class VaillantSensorEntity(VaillantEntity, SensorEntity):
    """Define a Vaillant sensor entity."""

    def __init__(
        self,
        client: VaillantClient,
        description: SensorEntityDescription,
    ):
        super().__init__(client)
        self.entity_description = description

    @property
    def unique_id(self) -> str | None:
        """Return a unique ID."""
        return f"{self.device.id}_{self.entity_description.key}"

    @callback
    def update_from_latest_data(self, data: dict[str, Any]) -> None:
        """Update the entity from the latest data."""

        if(self.entity_description.key in data):
          value = data.get(self.entity_description.key)
          self._attr_native_value = value
          self._attr_available = value is not None
          self.async_schedule_update_ha_state(True)
回复

使用道具 举报

61

主题

326

回帖

753

积分

高级会员

积分
753
金钱
366
HASS币
0
发表于 2025-11-10 20:04:41 | 显示全部楼层
wxd8966351 发表于 2025-11-10 11:24
替换sensor.py文件内容
"""Vaillant sensors."""
from __future__ import annotations

万分感谢大佬,谢谢!从这里开始吗"""Vaillant sensors.""",方便直接分享文件吗,可以把您的隐私用xx代替,我替换了老是报错
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian ( 晋ICP备17001384号-1 )

GMT+8, 2025-11-27 07:54 , Processed in 1.265025 second(s), 10 queries , MemCached On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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