Question about updating a custom sensor

Moderator: leecollings

Post Reply
schulpr
Posts: 137
Joined: Thursday 01 January 2015 9:10
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Question about updating a custom sensor

Post 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
User avatar
cyberclwn
Posts: 103
Joined: Thursday 20 August 2015 22:53
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Question about updating a custom sensor

Post 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
3xPi 2B (Domoticz "live", Domoticz "sandbox", PhotoFrame)
RFXCom433(E), KaKu, Oregon Scientific, Keyes 2-relay, Logitech Media Server, MiLight, Smartwares heating controller(2x), IR Send/Receive, Keyes PIR, XH-M131 DuskSensor, DHT22/11
schulpr
Posts: 137
Joined: Thursday 01 January 2015 9:10
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Question about updating a custom sensor

Post by schulpr »

Yes! Thank you for the help. That does the trick.

Regards, Rob
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest