Lua for Domoticz for beginners

Moderator: leecollings

Post Reply
DomoticaRob
Posts: 80
Joined: Sunday 29 November 2015 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.9700
Location: Halle, the Netherlands
Contact:

Lua for Domoticz for beginners

Post by DomoticaRob »

I am using Domoticz for a while and I want to make it more clever with scripts, in this case Lua scripts. What I miss is a step by step tutorial Lua for Domoticz for beginners.
If somebody places a question on the forum than mostly there comes an answer for profs, too difficult. At the end of the day a lot of people are searching through the forum topics in the hope to find something that can help. I have the idea that a lot of beginners have these struggle and that can end in that he can solve his problem/question or that he thinks, I just leave it like that, I don’t want that struggle. That’s a pitty.
This situation is not only with Domoticz. I have also used Nodo and Cayenne. Both have the same problems. Experienced users can help each other, but the beginners are walking through the amount of topics on the forums without finding the proper answer.

Is it possible that we start making that tutorial for beginners in a very practical step by step way?

For now I have the following situation:

On my dashboard I want to have a slider to give in the desirable temperature. In that room I want to have a wireless temperature sensor. In a script I want to compare the desirable temperature with the measured temperature. The outcome of this gives a signal to a wireless relais board that switch a actuator on a floor heating distributer. I want to do this low cost, so no expensive thermostate or control box. Just a temperature sensor like DHT22, a ESP8266 Wifi board, a relais board and so on.

In Domoticz I made a slider.

How can I change the lowest value, the highest value and the startup value? Let say: the slider totally to the left is 10 ’C, the slider totally to the right is 30 ‘C.
How can I change the % symbol into ‘C symbol?
How do I read out the value of the slider?

Please an answer in beginners language.
Slider.png
Slider.png (29.12 KiB) Viewed 9362 times
Nautilus
Posts: 722
Joined: Friday 02 October 2015 12:12
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Finland
Contact:

Re: Lua for Domoticz for beginners

Post by Nautilus »

Hi,

I think the wiki is our beginners guide - which as such can and should be improved in various ways (kept up-to-date at least). But also in its current form it serves as a good starting point also for beginners, e.g. https://www.domoticz.com/wiki/Events#Lu ... _Interface

For you specific questions, I'm afraid these aren't to Lua in any way:
How can I change the lowest value, the highest value and the startup value? Let say: the slider totally to the left is 10 ’C, the slider totally to the right is 30 ‘C.
How can I change the % symbol into ‘C symbol?
They are attributes fixed to the user interface and unfortunately not something you can change, with or without scripting. As for the last question (and something that solves also the two questions above), I think you are actually looking for a virtual thermostat device. I don't use any myself but there should be a lot of threads about it already. And as for the "beginners guide", I hope this helps a bit: https://www.domoticz.com/wiki/Thermostat_control But note, there might be some outdated parts, e.g.

Code: Select all

 if (devicechanged[sonde]) then
         local temperature = devicechanged[string.format('%s_Temperature', sonde)]
I think this can be just:

Code: Select all

 if devicechanged[sonde..'_Temperature'] then
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Lua for Domoticz for beginners

Post by emme »

my opinion is that if you want to start scripting in Domoticz, you'd better give a try to dzVents

here's a quick start guide that you will find interesting
http://domoticz.com/forum/viewtopic.php?f=59&t=18143

good luck
M
The most dangerous phrase in any language is:
"We always done this way"
DomoticaRob
Posts: 80
Joined: Sunday 29 November 2015 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.9700
Location: Halle, the Netherlands
Contact:

Re: Lua for Domoticz for beginners

Post by DomoticaRob »

Hello Emme,

Thank you for your suggestion about dzVents. I gave it a quick look and will take some time to figger it out.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest