Sending UDP commands

Hello all

I am rather inexperienced with home automation and programming - but am keen to do the following and hoping someone can help me. I think it’s actually quite simple request so am thinking someone here would know straight away!

I want to send a UDP command from my Vera. I am running AltUI and think I need to enter Lup code (but have no idea how to do that). I think the Lup code needs to be in a scene?

The UDP command would be sent to my LightwaveRF WiFi link and be a command to turn lights on / off.

An example UDP command would be :

111,!R1D1F0

I need to send this to IP address 10.0.1.147 (on the same subnet as the Vera box) on port 9760

I have tried and tried but can’t work out how to do it,

Any help much appreciated.

Thanks

Andrew

Sorry this isn’t an actual reply to your question but have you considered getting a RFXtrx433E device? I use one of these with my Vera Edge and (in conjunction with a free plugin) it allows my LightwaveRF devices to appear and be controlled just like my z-wave kit (but without polling/response). The ability to integrate my LightwaveRF stuff was one of the main reasons I went for the Vera. Oh, and the RFXtrx433E also allows me to get readings from my Oregon Scientific temperature/humidity sensors and my Owl energy logger. All with no programming required!

Richard

Yes, UDP is very simple and would require a bit of code which probably would go into a scene. It goes something like this

local ip, port = "127.0.0.1", 2003       -- change these to what IP and PORT you need
local message = "whatever message you like"
local socket = require "socket" 
sock, msg = socket.udp()
if sock then 
  sock:setpeername(ip, port) end         -- connect to destination
  sock:send(message)
  sock: close()
end

Those are the basics. Of course, it could be much improved if properly tailored to your specific needs.

This is, in fact, nothing to do with AltUI.

Many thanks for this both - much appreciated!

Richard - good idea, but I was hoping to avoid spending more ? on hardware if I can get my WifiLink to work

Akbooer - thanks. I only posted this in the AltUI forum as I couldn’t see where to put the code in the standard Vera UI. Is there somewhere to do it without AltUI?

Thanks again

Andrew

Yes. AltUI doesn’t offer anything different from UI5 or UI7 in that respect. Startup Lua or scene Lua are both options there.