phil-lavin / heat-miser-wifi-php-interface
通过二进制接口与HeatMiser WiFi恒温器交互的PHP类。允许读取/写入DCB。
1.0.0
2013-02-01 00:56 UTC
Requires
- php: >=5.4.0
This package is not auto-updated.
Last update: 2024-09-28 12:59:46 UTC
README
简介
PHP库,通过二进制接口与HeatMiser WiFi恒温器交互。允许读取/写入DCB。
安装
支持Composer安装和常规文件包含。对于Composer,在您的composer.json中添加以下内容
"require": { "phil-lavin/heat-miser-wifi-php-interface": "1.0.1" }
或者,如果您想使用最新的提交而不是一个(据称)稳定的版本
"require": { "phil-lavin/heat-miser-wifi-php-interface": "dev-master" }
对于Composer,如果您使用Composer的自动加载器,库的类将自动加载。
使用示例
<?php // If you installed the library with Composer //require_once 'vendor/autoload.php'; // If you didn't install the library with Composer require_once 'src/PhilLavin/HeatMiser/Wifi.php'; try { // ip, pin, optional port $hm = new \PhilLavin\HeatMiser\Wifi('192.168.1.123', 1234); $dcb = $hm->get_dcb(); var_dump($dcb); // Dump existing DCB // Change heat programming for the weekend. 3rd period (return), starts at 16:00, target temp 25C $heat_data = $dcb['heat_data']; $heat_data['6-7'][2] = ['time'=>'16:00:00', 'target'=>25]; $dcb->set_heat_data($heat_data); // Could be set_ followed by any of the below writable values - e.g. set_enabled(1) // Write and dump new DCB var_dump($hm->put_dcb($dcb)); } catch (\PhilLavin\HeatMiser\ConnectionFailedException $e) { die("Failed to connect: ".$e->getMessage()."\n"); } catch (\Exception $e) { die("Exception of type ".get_class($e)." thrown. Error was: {$e->getMessage()}\n"); }
可写值
只有以下值可以更改。这是设备的限制
- 时间
- 启用
- 键盘锁定
- 假日启用
- 假日
- 运行模式
- 防冻保护目标
- 地板限制地板最大值
- 供暖目标
- 供暖保持
- 热水开启
- 加热数据
- 水数据
示例DCB对象数据数组格式(用于读取和写入)
<?php array(28) { 'vendor' => string(9) "Heatmiser" 'version' => double(1.6) 'model' => string(3) "PRT" 'time' => string(19) "2013-01-31 23:34:24" 'enabled' => int(1) 'keylock' => int(0) 'holiday' => string(19) "2013-01-31 23:34:00" 'holiday_enabled' => int(0) 'units' => string(1) "C" 'switchdiff' => int(1) 'caloffset' => int(0) 'outputdelay' => int(0) 'locklimit' => int(0) 'sensor' => string(8) "internal" 'optimumstart' => int(0) 'runmode' => string(7) "heating" 'frostprotect_enabled' => int(1) 'frostprotect_target' => int(12) 'remote_temperature' => NULL 'floor_temperature' => NULL 'internal_temperature' => double(15.7) 'heating_on' => int(0) 'heating_target' => int(14) 'heating_hold' => int(0) 'rateofchange' => int(20) 'errorcode' => NULL 'progmode' => string(3) "5/2" 'heat_data' => array(2) { '1-5' => array(4) { [0] => array(2) { 'time' => string(8) "04:00:00" 'target' => int(19) } [1] => array(2) { 'time' => string(8) "08:30:00" 'target' => int(14) } [2] => array(2) { 'time' => string(8) "16:30:00" 'target' => int(18) } [3] => array(2) { 'time' => string(8) "22:00:00" 'target' => int(14) } } '6-7' => array(4) { [0] => array(2) { 'time' => string(8) "08:00:00" 'target' => int(19) } [1] => array(2) { 'time' => string(8) "13:00:00" 'target' => int(14) } [2] => NULL [3] => array(2) { 'time' => string(8) "22:00:00" 'target' => int(14) } } } }
已知问题
- put_dcb()返回的DCB对象总是将heating_on设置为0。这似乎是恒温器的一个错误,而不是我们可以解决的问题。如果您需要可靠地获取此值,请在写入后重新读取DCB。
使用
@fogma编写了一个PHP前端,用于Heatmiser恒温器,以提供比恒温器原生的4位PIN码更好的安全性。此代码可在以下位置找到:http://www.fogma.co.uk/foggylog/archive/382.html
要求
- PHP >= 5.4
- 一个HeatMiser WiFi恒温器。在PRT-TS恒温器上进行了测试。可能在其他设备上也能工作,或者可以作为您自己开发的基。
许可证
版权(c)2013,Phil Lavin
版权所有。
在满足以下条件的情况下,允许重新分配和使用源代码和二进制形式,无论是否修改:
- 源代码的重新分配必须保留上述版权声明、本条件列表和以下免责声明。
- 二进制形式的重新分配必须复制上述版权声明、本条件列表和以下免责声明在随重新分配提供的文档和其他材料中。
本软件由版权所有者和贡献者提供,“按原样”并提供任何明示或暗示的保证,包括但不限于适销性和适用于特定目的的暗示保证。在任何情况下,版权所有者或贡献者不应对任何直接、间接、偶然、特殊、示范性或后果性损害(包括但不限于替代商品或服务的采购;使用、数据或利润的损失;或业务中断)承担责任,无论这种损害是由于何种原因造成的,无论基于合同、严格责任还是侵权(包括过失或不计过失)。
软件和文档中包含的观点和结论是作者的,不应被视为代表FreeBSD项目的正式政策,无论是明确表达还是暗示的。