Search found 38 matches

by RvdM
Monday 24 May 2021 17:15
Forum: dzVents
Topic: Map one range of numbers to another
Replies: 5
Views: 476

Re: Map one range of numbers to another

Solved niveau = tonumber(domoticz.devices('Plant - CrotonPetra - WaterNiveau').state) I also changed the function so it equals how the function in C++ works local function map(n, w, x, y, z, decimals) if n > x or n < w then return 'out of range' end -- protect range local integer = type(decimals ...
by RvdM
Monday 24 May 2021 16:45
Forum: dzVents
Topic: Map one range of numbers to another
Replies: 5
Views: 476

Re: Map one range of numbers to another

Yes thats it.. but I still get an error 2021-05-24 16:44:00.518 Error: dzVents: Error: (3.1.8) test: ...v-domoticz/scripts/dzVents/generated_scripts/ScriptT.lua:21: attempt to compare number with string execute = function(domoticz, triggeredItem, info) local tMap = { 0, 48, 0, 100 } local function ...
by RvdM
Sunday 23 May 2021 21:08
Forum: dzVents
Topic: Map one range of numbers to another
Replies: 5
Views: 476

Re: Map one range of numbers to another

Perhaps i'm doing something wrong but this doesn't work. 2021-05-23 21:22:00.479 Error: dzVents: Error: (3.1.8) test: ...v-domoticz/scripts/dzVents/generated_scripts/ScriptT.lua:25: attempt to concatenate a nil value (local 'test') return { active = { true, }, on = { timer = { 'every minute ...
by RvdM
Sunday 23 May 2021 20:22
Forum: dzVents
Topic: Map one range of numbers to another
Replies: 5
Views: 476

Map one range of numbers to another

With C++ there is a map function which is able to map one range of numbers to another. An example is like this: int percentage = map(300, 500, 0, 100); 300 equals 0 and 500 equals 100 which makes it easy to calculate things like for example percentages. Is this possible with lua as well because I ...
by RvdM
Sunday 02 May 2021 15:31
Forum: dzVents
Topic: Milliseconds since epoch timestamp
Replies: 4
Views: 1192

Re: Milliseconds since epoch timestamp

There is no native Lua / dzVents method to get this. From the OS you can get nanoseconds so you can use something like below. I must say waaren; it always amazes me how you are able to always answer the questions from the community. Thank you very much! :!: I had to make a small adjustment to the ...
by RvdM
Saturday 01 May 2021 21:22
Forum: dzVents
Topic: Milliseconds since epoch timestamp
Replies: 4
Views: 1192

Re: Milliseconds since epoch timestamp

Also tried this;

Code: Select all

        local timestamp = os.execute('echo $((`date +%s`*1000+`date +%-N`/1000000))')
But this returns "true"
by RvdM
Saturday 01 May 2021 21:07
Forum: dzVents
Topic: Milliseconds since epoch timestamp
Replies: 4
Views: 1192

Milliseconds since epoch timestamp

Hi, For the grafana API I need the ' epoch datetime in milliseconds ' as timestamp. However domoticz.time.dDate gives me the timestamp in seconds since epoch. How to get the milliseconds variant? ... [ output truncated ] ... local timestamp = domoticz.time.dDate domoticz.log(timestamp) domoticz ...
by RvdM
Tuesday 27 April 2021 13:39
Forum: dzVents
Topic: Random lights turning on and off while on vacation
Replies: 7
Views: 1967

Re: Random lights turning on and off while on vacation

For future reference for people that come across this post and do not want to script: There is also the Random timer setting that can be used on Domoticz timer plans . So with this you can create an holiday timer plan with lights that switch on/off in a random time frame (+/- the random timer ...
by RvdM
Tuesday 27 April 2021 13:36
Forum: dzVents
Topic: Random lights turning on and off while on vacation
Replies: 7
Views: 1967

Re: Random lights turning on and off while on vacation

Script could look like below. This is amazing. Thank you for writing the core of the script. I've made some small adjustments and put some comments at the top. Added female behavioral simulation :lol: -- Script written by Waaren and modified bij RvdM -- https://www.domoticz.com/forum/viewtopic.php ...
by RvdM
Monday 26 April 2021 13:42
Forum: dzVents
Topic: Random lights turning on and off while on vacation
Replies: 7
Views: 1967

Random lights turning on and off while on vacation

For my holiday plans I would like to make a dzVents script that will randomly turn on light and off when we're not at home. Now I already have a dzVents script that will turn on and off light but I was thinking something like turning a light on in the hall, driveway, toilet, or bedroom based on a ...
by RvdM
Sunday 21 March 2021 3:17
Forum: Z-Wave
Topic: Fixing Z-Wave for once and for all!
Replies: 218
Views: 41258

Re: Fixing Z-Wave for once and for all!

Oh my... Am I glad i stumbled on to this post. Since last year it is nothing but trouble with my domoticz-zwave setup. Devices go unknown.. have to refresh the devices once every few weeks and sometimes this resolve things.. and sometimes the only thing I can do is just wait a couple of days. (not ...
by RvdM
Wednesday 03 June 2020 0:06
Forum: dzVents
Topic: Philips Hue Cold and Warm white [Solved]
Replies: 18
Views: 2914

Re: Philips Hue Cold and Warm white [Solved]

waaren wrote: Tuesday 02 June 2020 23:38
RvdM wrote: Tuesday 02 June 2020 23:00 Steep learning curve... what is the best way to debug these scripts because the web-editor only catches some typo and stuff.

Would like to see something like: Error found on line: 13...
You will see syntax errors in the log if you enable logging in the settings.

errors.png
My hero!
by RvdM
Tuesday 02 June 2020 23:00
Forum: dzVents
Topic: Philips Hue Cold and Warm white [Solved]
Replies: 18
Views: 2914

Re: Philips Hue Cold and Warm white [Solved]

Steep learning curve... what is the best way to debug these scripts because the web-editor only catches some typo and stuff.

Would like to see something like: Error found on line: 13...
by RvdM
Tuesday 02 June 2020 22:38
Forum: dzVents
Topic: Philips Hue Cold and Warm white [Solved]
Replies: 18
Views: 2914

Re: Philips Hue Cold and Warm white [Solved]

Fixed by filling in the Networks field. Strange isnt it?
by RvdM
Tuesday 02 June 2020 22:17
Forum: dzVents
Topic: Philips Hue Cold and Warm white [Solved]
Replies: 18
Views: 2914

Re: Philips Hue Cold and Warm white [Solved]

Another problem I found with the following script. The brightness works but the setKelvin does not. In the logging the url mentioned does work when using it with curl from CLI. Sorry but I cannot replicate it. if I try this on my system it works without a problem and the setKelvin command has not ...
by RvdM
Tuesday 02 June 2020 20:43
Forum: dzVents
Topic: Philips Hue Cold and Warm white [Solved]
Replies: 18
Views: 2914

Re: Philips Hue Cold and Warm white [Solved]

Another problem I found with the following script. The brightness works but the setKelvin does not. In the logging the url mentioned does work when using it with curl from CLI. local allDevices = { 'Keuken spot 1', 'Keuken spot 2', 'Keuken spot 3', 'Keuken spot 4', 'Keuken spot 5', 'Keuken spot 6 ...
by RvdM
Monday 01 June 2020 23:23
Forum: dzVents
Topic: Why does this dzVents script not work [Solved]
Replies: 16
Views: 1839

Re: Why does this dzVents script not work [Solved]

Just started up the old machine and the code looks like this return { active = true, on = { ['timer'] = {'at 18:30'} }, execute = function(domoticz) domoticz.log('Ventilatie op post-kookstand') domoticz.devices('Mechanische Ventilatie').switchSelector(domoticz.variables ...
by RvdM
Monday 01 June 2020 23:17
Forum: dzVents
Topic: Philips Hue Cold and Warm white [Solved]
Replies: 18
Views: 2914

Re: Philips Hue Cold and Warm white [Solved]

Any idea @waaren?
by RvdM
Monday 01 June 2020 23:16
Forum: dzVents
Topic: Why does this dzVents script not work [Solved]
Replies: 16
Views: 1839

Re: Why does this dzVents script not work [Solved]

That indeed was the probleem. No sure why it worked in older versions of Domoticz because this script was from a post 2020 release
by RvdM
Monday 01 June 2020 22:53
Forum: dzVents
Topic: Why does this dzVents script not work [Solved]
Replies: 16
Views: 1839

Re: Why does this dzVents script not work [Solved]

See attached, and no its not set to 50