Search found 734 matches

by manjh
Friday 14 March 2025 9:38
Forum: DIY Hardware and Protocols
Topic: Nodo Project (Arduino mega ethernet solution)
Replies: 3
Views: 3302

Re: Nodo Project (Arduino mega ethernet solution)

Does anyone still have documentation of the Nodo? Commands, syntax, that sort of thing?
I cannot access any of the old websites!
by manjh
Wednesday 12 March 2025 8:13
Forum: Python
Topic: Python Plugin: Toyota
Replies: 3
Views: 1027

Re: Python Plugin: Toyota

Other question. I expect delivery of a new RAV4 PHEV in the next few weeks, and obviously would like to link it to my Domoticz.
Does anyone have experience using this plugin on a PHEV?
by manjh
Wednesday 12 March 2025 8:12
Forum: Python
Topic: Python Plugin: Toyota
Replies: 3
Views: 1027

Re: Python Plugin: Toyota

Has this problem been solved?
by manjh
Wednesday 12 March 2025 8:09
Forum: Examples & Solutions
Topic: How-to: launch action after a certain time [SOLVED]
Replies: 12
Views: 3592

Re: How-to: launch action after a certain time [SOLVED]

What if someone opens the hot water tap for 25 seconds? And again, and again? Eventually it would leave the boiler cold!
I know it may sound unlikely, but you should code for the worst...
by manjh
Tuesday 18 February 2025 16:31
Forum: dzVents
Topic: Why is dzvents device lookup using name instead of idx
Replies: 15
Views: 786

Re: Why is dzvents device lookup using name instead of idx

But hey, this is what we have to live with here in Domoticz. I fully agree. Once you get to work with Domoticz in a bit lower and technical detail, you will find peculiarities. It shows that Domoticz was developed in an organic way, as a hobby project; not as a professionally designed software ...
by manjh
Thursday 13 February 2025 14:57
Forum: LUA
Topic: Is there a select statement?
Replies: 11
Views: 2551

Re: Is there a select statement?

Why run through all changed variables, instead of return { on = { variables = { 'NFC' } }, execute = function(dz, item) ... do stuff end } This is dzvents, I wanted to stick to pure LUA... But you're right. Instead of looping through the whole list of uservariables, I could just check for ...
by manjh
Thursday 13 February 2025 12:57
Forum: LUA
Topic: Is there a select statement?
Replies: 11
Views: 2551

Re: Is there a select statement?

For everyone that is interested, I found an elegant way to solve my coding problem. It starts with a UserVariable that contains an integer value. For each unique value of that UserVariable, I create a function, called NFCn. This is the code to call the right function, based on the uservariable ...
by manjh
Friday 07 February 2025 9:08
Forum: LUA
Topic: Is there a select statement?
Replies: 11
Views: 2551

Re: Is there a select statement?

If - elseif: local x = 2 -- Example value if x == 1 then -- Code to execute when x is 1 print("x is 1") elseif x == 2 then -- Code to execute when x is 2 print("x is 2") else -- Code to execute for all other cases print("x is something else") end or: local x = 2 -- Example value local actions ...
by manjh
Thursday 06 February 2025 13:39
Forum: LUA
Topic: Is there a select statement?
Replies: 11
Views: 2551

Re: Is there a select statement?

jvdz wrote: Thursday 06 February 2025 9:13 Can't you simply store them in an array using the number as key? That way you should be able to get the command with array[key].
Not sure what you mean. Store what in an array? Get what command?
Could you give a small example?
by manjh
Thursday 06 February 2025 8:57
Forum: LUA
Topic: Is there a select statement?
Replies: 11
Views: 2551

Re: Is there a select statement?

Maybe I should explain the purpose I wanted this for. I use a UserVariable to store a value, coming out of a number of NFC sources. Each value represents a specific command: like "turn on lights", "turn off ventilation", "toggle driveway spotlight", etcetera. My routine picks up that uservariable ...
by manjh
Wednesday 05 February 2025 8:28
Forum: LUA
Topic: Is there a select statement?
Replies: 11
Views: 2551

Is there a select statement?

