Skip to content

A PHP library to connect to the Domoticz Home Automation System

Notifications You must be signed in to change notification settings

rkirkels/domoticz-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 

Repository files navigation

#domoticz-php Library for connecting to Domoticz

With this library you can control lights, switches, thermostats and other home automation devices with PHP by connecting to Domoticz, the open-source Home Automation System.

Installation

php composer.phar require rutgerkirkels/domoticz-php

Basic usage

<?php

// Initialize the Domoticz library with the hostname of the Domoticz machine.
// If you didn't set login credentials, you can leave the username and password
// attributes empty.
$domoticz = new \rutgerkirkels\domoticz_php\Domoticz('<hostname>','<username>', '<password>');

/**
 * This example reads the temperature from the first temperature sensor that is found
 */

// Get all the temperature sensors in Domoticz
$temperatureSensors = $domoticz->getTemperatureDevices();

// Get the temperature from the first sensor
echo $temperatureSensors[0]->Name() . ' temperature is ' . $temperatureSensors[0]->Temp();
?>

Another example: Read the status of the first light/switch that is found in Domoticz:

<?php
$lightsAndSwitches = $domoticz->getLightsAndSwitches();
echo 'Status of ' . $lightsAndSwitches[0]->Name() . ': ' . $lightsAndSwitches[0]->Status();
?>

Domoticz-php also offers the ability to pre-define home automation appliances through a YAML-config file, so that you can use appliances that consist of multiple sensors and switches, like a Nest Thermostat.

About

A PHP library to connect to the Domoticz Home Automation System

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages