first commit
This commit is contained in:
18
lua_parsers/example_xml.lua
Normal file
18
lua_parsers/example_xml.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
-- Example of XML parser handling data with the following structure
|
||||
--<?xml version="1.0" encoding="UTF-8"?>
|
||||
--<sensor>
|
||||
-- <id>13</id>
|
||||
-- <value>29.99</value>
|
||||
--</sensor>
|
||||
|
||||
--}
|
||||
|
||||
-- A test with curl would be : curl -X POST -d "@test.xml" 'http://192.168.1.17:8080/json.htm?type=command¶m=udevices&script=example_xml.lua'
|
||||
|
||||
-- Retrieve the request content
|
||||
s = request['content'];
|
||||
|
||||
-- Update some devices (index are here for this example)
|
||||
local id = domoticz_applyXPath(s,'//id/text()')
|
||||
local s = domoticz_applyXPath(s,'//value/text()')
|
||||
domoticz_updateDevice(id,'',s)
|
||||
Reference in New Issue
Block a user