Hopefully there is a simple answer to this... In other programming languages I can use the select statement to execute parts of code depending on content of a variable. For instance: Assume variable x has a numeric value. Select (x) when (1) do ... end when (2) do ... end otherwise ... end end I ...
by manjh
Sunday 12 January 2025 22:49
Forum: Zigbee
Topic: how to read "electric" values from smartplug
Replies: 4
Views: 211

Re: how to read "electric" values from smartplug

I am not using Lua but dzvents but it seems the 1280 is the total value. With dzvents you can get the today value directly. With Lua I have no idea how to do that, but probably it can be calculated. Ah, that looks promising. Would you be willing to post the dzvents script to pull the information ...
by manjh
Sunday 12 January 2025 17:43
Forum: Zigbee
Topic: how to read "electric" values from smartplug
Replies: 4
Views: 211

how to read "electric" values from smartplug

I have a number of Zigbee smartplugs with energy metering function. They work OK, but I am having a bit of trouble trying to extract values. When I look at the Domoticz device,, it shows: "Today: 0.310 kWh". But when I extract the values in a LUA script (using otherdevices), I get "0.0;1280". What ...
by manjh
Friday 10 January 2025 8:38
Forum: LUA
Topic: return multiple values from function
Replies: 7
Views: 311

Re: return multiple values from function

This should work fine assuming the parameters are all given a value function ExtractElectrics(dev_switch, dev_volt, dev_watt, dev_kwh) return dev_switch, dev_volt, dev_watt, dev_kwh end if there is a change that one is nil you could set the default like this: function ExtractElectrics(dev_switch ...
by manjh
Thursday 09 January 2025 19:47
Forum: LUA
Topic: return multiple values from function
Replies: 7
Views: 311

Re: return multiple values from function

jvdz wrote: Thursday 09 January 2025 18:32 Multiple values are supported, but in the posted example the 2nd-4h variable will be "nil" since the right-hand side function of the "=" only has one value.
I think it always has worked like this in lua.
So how would the statement look according to you?
by manjh
Thursday 09 January 2025 18:27
Forum: Zigbee
Topic: Zigbee device: no reliable lastupdate
Replies: 11
Views: 380

Re: Zigbee device: no reliable lastupdate

Meanwhile I have looked a little deeper into car tracking devices. There is a very good ST-901L tracker for sale at Ali for only about €23, I've ordered it already. Add a simple SIM (€6) with a data-only prepaid bundle (€2/year), and the car is not only visible on the driveway but wherever the thiev ...
by manjh
Thursday 09 January 2025 18:18
Forum: LUA
Topic: return multiple values from function
Replies: 7
Views: 311

Re: return multiple values from function

OK, so this version of LUA does not follow the general rule that multiple return values are supported.
I guess I'll circumvent by putting the values into an array and return that.
by manjh
Thursday 09 January 2025 15:24
Forum: LUA
Topic: return multiple values from function
Replies: 7
Views: 311

return multiple values from function

According to https://stackoverflow.com/questions/63044739/functions-that-return-multiple-values-lua I can return multiple values from a single function call. But when I try, I get an error. this is the skeleton for the function: function ExtractElectrics(dev_switch, dev_volt, dev_watt, dev_kwh ...
by manjh
Wednesday 08 January 2025 17:52
Forum: Zigbee
Topic: Zigbee device: no reliable lastupdate
Replies: 11
Views: 380

Re: Zigbee device: no reliable lastupdate

waltervl wrote: Tuesday 07 January 2025 18:47
The 5min value is a Domoticz setting. By default Domoticz will copy the value of there was no real update. There is a setting that prevents that copying, menu Setup - Settings, tab log history.
Got it. Makes me wonder why it should copy values, even when they are not "new"?
by manjh
Wednesday 08 January 2025 17:46
Forum: Zigbee
Topic: Zigbee device: no reliable lastupdate
Replies: 11
Views: 380

Re: Zigbee device: no reliable lastupdate

Some more info. I looked at the log info for the device (Zigbee hum&temp sensor) and see in the graph that there is a value entry every 5 minutes. The 5min value is a Domoticz setting. By default Domoticz will copy the value of there was no real update. There is a setting that prevents that copying ...