<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
phil-lavin / heat-miser-wifi-php-interface example snippets
// If you installed the library with Composer
//quire_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");
}