Homematic


Homematicintegration provides bi-directional communication with your CCU/Homegear. It uses an XML-RPC connection to set values on devices and subscribes to receive events the devices and the CCU emit. If you are using Homegear with pairedIntertechno设备,,,,uni-directional communication is possible as well.

这re is currently support for the following device types within Home Assistant:

  • 二进制传感器
  • Climate
  • 覆盖
  • 通知
  • 传感器
  • 转变

设备支持可用于大多数有线和无线设备以及许多IP设备。如果您的设置具有混合协议,则必须配置其他界面s使用适当的端口。默认值是使用端口2001,即无线设备。有线设备通常可以通过端口2000和IP设备通过端口2010来获得。虚拟恒温程序CCU提供使用端口9292要求您设置小路设置为/groups。当在CCU3上使用SSL时,默认情况下,与固定4相同的端口可用。因此,2001年成为42001,2010变为42010等。

Since CCU Version 3, the internal firewalls are enabled by default. You have to grant full access for theXML-RPC API或在CCU的安全设置内指定家庭助理实例的IP地址并允许列表。必威是什么

如果您想查看是否支持特定设备,请前往Pyhomematicrepository and browse through the source code. A dictionary with the device identifiers (e.g., HM-Sec-SC-2) can be found within the relevant modules near the bottom. If your device is not supported, feel free to contribute.

我们会自动检测我们当前支持的所有设备,并尝试生成有用的名称。如果您启用了名称解析,我们将尝试通过JSON-RPC或您可能已安装在CCU上的XML-API从Metadata(Homegear)获取名称。由于这可能会失败,默认情况下将禁用。您可以使用家庭助理的手动重命名创建的实体必威是什么定制特征。自制的整合也得到了实体注册表,这使您可以直接在家庭助理UI中更改友好名称和实体ID。必威是什么

配置

要设置组件,请在您的configuration.yaml文件:

自欺欺人界面s无线的主持人127.0.0.1

配置变量(全局):

配置变量

界面s 列表 必需的

每个XML-RPC接口的配置,以集成到家庭助手中。必威是什么

