LUA syntax for textdevice

Moderator: leecollings

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

LUA syntax for textdevice

Post by BartSr »

Hi in dzVents I use syntax for textdevice like:
domoticz.devices(1554).updateText('humidityTmin5: ' .. humidityTmin5)

That's OK. But what's a LUA syntax to update the textdevice?

Why? Well I am trying to use the domoticz LUA script for vent regulation based upon humidity but it fails.
Now I want to monitor the VAR's using a textdevice like:

domoticz.devices(1554).updateText('humidityTmin5: ' .. humidityTmin5 .. 'humidityTmin10: ' .. humidityTmin10 .. 'Humidity delta: ' .. delta .. 'humCounter:' .. humCounter .. 'fanFollowsProgram:' .. fanFollowsProgram )

TIA
-Bart
Raspberry pi 3b
Arduino
KAKU
RfxCom
Zwave
OTGW
Chinese sensors temp (Dallas),movement
Tasmota
Esp8266 espeasy
MQTT
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: LUA syntax for textdevice

Post by waltervl »

Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
habahabahaba
Posts: 190
Joined: Saturday 18 March 2023 14:44
Target OS: Windows
Domoticz version: 2024.4
Contact:

Re: LUA syntax for textdevice

Post by habahabahaba »

Code: Select all

        local device = domoticz.devices(40) --  text device
        local text = 'Str1 <br/>  Str2  <br/> Str3'
      
        local style = '<span style="color: red;">' .. text .. '</span>' 
        device.updateText(style)
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: LUA syntax for textdevice

Post by waltervl »

habahabahaba wrote: Tuesday 07 May 2024 20:04

Code: Select all

        local device = domoticz.devices(40) --  text device
        local text = 'Str1 <br/>  Str2  <br/> Str3'
      
        local style = '<span style="color: red;">' .. text .. '</span>' 
        device.updateText(style)
This is the dzvents syntax, not the Lua syntax.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
BartSr
Posts: 347
Joined: Sunday 03 July 2016 16:16
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.3
Location: Netherlands
Contact:

Re: LUA syntax for textdevice

Post by BartSr »

@Waltervl
Thanks for pointing in direction for solution.
Should someone has converted the dz LUA script already in dzVents?

-Bart
Raspberry pi 3b
Arduino
KAKU
RfxCom
Zwave
OTGW
Chinese sensors temp (Dallas),movement
Tasmota
Esp8266 espeasy
MQTT
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: LUA syntax for textdevice

Post by waltervl »

BartSr wrote: Wednesday 08 May 2024 19:51 @Waltervl
Thanks for pointing in direction for solution.
Should someone has converted the dz LUA script already in dzVents?

-Bart
What script are you talking about? link?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
BartSr
Posts: 347
Joined: Sunday 03 July 2016 16:16
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.3
Location: Netherlands
Contact:

Re: LUA syntax for textdevice

Post by BartSr »

https://www.domoticz.com/wiki/Humidity_control

meanwhile I face strange behaviour with this script (in fact with the fanswitch)
it happened today that the fan got a switch-on command. The fan-switch icon showd fan is running. When I checked the fan itselves it appeared fan was not running.
Than I manually switched off the fan (via dz fan-icon) and switched on again causing the fan to start as expected.

Meanwhile later on same situation. Now I didnot do any thing manual . A few minutes later dz switched off the fan.
Weird control for me...
Raspberry pi 3b
Arduino
KAKU
RfxCom
Zwave
OTGW
Chinese sensors temp (Dallas),movement
Tasmota
Esp8266 espeasy
MQTT
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: LUA syntax for textdevice

Post by waltervl »

Here the equivalent for dzvents is discussed: https://www.domoticz.com/forum/viewtopic.php?t=16765
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests