dzVents equivqlent for LUA script

Subforum for general discussions. Do not dump your questions/problems here, but try to find the subforum where it belongs!

Moderators: leecollings, remb0

Post Reply
BartSr
Posts: 347
Joined: Sunday 03 July 2016 16:16
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.3
Location: Netherlands
Contact:

dzVents equivqlent for LUA script

Post by BartSr »

I tried to use the script from wiki for controlling fan in bathroom. That's 100% LUA.
As I have not a real humidity device but used custom device instead it seems impossible to get the humidity value (%) in a LUA script.
So I wonder if there's a similair dzVents scripts or a workaround to get humidity% in LUA script.

-Bart
Raspberry pi 3b
Arduino
KAKU
RfxCom
Zwave
OTGW
Chinese sensors temp (Dallas),movement
Tasmota
Esp8266 espeasy
MQTT
FlyingDomotic
Posts: 303
Joined: Saturday 27 February 2016 0:30
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: dzVents equivqlent for LUA script

Post by FlyingDomotic »

If you device is a temp + humidity sensor, then sValue is formatted as TEMP;HUM;HUM_STAT where:
- TEMP = Temperature
- HUM = Humidity (0-100 %)
- HUM_STAT = Humidity status is 0=Normal, 1=Comfortable, 2=Dry, 3=Wet

You can extract it with a LUA script like:

Code: Select all

    allValues = otherdevices_svalues["my temp device name"]   -- Get values
    temperature, humidity, humidity_state = allValues:match("([^;]+);([^;]+);([^;]+)") -- Split using ';'
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests