Page 1 of 1

Question about updating a custom sensor

Posted: Friday 12 August 2016 13:42
by schulpr
Hi,

I have this little script for updating two custom sensors. But when I run it only one, the last, custom sensor is updated. Can someone give me a hint how to solve this?

Code: Select all

-- Testscript (device)

now=os.time()
tijd=(os.date("%X", now))

windspeed = 363
windforce = 364

commandArray = {}

if devicechanged['Visite']
    then
    commandArray['UpdateDevice'] = windspeed..'|0|'..tostring(50)
	commandArray['UpdateDevice'] = windforce..'|0|'..tostring(7)
end

return commandArray
Thanks in advance!

Rob

Re: Question about updating a custom sensor

Posted: Friday 12 August 2016 14:36
by cyberclwn
Could you try this:

Code: Select all

commandArray[1]={['UpdateDevice'] = windspeed..'|0|'..tostring(50)}
commandArray[2]={['UpdateDevice'] = windforce..'|0|'..tostring(7)}
Since you use 2x 'UpdateDevice'. I think i read somewhere you have to use an indexnumber in that case.

See: https://www.domoticz.com/wiki/Events

Re: Question about updating a custom sensor

Posted: Friday 12 August 2016 14:44
by schulpr
Yes! Thank you for the help. That does the trick.

Regards, Rob