Sending UDP with lua

Moderator: leecollings

Post Reply
JelteV
Posts: 19
Joined: Wednesday 04 January 2017 19:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Sending UDP with lua

Post by JelteV »

Hi,

Is it possible to send an UDP package from lua?
Is it possible to add new devices/lights directly from lua?
holdestmade
Posts: 5
Joined: Thursday 18 May 2017 17:07
Target OS: Windows
Domoticz version:
Contact:

Re: Sending UDP with lua

Post by holdestmade »

This is what I use for sending UDP:

function sendUDP(msg)
local socket = require "socket"
local udp = assert(socket.udp())
assert(udp:sendto(msg, "192.168.1.100", 9999))
assert(udp:close())
end



sendUDP("HELLO")
User avatar
papoo
Posts: 126
Joined: Friday 22 January 2016 22:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10
Location: France
Contact:

Re: Sending UDP with lua

Post by papoo »

@holdestmade : thanks for this function
a question : where can i find socket for lua you use?
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: Sending UDP with lua

Post by simonrg »

You willfind the socket library here - http://www.domoticz.com/wiki/Remote_Con ... _Libraries.
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
User avatar
papoo
Posts: 126
Joined: Friday 22 January 2016 22:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10
Location: France
Contact:

Re: Sending UDP with lua

Post by papoo »

thanks
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest