Skip to content

Adding Items and devices

ggodart edited this page Jan 27, 2021 · 2 revisions

Adding Items and devices

Devices (called items in MisterHouse) are normally added in the items.mht file, however they can also be added in code as described in the items.mht wiki page. Links for how to add devices for each type of device are specified in the Protocols and Interfaces section of this wiki, or if you already know what you want the underlying code is documented on the Items and Methods page.

Here is an items.mht example of a simple X10 device

#X10A, housecode_unit, item_name, groups, other_parameters
X10A,   A1,  garage_lamp,   All_X10_lights|All_X10,         PLM,

Testing

Once this is defined, MisterHouse restarted and all the hardware connections made you can control this device from the default web interface or using your own code.

Setting your device to a new state

e.g.

$garage_lamp->set(ON,"set by my program");

Detecting if your device changed to a new state

e.g.

if ( $state = state_now $garage_light_switch) {
	print_log("garage light switch changed to $state ");
}
Clone this wiki locally