Skip to content

Items example_interface

ggodart edited this page Jan 2, 2021 · 1 revision

example_interface

See original

SYNOPSIS

Here is an example of reading/writing using this object: '`` perl $test_example1 = new example_interface('string_on', ON); $test_example1 ->add ('string_off', OFF);

print "Example 1 data received: $state\n" if $state = state_now $test_example1; set $test_example1 OFF if new_second 5;

Here is another example
```perl
 $interface = new example_interface;
 $interface ->add('out123', 'request_status');
 $interface ->add('in123',  'door_open');

 set $interface 'request_staus' if $New_Second;
 speak 'Door just opened' if 'door_open' eq state_now $interface;

You could also query the incoming serial data directly:

 if (my $data = said $interface) {
        print_log "Data from interface: $data";
 }

DESCRIPTION

Methods (sub) 'startup' or 'serial_startup' are automatically called by mh on startup.

INHERITS

Generic_Item
Serial_Item

INI PARAMETERS

example_interface_module = example_interface
example_interface_port   = COM9

Items.mht

Defined in items.mht as

# DEVICETYPE, name, groups, others
MYDEVICE, Lounge_lamp, Lounge, Parameter1

Or in code as

METHODS

Method Description

AUTHOR

SEE ALSO

Clone this wiki locally