主持人 列表 ((选修的

每个集线器(CCU/Homegear)的配置,以集成到家庭助手中。必威是什么

local_ip string ((选修的,默认:0.0.0.0

运行家庭助理的设备的IP。必威是什么覆盖外来网络设置的自动检测值。

local_port 整数 ((选修的

与家庭助理联系的端口。必威是什么默认情况下,它是随机分配的。

配置变量(接口):

配置变量

主持人 string 必需的

CCU/HomeGear设备或家庭助理附加组件的IP地址或主机名。必威是什么

港口 整数 ((选修的

CCU/HomeGear XML-RPC服务器的端口。无线:2001,有线:2000,IP:2010,恒温器:9292。在CCU3上启用SSL通常会在端口上备4个4。例如,2001将启用SSL变为42001。

SSL 布尔 ((选修的,默认:false

设置真的如果在CCU3上启用了SSL支持。

verify_ssl 布尔 ((选修的,默认:false

设置真的如果使用有效的证书。默认值为错误的通常,配置了自签名的证书。

callback_ip string ((选修的

设置此,如果与CCU(NA必威是什么T,Docker等)不同的IP下可以联系。

callback_port 整数 ((选修的

设置此设置,如果在与CCU必威是什么(NAT,Docker等)不同端口下可以联系家庭助理。

分辨率 string ((选修的,默认:false

Try to fetch device names. Defaults to错误的如果not specified.

jsonport 整数 ((选修的

Port of CCU JSON-RPC Server. The default is 80, but it may be different when running CCU virtually via Docker or with enabled SSL.

用户名 string ((选修的

通过JSON-RPC获取名称时,您需要向CCU指定带有访客的用户。Admin-access is required if you work with variables on the CCU.

密码 string ((选修的

通过JSON-RPC获取名称时,您需要指定上面配置的用户的密码。

小路 string ((选修的

设置/groupswhen using port 9292.

配置variables (host):

配置变量

主持人 string 必需的

CCU/Homegear设备的IP地址。

港口 整数 ((选修的

CCU/HomeGear XML-RPC服务器的端口。Wireless: 2001, wired: 2000, IP: 2010

用户名 string ((选修的

通过JSON-RPC获取名称时,您需要向CCU指定带有访客的用户。

密码 string ((选修的

通过JSON-RPC获取名称时,您需要指定上面配置的用户的密码。

带有多个协议的示例配置,设置了一些其他选项

自欺欺人界面srf主持人127.0.0.1分辨率JSON“用户名Admin"密码秘密”wired主持人127.0.0.1港口2000分辨率JSON“用户名Admin"密码秘密”IP主持人127.0.0.1港口2010主持人127.0.0.1港口9292分辨率JSON“用户名Admin"密码秘密”小路/groups主持人ccu2主持人127.0.0.1港口2001用户名Admin"密码秘密”

分辨率选项

We use three approaches to fetch the names of devices. Each assumes you have properly named your devices in your existing Homematic setup. As a general advice: Use ASCII for your devices names. Home Assistant won’t include non-ASCII characters in entity-names.

  1. JSON:CCU允许通过JSON-RPC获取配对设备的详细信息。为此,您需要在组件配置中添加有效的凭据。来宾访问足以查询设备名称。
  2. XML:If you use a CCU, there is an add-on called the “XML-API”. With it installed, you are able to fetch all kinds of information from you CCU using XML-RPC. We can leverage this and fetch the names of devices set within the CCU. We don’t support authentication with this method. TheJSON方法应该优先XML。对XML-API的支持仅适用于向下兼容性,并且可以在以后的版本中被禁用。
  3. 元数据:HomeGear通过内部具有元数据设备提供设备名称。使用HM-CFG-LAN接口时,通常使用配置软件(默认情况下是桌面上的快捷方式)来配置和配置设备。如果您配对设备,则会看到它们在表中列出。最左边的列(名称)预先填充默认名称。您可以单击此类名称并输入您喜欢的任何内容。

解决名称可能需要一些时间。因此,当您启动家庭助理时,您一开始就必威是什么不会看到设备。对于具有20多个设备的设置,最多可能需要一分钟,直到所有设备显示在UI中。

多个主机

为了允许并行与多个主机或不同协议(无线,有线和IP)进行通信,将建立多个连接,每个连接到已配置的目标。您为主机选择的名称必须是独特的,并且仅限于ASCII字母。使用多个主机的缺点,服务(下文解释)可能无法按预期工作。只能将一个连接用于服务,该连接限制了服务可以使用的设备/变量可用于主机的范围/协议。确实如此not影响家庭助理的实体。必威是什么他们都使用自己的联系并按预期工作。

读取实体的属性

除了其状态外,大多数设备都具有诸如电池状态或阀门位置之类的其他属性。这些可以使用自动化中的模板,甚至可以使用其自己的实体访问这些模板传感器component. Here’s an example of a template sensor that exposes the valve position of a thermostat.

模板-传感器-name卧室valve"状态{{state_attr('climate.leq123456','等级')}}””

变量

可以读取和设置您在CCU/HomeGear上设置的系统变量的值。设置值的支持类型是浮动和bool变量。使用CCU,需要具有管理员的用户。变量的状态可通过轮毂实体的属性获得(例如,homematic.ccu2)。使用模板(如上所述)使您的变量可用于自动化或作为实体。变量的值以30秒的间隔从CCU/Homegear进行了轮询。设置变量的值立即发生并直接推动。

事件

When Homematic devices change their state or some other internal value, the CCU/Homegear sends event messages to Home Assistant. These events are automatically parsed and the entities in Home Assistant are updated. However, you can also manually use these events to trigger automations. Two event-types are available:

  • homematic.keypress:For devices with buttons, see information below
  • 自欺欺人:For impulse sensors

带有按钮的设备

带有按钮(例如HM-SEN-MDIR-WM55,遥控器)的设备在UI中可能不完全可见。这是旨在的,因为按钮在这里没有任何值,而他们所做的只是触发事件。例如:HM-SEN-MDIR-WM55运动检测器将显示为2个实体。运动传感器和亮度传感器。最重要的是,我们有4个事件的2集(每次按钮一组):press_short,press_long,press_cont,press_long_release。请注意,有些设备无法提供所有这些事件。但总的来说:如果可以按下它,通常至少具有press_short。

Here’s an example of how to use these events for automations:

自动化扳机平台事件事件_typehomematic.keypressevent_datanameKitchen转变”渠道1parampress_short行动服务switch.turn_ontargetENTITY_IDswitch.kitchen_abbience

通道参数等于您要配置自动化的按钮的通道。您可以查看用于配对设备的UI中的可用频道。名称取决于您是否选择解析名称。如果没有,它将是设备ID(例如LEQ1234657)。如果您选择解析名称(这是成功的),那将是您在CCU或元数据中设置的名称(例如“厨房开关”)。

You can test whether your button works within Home Assistant if you look at the terminal output. When pressing a button, lines similar to those should appear:

2018-01-27 11:51:32信息((Thread-12[pyhomematic.devicetypes.generic] hmgeneric.event:地址=MEQ1234567:6,界面_id=homeassistant-CCU2,key=press_short,价值=True 2018-01-27 11:51:32信息((MainThread[HOMEASSISTANT.CORE]巴士:处理<事件homematic.keypress [l]:param=press_short,name=your_nice_name,渠道=6> 2018-01-27 11:51:32信息((Thread-12[pyhomematic.devicetypes.generic] hmgeneric.event:地址=MEQ1234567:6,界面_id=homeassistant-CCU2,key=install_test,价值=真的

It may happen that “your_nice_name” is not resolved correctly; the according message (#2 in the above example) will be missing. This might be due to secure communication between your HM interface and the HM device. You can change the communication from “secure” to “standard” within your HM-interface to solve that issue (in “Einstellungen” - “Geräte” find your device and change “Übertragungsmodus” from secure to standard) - not recommended for devices that should have secure communication.

HOMEMATIC.KEYPRESS事件

得到homematic.keypress对于某些自制的IP设备,例如WRC2 / WRC6(墙开关)或SPDR(通道传感器)或KRC4(键环遥控器),您必须临时为CCU中的每个通道创建一个空程序:

  1. In the menu of your CCU’s admin panel go toPrograms and connections>程序和CCU连接
  2. 新的在页脚菜单中
  3. 单击下面的加号图标条件:如果...然后按按钮设备选择
  4. 选择您需要的设备之一(WRC2 / WRC6的1-2 / 1-6,SPDR的2-3)
  5. 选择简短或长键按
  6. 保存程序好的button
  7. 按照步骤5中的配置来触发程序。您的设备可能会通过绿色LED或类似方式指示成功。当您选择设备时Status and control>设备在CCU上,上一次更改字段不应再为空
  8. When your channel is working now, you can edit it to select the other channels one by one
  9. 最后,您可以从CCU删除此程序

Services

  • homematic.virtualkey:使用设备或虚拟密钥模拟CCU/HomeGear上的按键(或其他有效的操作)。
  • homematic.reconnect:Reconnect to CCU/Homegear without restarting Home Assistant (useful when CCU has been restarted)
  • homematic.set_variable_value:设置系统变量的值。
  • homematic.set_device_value:手动控制设备(甚至没有支持的设备)。等效于XML-RPC的setValue方法。
  • 自欺欺人。put_paramset:手动更改设备的参数(甚至没有支持的设备)。等效于XML-RPC的PutParamSet方法。

例子

Simulate a button being pressed:

。。。行动服务homematic.virtualkey数据地址Bidcos-RF”渠道1parampress_long

Open KeyMatic:

。。。行动服务homematic.virtualkey数据地址LEQ1234567“渠道1paramOPEN

将布尔变量设置为true:

。。。行动服务homematic.set_variable_valuetargetENTITY_IDhomematic.ccu2数据name变量名”价值真的

高级示例

如果您熟悉自制设备的内部设备,则可以在设备上手动设置值。如果目前尚无对设备的支持,或者仅实施了有限的功能,则可以作为解决方法。使用此服务使您可以直接访问主要连接的setValue方法。如果您有多个主机,则可以通过为代理参数提供与您选择的名称相等的值选择托管特定设备的一个。在上面的示例配置中rf,,,,wiredIP将是有效的值。

手动打开开关演员:

。。。行动服务homematic.set_device_value数据地址LEQ1234567“渠道1param状态价值真的

在恒温器上手动设置温度:

。。。行动服务homematic.set_device_value数据地址LEQ1234567“渠道4paramset_temperature价值23.0

手动在恒温器上设置主动轮廓:

。。。行动服务homematic.set_device_value数据地址LEQ1234567“渠道1paramActive_profile价值1值类型int

设置墙壁恒温器的一周计划:

。。。行动服务自欺欺人。put_paramset数据界面无线的地址LEQ1234567“paramset_key掌握参数Week_program_pointer1

Set the week program of a wall thermostat with explicitrx_mode(仅BIDCOS-RF):

。。。行动服务自欺欺人。put_paramset数据界面无线的地址LEQ1234567“paramset_key掌握rx_modeWAKEUP参数Week_program_pointer1

BIDCOS-RF设备具有put_paramset的可选参数,该参数定义了配置数据发送到设备的方式。

rx_modeBURST,,,,which is the default value, will wake up every device when submitting the configuration data and hence makes all devices use some battery. It is instant, i.e. the data is sent almost immediately.

rx_modeWAKEUP仅在设备提交更新的值向CCU提交的更新值之后,通常会每3分钟发生一次配置数据。它不会唤醒每个设备,从而节省设备电池。

手动在keymatic设备上设置锁定:

。。。行动服务targetENTITY_IDlock.leq1234567

手动设置在Keymatic设备上解锁:

。。。行动服务lock.unlocktargetENTITY_IDlock.leq1234567

集成HMIP-DLD

当前Pyhomematic执行。解决方法是在您的配置中定义模板锁:

-平台模板name基础唯一身份基础value_template{{是_state('sensor.lock_status','locked')}}””服务homematic.set_device_value数据地址002A1BE9A792D2“渠道1paramlock_target_level价值0unlock服务homematic.set_device_value数据地址002A1BE9A792D2“渠道1paramlock_target_level价值1

检测失去的连接

当丢失了与您的自制CCU或家庭饮料的连接时,家必威体育存款庭助理将停止从设备获得更新。必威是什么例如,在重新启动CCU之后可能会发生这种情况。由于通信协议的性质,这不能自动处理,因此您必须致电homematic.reconnect在这种情况下。这就是为什么通常是一个好主意,最好检查您的家庭集成是否仍适当更新,以检测连接损失。必威体育存款这可以通过自动化以几种方式完成:

  • 如果您有一个传感器,您知道会经常更新(例如,室外温度传感器,电压传感器或光传感器),则可以设置一个辅助二进制传感器和这样的自动化:
模板-binary_sensor-nameHomematic发送updates"状态>  -{{(NOW() -  states.sensor.office_voltage.last_changed).seconds <600}}}自动化-别名Homematic重新连接”扳机平台状态ENTITY_IDbinary_sensor.homematic_is_sending_updatesto离开”行动#重新连接,如果传感器在10分钟以上没有更新服务homematic.reconnect

重要的部分是传感器时间实体(来自time_date组件)。这将在传感器和每一分钟的每一个更改中更新二进制传感器。如果自制传感器不再发送任何更新,则传感器时间将把二进制传感器设置为离开最后一次传感器更新后10分钟。这将触发自动化。

  • 如果您有CCU,则还可以在CCU上创建系统变量,该变量存储其最后一次重新启动时间。由于家庭助理必威是什么仍然可以从CCU刷新系统变量(即使在重新启动后),这是另一个可以致电的选项homematic.reconnect。即使此选项看起来可能比许多选项更可取,因为它不依赖传感器,但it is less fail-safethan checking for updates of a sensor. Since the variable on the CCU is only changed on boot, any problem that causes the connection between Home Assistant and the CCU to break but will not result in a reboot will not be detected (eg. in case of networking issues). This is how this can be done:

    1. 创建一个字符串变量v_last_rebooton the CCU

    2. 在CCU上创建一个新程序without any conditions,,,,which executes the followingHM-Script延迟30秒。该脚本需要在本节中实现活动:然后

      varOBJ=domgetObject((v_last_reboot);stringnow=系统日期((%d。%m。%y%h:%m:%s);OBJ状态((now);

      这Homematic CCU will execute all active programs which meet their conditions (none in this case) on every reboot.

    3. 在家庭助理中设置模板传感器,其中包含系统变量的值:必威是什么

      模板-传感器-namevlast重启”状态{{state_attr('homematic.ccu2','v_last_reboot')或者'01.01.197000:00:00'}}””图标MDI:时钟”
    4. 设置一个呼叫的自动化homematic.reconnectwhenever the sensor variable changes:

      自动化-别名HomematicCCU重启”扳机平台状态ENTITY_ID传感器。V_LAST_REBOOT行动服务homematic.reconnect

通知

自欺欺人通知平台启用调用家庭设备。

要在安装中使用此通知平台,请添加以下内容configuration.yaml文件:

配置

#示例Configuration.yaml条目通知-namemy_hm平台自欺欺人地址neqxxxxxxx”渠道2param提交”价值1,,,,1,,,,108000,8"

配置变量

地址 string 必需的

您的家庭设备的地址。必威体育存款地址是CCU中显示的设备的序列号设备serial number

渠道 整数 必需的

您的自制设备的渠道。必威体育存款

param string 必需的

家庭设备的附加参数。

界面 string ((选修的

从配置设置接口的名称。

价值 string 必需的

This is the value that is set on the device. It’s device specific.

用法

自欺欺人是一个通知平台,可以通过调用通知服务来控制如下所述

Only the数据事件有效载荷的一部分已处理。该部分可以指定或覆盖为配置变量给出的值:

{“数据”{“地址”“ neqxxxxxxx”,,,,“渠道”2,,,,“ param”“提交”,,,,“价值”“1,,,,1,,,,108000,8"}}

可以提供模板以计算值:

{“数据”{“价值”“ 1,1,108000 {%如果IS_STATE('Binary_sensor.oeqxxxxxxxxxxx_state','on')%},1 {%endif%} {%iS_STATE('binary_sensor.oeqxxxxxxxxxxxxxx_state'% 万一 %}”}}

您还可以使用组通知指定事件有效载荷(而不是指定通知本身的值):

通知-namemy_hm平台自欺欺人地址neqxxxxxxx-namegroup_hm平台团体服务s-服务my_hm数据数据价值1,1,108000 {%如果IS_STATE('Binary_sensor.oeqxxxxxxx_state','在')%},1{%endif%} {%如果IS_STATE('Binary_sensor.oeqxxxxxxx_state','在')%},2 {%endif%}””警报temperaturenameTemperature too highDone_message温度正常ENTITY_IDbinary_sensor.temperature_too_highcan_acknowledge真的notifiers-group_hm

请注意,第一个数据element belongs to the servicemy_hm,而第二个属于事件有效载荷。