Can anyone send an Insteon command directly from LUA script?

I have been working on this problem for a couple of days. I know it is possible, but I have not cracked the code. The problem seems to be a limit in sending the extended ASCII from the LUA script through the open port to the 2413U PLM. Does LUA script need something we can use to send the utf8 characters?

I have tried things like:


– cmd= “\2\98\21\176\8\5\17\255” – 582

   --   OR

–cmd=string.char(0x02, 0x62, 0x0A, 0x99, 0xa9, 0x05, 0x11, 0xFF)

    --  OR


if then
data=“no Go”
data=“Sent True”
luup.task(tostring(cmd), 1, “Sent?”, -1)[/code]

I have not tried this, but I have a few comments.

  1. Do you have any form of Insteon enabled on the device? (Native, or something like Altsteon.) If you do, then hopefully the Vera is blocking you from talking directly to the serial interface. If you get more than one thing talking to the serial interface at a time, you can at best get garbled data and at worst lock up the PLM.

If you have any Insteon stuff enabled, disable it and set the PLM up as just a serial device. That may allow you to do what you are trying to do.

  1. The command you are trying to send doesn’t look correct. From what you have listed, you are trying to send an SD “ON” message to a device with address 0a,99,a9. Is that correct?

The setting in the flags byte (0x05) is going to cause you problems. When sending a command, you want the flags byte set to 0x0f for an SD message, and 0x1f for an ED message. So, assuming you are getting a “Sent True” this may be some of your problem. (The flags specify how many hops the command can take.)

Also, if the PLM and device don’t have each other’s addresses in their ALDB, they will discard any messages and nothing will happen. (Well, technically, if the target device has the PLM’s address in its database, it will probably turn the light on, and discard the ACK.)

  1. If you are trying to use the native Insteon stuff, there is an action defined in the XML files that looks like it might let you push a raw command in. I think I tried this once and didn’t get anywhere, but it might be worth looking at.

  2. If you have all of the other Insteon stuff turned off, make sure the serial port is set to 19200. The Vera seems to like to default it to 9600, and while that may work the official developer documentation indicates that the only supported speed is 19200.

Hope this helps.

Thank you, those were all very good suggestions. I tried them all and still no-go. It could be something very simple that I am missing, but I still think it might be a problem with the small script Lua window not being able to send the extended ASCII.

If I stumble on the solution, I will post it here.