gilles
December 19, 2011, 1:12pm
1
Hi all,
I Want to make an xmpp notification device (with an external xmpp server like openfire)
In order to choose a solution rather than another one, Could someone tell me if It is possible to know which device activate a scene ?
For example a sensor device activate a notification scene. So I could know it’s a sensor in room XX ith name “xxxx”.
Any idea ?
-Gilles.
futzle
December 19, 2011, 8:34pm
2
I don’t think so. Scenes might get activated by timers rather than events, or they might get activated over HTTP by a human or a program. There may not be a “device” that triggered the scene at all.
A workaround is to use separate scenes, and tie one interesting device/event to each scene.
gilles
December 20, 2011, 6:13am
3
As usualy futzle, thank you for your answer.
So I continu to developp an xmpp device like SND from ap15e. More easier.
The mecanism is an xmpp device to a php page then an xmpp client script.
Sent from my GT-I9000
gilles
December 21, 2011, 2:49pm
4
Hi Futzle,
So I take option 2 which is my xmpp forwarder device : XFD like SND from ap15e, but I got a problem with my I_XFD.xml
here is the code:
<startup>StartupXFD</startup>
<actionList>
<action>
<serviceId>urn:upnp-gilles-com:serviceId:XFD1</serviceId>
<name>SendNotification</name>
<run>
if ( ( lul_settings.jid_user ~= nil ) and ( lul_settings.jid_user ~= '' )
or
( lul_settings.message ~= nil ) and ( lul_settings.message ~= '' )
)
then
local message = lul.settings.message or ''
local jid_user = lul.settings.jid_user or ''
local result, status, content = socket.http.request([[http://XX.XX.XX.XX]] .. [[/notification_center.php?j=]] .. jid_user .. [[&m=]] .. message)
---messages_sent = messages_sent + 1
---luup.variable_set( XFD_SERVICE, 'MessagesSent', tostring( messages_sent ), XFD_DEVICE )
end
if I had a look at my log, I can see that the variable jid_user and message are ok but there is an error:
JobHandler_LuaUPnP::HandleActionRequest device: 31 service: urn:upnp-gilles-com:s
erviceId:XFD1 action: [[36;1mSendNotification[[0m <0x340e>
08 12/21/11 15:27:36.127 JobHandler_LuaUPnP::HandleActionRequest argument jid_user=toto@tat.loc
<0x340e>
08 12/21/11 15:27:36.127 JobHandler_LuaUPnP::HandleActionRequest argument message=a message
<0x340e>
01 12/21/11 15:27:36.129 [[31;1mLuaInterface::CallFunction-1 device 31 function SXFD_XFD1_SendNotification
_run failed [string “…”]:65: attempt to index global ‘lul’ (a nil value)[[0m <0x340e>
the lup.call_action is like SND:
luup.call_action( “urn:upnp-gilles-com:serviceId:XFD1”, “SendNotification”, { jid_user = ‘toto@tata.org’, message = ‘Blah blah’ }, 31 )
RQ: XFD device at 31
One more idea ?
gilles
December 22, 2011, 1:05pm
5
Hi,
I think the problem is “&” in xml implementation or Ui5 as it’s fashion today.
Nobody to help me ?
Gilles.
Sent from my GT-I9000
gilles
December 22, 2011, 9:57pm
6
I’m really blocked, please help me.
I have tested a lua code without “&” with a scene it doesn’t work too, so it’s not “&”.
So what is my error, I’m in firmware 1.5.201.
Don’t know what to do more :'(.
ap15e, guessed, henk one idea.
Gilles.
guessed
December 22, 2011, 11:04pm
7
Change the references to
lul.settings
Into
lul_settings
It thinks youre looking for a variable called lul because of the period (“.”)
gilles
December 23, 2011, 7:36am
8
Hi guessed
Thanks for your help, I didn’t see my error.
Now it works perfectly.
My first complete plugin !!!
So it can send xmpp notifications in less than 2 sec to my smartphone or what I want.
Thank you very much.
I will open a topic to publsh my code.