Page 1 of 1

Read text value from one sensor and send to another

Posted: Thursday 29 June 2017 18:37
by LastSamurai
I have two sensors in domoticz that are of the type "General/Text" (based on MySensor nodes). I am trying to write a script that reads the text from sensor1, checks if its part of a list of values and then sends it to sensor 2. This is my code for now:

Code: Select all

return {
        active = true,
        on = {
            '433Receiver'
        },
        execute = function(domoticz, sensor)

            domoticz.log("Received from gateway " .. sensor.state)
            -- check sensor values 
            domoticz.devices['433Sender'].setState(sensor.state)
        end
    }
The text value seems to be in rawData[1], in _sValues and in state. I tried to use setState() but that doesn't seem to be working. The text in the domoticz frontend isn't updated and no message is send to the sensor.

Any help would be great! How can I change and read text sensors?

PS I am using dzVents 1.1.1 I think, haven't updated to 2 yet

Re: Read text value from one sensor and send to another

Posted: Friday 30 June 2017 8:09
by dannybloe
Well, I think this is a classic case of RTFM ;) Device methods. You need the updateText() method to update the text of a text-device.

Give it a try (and upgrade to 2.0 as soon as you can).

Re: Read text value from one sensor and send to another

Posted: Friday 30 June 2017 22:28
by LastSamurai
@dannybloe thank you very much! I did actually read the manual ;) I don't know how I managed to miss that method. It seems to be working fine now, although no update of the values seem to get send to my MySensors node :(

PS The text value gets updated in the normal ui ("counter" tab? I am using the german version) but not in the hardware tab under the gateway details. Might this be a domoticz problem? Or do I just need some other call in LUA?

I will upgrade in the next days to version 2.

Re: Read text value from one sensor and send to another

Posted: Thursday 14 September 2017 18:12
by Archer627
LastSamurai, did you ever find a solution to your PS - i.e.; that the hardware tab values get updated? I have the same problem and am struggling for an alternative to be able to send data to a node. Thanks.

Re: Read text value from one sensor and send to another

Posted: Monday 23 December 2024 7:54
by PeterRozenveld
It does not differ much, I think, what I want.
I am looking for a script , which depending on two power meters (0-3800 Watts Shelly Z-wave) , sets the 0-10Volt Dimmer (Shelly Wifi) to that value percentage-wise as well. (Control Kitchen Extractor) .
But I don't understand most of what is written here !
Can anybody help ?