Skip to content
ggodart edited this page Jan 2, 2021 · 6 revisions

K8055

See original

SYNOPSIS

This is the MisterHouse client interface for my K8055 interface board daemon. Once you have created a K8055 object, you must tell it which input ports you are interested in using the doUpdate... methods.

  $k8055 = new K8055;
  if ($Reload) {
    $k8055->doUpdateDigital(4);
    $k8055->doUpdateAnalogue(2);
  }

Whenever the value of these ports change, $k8055->state_now will return the name of the port that has changed (i.e. 'digital 4'). The state of each port is checked every 10 seconds (by default, can be changed).

Use the write... methods to change the value of the output ports.

DESCRIPTION

K8055 daemon MisterHouse Interface http://www.velleman.be/ot/en/product/view/?id=351346

INHERITS

INI PARAMETERS

#k8055_host - Hostname that is running k8055d.

#k8055_port - Port on hostname to which daemon is listening.

METHODS

Method Description
state_now For one pass, will return the name of the input port that has just changed.
if ($state=$k8055->state_now()) {
if ($state eq 'digital 5') {
speak "The digital 5 port just changed value";
}
if ($state eq 'counter 1') {
speak "Counter number 1 just changed";
}
if ($state eq 'analogue 2') {
speak ("Analogue port 2 now reads ".$k8055->readAnalogue(2));
}
}
readAnalogue, readDigital, readCounter Returns the value of the given port as read on the last check.
# returns the last read value of digital port 4
$k8055->readDigital(4);
writeAnalogue, writeDigital Sets the value of the output ports.
# sets analogue port 2 to 143/255 x 5V (i.e. 0=0 V, 255 = 5 V).
$k8055->writeAnalogue(2,143);
resetCounter Resets the given counter.
# resets counter 2
$k8055->resetCounter(2);
setDebounce Sets the debounce of each counter in milliseconds.
# sets the debounce of timer 1 to 350ms
$k8055->setDebounce(1,350);
doUpdateAnalogue, doUpdateDigital, doUpdateCounter Tells the object to care about the given port(s). If this command isn't called, then the corresponding read... method will always return -1 and the state variable will never be set.
# read and monitor digital ports 2, 3 and 5
$k8055->doUpdateDigital(2,5,3);
setUpdatePeriod Sets how often we update the input port readings. Defaults to 10 seconds.
# input ports will be read every 2 seconds.
$k8055->setUpdatePeriod(2);
getUpdatePeriod Gets the current auto update period in seconds.
print "current update period is ".$k8055->getUpdatePeriod()." seconds";
update Immediate requests updated values from the ports that we are interested in. Note that the data will not immediately be available on return from this method as updates are asynchronous.
$k8055->update();

AUTHOR

Matthew Williams

SEE ALSO

None

Clone this wiki locally