Page 1 of 1

update temp+humidity+battery

Posted: Wednesday 01 March 2023 15:00
by xavierlp
Hello all

I would like to update a dummy device (Temp+hum)

I could find with the wiki this code and it is ok

Code: Select all

local function update(idx, value1, value2)
        local cmd = string.format("%d|0|%.2f;%.2f", idx, value1, value2) .. ';0' 
        table.insert (commandArray, { ['UpdateDevice'] = cmd } )
 end
 
Now, I would like to add the batterylevel of this device.
But I can't find the way or syntaxe in "UpdateDevice"

Is it possible ?

Thanks a lot

Re: update temp+humidity+battery

Posted: Wednesday 01 March 2023 17:11
by psubiaco
Did you try as I answered to you in the French forum?
It works for me: I can update devices, both temperature and humidity, in that way.

Code: Select all

tempdevice = indoor_device_idx..'|0|'..intemperature..';'..inhumidity..';0'
commandArray[1]={['UpdateDevice'] = tempdevice }

return commandArray

Re: update temp+humidity+battery

Posted: Wednesday 01 March 2023 23:19
by xavierlp
Thank you

Yes I can do it for temp + humidity

But I can’t find the way to add batterylevel

Any clues ?