Light level sensor add to Domoticz



  • I created a light_level sensor and now I want to use it as a sensor in Domoticz (use it to turn the lights on on an certain light level). I have no clue how get it in place. I read about the creation of a dummy hardware, what I did. Now I don't know anymore. The light level sensor is already visible in the device list of domoticz.


  • Hardware Contributor

    You dont need a dummy switch - you need a switch that controlls your light. Then you create some rules either in LUA or in blockly.
    Here is my light scripts from LUA (my lightlevel is named utomhusljus and my group with windowlights is called "fonsterlampor"):

    commandArray = {}
    v = tonumber(otherdevices_svalues['Utomhusljus'])
    
    if  (v <= 30)) then 
    commandArray['Group:Fonsterlampor']='On'
    end
    
    return commandArray
    

    You need to code it more than this, (for example they should not be turned off after midnight or when you go to sleep) so you might need to add more variables, like current time or something.

    For example this will turn on the group "Fonsterlampor" but not later than 21:50 or earlier than 4:59:

    commandArray = {}
    v = tonumber(otherdevices_svalues['Utomhusljus'])
    h = tonumber((os.date('%H')))
    
    if  (v <= 30 and h < 22 and h >= 5) then 
    commandArray['Group:Fonsterlampor']='On'
    end
    
    return commandArray
    

    You can also use blockly as I said. It should be easier, you find it in the menu but I have no knowledge about that. Google domoticz blockly tutorial or something.



  • Thank you to give me a push in the right direction. I gonna use Blocky.
    Have a nice day and I can go on with my build



  • I read about blocky for domoticz. It looks easy but my first steps are not so easy. I opened in "more options" the option "events", in events I select a "Control" (if/Do), also a "Logic" (>-), a "device " (temperature). In this beginning fase I am not able to connect temp device to the Logic. Anybody recognize this?


Log in to reply
 

Suggested Topics

  • 5
  • 5
  • 1
  • 5
  • 2
  • 2

22
Online

11.2k
Users

11.1k
Topics

112.5k
Posts