Hello, After adding succesfully sensors like LDR and BMP180 I would like to do something with the values coming from these sensors. Where possible I would prefer to keep this "basic and easy to understand", so if possible no MQTT or Blockly or similar protocols for now.
I thought about adding relay card that will switch when the sensors reach a certain level, and also I have been looking if the "notifications" option in Domoticz can be helpful for this, but did not find a solution yet. I would like for example that a relay will turn on when the LDR value is reaching let's 90 Lux, or when the BPM180 is reaching 20 degree celcius.
Looking forward to suggestions
Switch something with sensor values
Moderators: leecollings, remb0
-
- Posts: 3
- Joined: Thursday 10 January 2019 3:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
- psubiaco
- Posts: 222
- Joined: Monday 20 August 2018 9:38
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Italy
- Contact:
Re: Switch something with sensor values
Hi,
I suggest to write a LUA or dzEvenet script for this.
Making a script from Domoticz user interface is quite simple: Domoticz already prepare you a script draft with several information.
Then, when scripting becomes familiar for you, you'll ready to do great jobs with Domoticz + scripting.
For example, in my house I have a LUA script that manages about 60 magnetic contact sensors, some PIRs, and sirens, to get a complete burglar alarm system.
Another LUA script that manages heating/cooling optimizing the heat pump power consumption and improving the own-consumption (I have a photovoltaic system on the roof).
You can find those scripts at https://github.com/CreasolTech/domoticz_lua_scripts
In your case, if you'd like to try to make a lua script, just create a sample LUA script in domoticz: Setup -> More options -> Event
then click on + icon and select Lua -> Time (script executed every 1 minute: or Lua -> Device if you want a script executed when LUX device changes)
The script should be something like this:
When the sensor named "LUX" has value >=90 and the device "RELAY" is off, send command to Domoticz to activate device named "RELAY"
Very simple!
Good luck
I suggest to write a LUA or dzEvenet script for this.
Making a script from Domoticz user interface is quite simple: Domoticz already prepare you a script draft with several information.
Then, when scripting becomes familiar for you, you'll ready to do great jobs with Domoticz + scripting.
For example, in my house I have a LUA script that manages about 60 magnetic contact sensors, some PIRs, and sirens, to get a complete burglar alarm system.
Another LUA script that manages heating/cooling optimizing the heat pump power consumption and improving the own-consumption (I have a photovoltaic system on the roof).
You can find those scripts at https://github.com/CreasolTech/domoticz_lua_scripts
In your case, if you'd like to try to make a lua script, just create a sample LUA script in domoticz: Setup -> More options -> Event
then click on + icon and select Lua -> Time (script executed every 1 minute: or Lua -> Device if you want a script executed when LUX device changes)
The script should be something like this:
Code: Select all
commandArray = {}
if (otherdevices["LUX"]>=90 and otherdevices["RELAY"]=='Off') then
commandArray["RELAY"]="On"
end
return commandArray
Very simple!
Good luck
Paolo
--
I use DomBus modules to charge EV car, get a full alarm system, control heat pump, fire alarm detection, lights and much more. Video
Facebook page - Youtube channel
--
I use DomBus modules to charge EV car, get a full alarm system, control heat pump, fire alarm detection, lights and much more. Video
Facebook page - Youtube channel
-
- Posts: 3
- Joined: Thursday 10 January 2019 3:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Switch something with sensor values
Thank you very much psubiaco! Happy to re-read your suggestions and give it a try.
I've been struggling to get the sensors working, that means to have the values displayed in Domoticz, even if I followed examples. Some online examples are not complete because some go in their examples from the viewpoint that the other one reading/watching them knows already what to do, but that is not always the case. In that sort of cases there is in the user manual often a service or help desk you can call if you still don't know what to do. Asuming that the service or help desk knows the proper answer it will be ok, otherwise...lol. But YouTube or other examples online don't come with a service or help desk you can call, which means after all you have to find out for yourself.
After all the positive side of this is that once you learn something you won't forget it that easily! 
Since this spring season is not really spring, but more like 4 seasons in 1 day it is the perfect moment to stay inside and give this a try.
I also found the scripts page you have been refering to, thank you.

I've been struggling to get the sensors working, that means to have the values displayed in Domoticz, even if I followed examples. Some online examples are not complete because some go in their examples from the viewpoint that the other one reading/watching them knows already what to do, but that is not always the case. In that sort of cases there is in the user manual often a service or help desk you can call if you still don't know what to do. Asuming that the service or help desk knows the proper answer it will be ok, otherwise...lol. But YouTube or other examples online don't come with a service or help desk you can call, which means after all you have to find out for yourself.


Since this spring season is not really spring, but more like 4 seasons in 1 day it is the perfect moment to stay inside and give this a try.
I also found the scripts page you have been refering to, thank you.
- psubiaco
- Posts: 222
- Joined: Monday 20 August 2018 9:38
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Italy
- Contact:
Re: Switch something with sensor values
It's not easy to write good documentation... often people search for info in various post, then when they find the right answer that solve their problem, they forget to share that answer in other threads, so another people looking for that answer also needs to read several threads before finding the right answer. This is the life...
I can renew my invite to learn scripting... maybe it's not trivial, but it's very useful!!
Regards.
Paolo
I can renew my invite to learn scripting... maybe it's not trivial, but it's very useful!!
Regards.
Paolo
Paolo
--
I use DomBus modules to charge EV car, get a full alarm system, control heat pump, fire alarm detection, lights and much more. Video
Facebook page - Youtube channel
--
I use DomBus modules to charge EV car, get a full alarm system, control heat pump, fire alarm detection, lights and much more. Video
Facebook page - Youtube channel
Who is online
Users browsing this forum: Bing [Bot] and 1 guest