GenericIO

Generic IO is a module to interface with a device that can be either reached via RS-232 or using TCP.
It is for instance used to communicate with devices that are connected to an Arduino board.

GenericIO can be found under Interfaces -> Input/Output -> GenericIO:
Screen shot of the GenericIO window


With the InterfaceType drop down box you can select between RS-232 or TCP and with the selection of either one the address/interface boxes for it will be enabled/disabled.

The text read from either RS-232 or TCP is parsed using the "Value field delimiter" and the "Regex":
  • First the text is split into fields using the "Value field delimiter"
  • After that the fields are parsed into identifiers and values using the "Regex"

The "Value field delimiter" can be a simple character like ',' or '|'

To test things you can use the "Input Data to Test".

 

Setting values

You can have the GenericIO interface send a value by creating an action to set a device value.
Be sure to set only "Value1" as the other values will no be actually set/send out, only the DomotiGa internal value will be updated.

eg. for this device ( which is an arduino that has 4 relays (R1, R2 R3 and R4))

You need to set the device to "Switchable" as the code in "Devices.module" now requires this...


    ' Only do the SendCommand if it valueid and the device is switchable/dimmable
<snip>
    Else
      If Main.bDevicesDebug Then Main.WriteDebugLog("[Devices] Device '" & sDeviceName & "' is not set as switchable or dimable, so only do a value update.")
      Devices.ValueUpdate(iDeviceId, iValueNum, sValue)

Now create an Event Action that sends the required command string to the device.

Now this next BIT IS REALLY IMPORTANT!
Be sure to set only "Value1" as the other values will no be actually set/send out, only the DomotiGa internal value will be updated.
Value1 is special case as per this code in "Devices.module"

    ' Only do the SendCommand if it valueid and the device is switchable/dimmable
    If iValueNum = 1 And (rDevice!switchable Or rDevice!dimable) Then
      If Main.bDevicesDebug Then Main.WriteDebugLog("[Devices] Device '" & sDeviceName & "' is set as switchable or dimable, so call SendCommand() of plugin.")
      ' call plugin's sendcommand routine (if any)
      If Plugin.SendCommand(sPluginName, iInstance, sAddress, sValue, sDeviceName) Then
        ' TODO: remove if value control/feedback params are implemented
        ' until then this workaround is needed for some plugins
        Select sPluginName
          Case "GenericIO", "OpenZWave" 
            ' don't do valueupdate, these come back from devices

ie. the following will send the string "put_whatever_you_want_sent_here" to the device.

If say the serial/TCP command to turn relay 1 on was "R1:1", then you would have the following.

Related Resources

    Updated by: thechad, Updated about 2 years ago
    Access count: 46015 since 2011-08-25

    Attached Files

    GenericIO.png - Screen shot of the GenericIO window (58.3 KB) danfos, 04/17/2014 07:06 PM

    genericio1.png (45 KB) thechad, 05/03/2015 07:01 AM

    genericio2.png (39 KB) thechad, 05/03/2015 07:01 AM

    genericio3.png (34.8 KB) thechad, 05/03/2015 07:08 AM

    genericio4.png (33 KB) thechad, 05/03/2015 07:15 AM

    Also available in: PDF HTML TXT