Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Controllers
  3. Domoticz
  4. Domoticz - soil moisture + one relay = Lua script error (Blockly)

Domoticz - soil moisture + one relay = Lua script error (Blockly)

Scheduled Pinned Locked Moved Domoticz
27 Posts 2 Posters 7.0k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • k5austriaK Offline
    k5austriaK Offline
    k5austria
    wrote on last edited by gohan
    #6
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    // Enable and select radio type attached
    #define MY_RADIO_NRF24
    #define CHILD_ID 0
    
    #include <MySensors.h>
    // Here we are setting up some water thresholds that we will
    // use later. Note that you will need to change these to match
    // your soil type and environment. It doesn't do much for me because I'm using domoticz
    int thresholdUp = 400;
    int thresholdDown = 075;
    MyMessage msg(CHILD_ID, V_LEVEL);
    unsigned long SLEEP_TIME = 30000;
    
    // We are setting up the pin A0 on the redboard to be our sensor
    // pin input:
    int sensorPin = A0;
    
    void presentation()
    {
    present(CHILD_ID, S_MOISTURE);
    }
    
    void loop()
    {
    int sensorValue;
    sensorValue = analogRead(sensorPin);
    
    //send back the values
    send(msg.set(sensorValue));
    // delay until next measurement (msec)
    sleep(SLEEP_TIME);
    }
    
    1 Reply Last reply
    0
    • k5austriaK Offline
      k5austriaK Offline
      k5austria
      wrote on last edited by
      #7

      0_1493474759119_2017-04-29 16_04_55-Domoticz.png

      1 Reply Last reply
      0
      • k5austriaK Offline
        k5austriaK Offline
        k5austria
        wrote on last edited by
        #8

        0_1493475323722_2017-04-29 16_14_21-Domoticz.png

        1 Reply Last reply
        0
        • gohanG Offline
          gohanG Offline
          gohan
          Mod
          wrote on last edited by
          #9

          According to this project, he is using V_HUM and S_HUM. Maybe you could give a try and also include his more advanced features

          1 Reply Last reply
          0
          • k5austriaK Offline
            k5austriaK Offline
            k5austria
            wrote on last edited by
            #10
            This post is deleted!
            1 Reply Last reply
            0
            • gohanG Offline
              gohanG Offline
              gohan
              Mod
              wrote on last edited by
              #11

              What error?

              1 Reply Last reply
              0
              • k5austriaK Offline
                k5austriaK Offline
                k5austria
                wrote on last edited by
                #12
                This post is deleted!
                1 Reply Last reply
                0
                • k5austriaK Offline
                  k5austriaK Offline
                  k5austria
                  wrote on last edited by
                  #13
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • gohanG Offline
                    gohanG Offline
                    gohan
                    Mod
                    wrote on last edited by
                    #14

                    #define CHILD_ID 0 change to CHILD_ID_MOISTURE

                    1 Reply Last reply
                    0
                    • k5austriaK Offline
                      k5austriaK Offline
                      k5austria
                      wrote on last edited by k5austria
                      #15

                      // Enable debug prints to serial monitor
                      #define MY_DEBUG

                      // Enable and select radio type attached
                      #define MY_RADIO_NRF24
                      #define CHILD_ID_MOISTURE 0

                      #include <MySensors.h>
                      // Here we are setting up some water thresholds that we will
                      // use later. Note that you will need to change these to match
                      // your soil type and environment. It doesn't do much for me because I'm using domoticz
                      int thresholdUp = 400;
                      int thresholdDown = 075;
                      MyMessage msg(CHILD_ID_MOISTURE, S_HUM);
                      unsigned long SLEEP_TIME = 30000;

                      // We are setting up the pin A0 on the redboard to be our sensor
                      // pin input:
                      int sensorPin = A0;

                      void presentation()
                      {
                      present(CHILD_ID_MOISTURE, S_HUM);
                      }

                      void loop()
                      {
                      int sensorValue;
                      sensorValue = analogRead(sensorPin);

                      //send back the values
                      send(msg.set(sensorValue));
                      // delay until next measurement (msec)
                      sleep(SLEEP_TIME);
                      }

                      1 Reply Last reply
                      0
                      • k5austriaK Offline
                        k5austriaK Offline
                        k5austria
                        wrote on last edited by
                        #16
                        This post is deleted!
                        1 Reply Last reply
                        0
                        • gohanG Offline
                          gohanG Offline
                          gohan
                          Mod
                          wrote on last edited by
                          #17

                          #define CHILD_ID_MOISTURE 0

                          You always need to specify a value

                          1 Reply Last reply
                          0
                          • k5austriaK Offline
                            k5austriaK Offline
                            k5austria
                            wrote on last edited by
                            #18
                            This post is deleted!
                            1 Reply Last reply
                            0
                            • gohanG Offline
                              gohanG Offline
                              gohan
                              Mod
                              wrote on last edited by
                              #19

                              5th row of your code

                              1 Reply Last reply
                              0
                              • k5austriaK Offline
                                k5austriaK Offline
                                k5austria
                                wrote on last edited by
                                #20
                                This post is deleted!
                                1 Reply Last reply
                                0
                                • k5austriaK Offline
                                  k5austriaK Offline
                                  k5austria
                                  wrote on last edited by
                                  #21
                                  This post is deleted!
                                  1 Reply Last reply
                                  0
                                  • k5austriaK Offline
                                    k5austriaK Offline
                                    k5austria
                                    wrote on last edited by
                                    #22
                                    This post is deleted!
                                    1 Reply Last reply
                                    0
                                    • k5austriaK Offline
                                      k5austriaK Offline
                                      k5austria
                                      wrote on last edited by k5austria
                                      #23

                                      Sensor logs on to Gateway only with original sketch. Other sketchs can be quite normal uploaded to Arduino but remains for GW invisible.

                                      1 Reply Last reply
                                      0
                                      • gohanG Offline
                                        gohanG Offline
                                        gohan
                                        Mod
                                        wrote on last edited by
                                        #24

                                        Pls post node serial output when not connecting to the gateway

                                        1 Reply Last reply
                                        0
                                        • k5austriaK Offline
                                          k5austriaK Offline
                                          k5austria
                                          wrote on last edited by gohan
                                          #25
                                          0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
                                          3 TSM:INIT
                                          4 TSF:WUR:MS=0
                                          11 TSM:INIT:TSP OK
                                          13 TSF:SID:OK,ID=2
                                          14 TSM:FPAR
                                          51 TSF:MSG:SEND,2-2-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                                          775 TSF:MSG:READ,0-0-2,s=255,c=3,t=8,pt=1,l=1,sg=0:0
                                          780 TSF:MSG:FPAR OK,ID=0,D=1
                                          2058 TSM:FPAR:OK
                                          2059 TSM:ID
                                          2060 TSM:ID:OK
                                          2062 TSM:UPL
                                          2065 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1
                                          2074 TSF:MSG:READ,0-0-2,s=255,c=3,t=25,pt=1,l=1,sg=0:1
                                          2079 TSF:MSG:PONG RECV,HP=1
                                          2081 TSM:UPL:OK
                                          2083 TSM:READY:ID=2,PAR=0,DIS=1
                                          2087 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
                                          2095 TSF:MSG:READ,0-0-2,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
                                          2102 TSF:MSG:SEND,2-2-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.1.1
                                          2110 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0
                                          2123 TSF:MSG:READ,0-0-2,s=255,c=3,t=6,pt=0,l=1,sg=0:M
                                          2132 TSF:MSG:SEND,2-2-0-0,s=0,c=0,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
                                          2139 MCO:REG:REQ
                                          2146 TSF:MSG:SEND,2-2-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2
                                          2152 TSF:MSG:READ,0-0-2,s=255,c=3,t=27,pt=1,l=1,sg=0:1
                                          2157 MCO:PIM:NODE REG=1
                                          2160 MCO:BGN:INIT OK,TSP=1
                                          2168 TSF:MSG:SEND,2-2-0-0,s=0,c=1,t=1,pt=2,l=2,sg=0,ft=0,st=OK:413
                                          2174 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
                                          2180 MCO:SLP:TPD
                                          2182 MCO:SLP:WUP=-1
                                          2189 TSF:MSG:SEND,2-2-0-0,s=0,c=1,t=1,pt=2,l=2,sg=0,ft=0,st=OK:412
                                          2195 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
                                          2200 MCO:SLP:TPD
                                          2202 MCO:SLP:WUP=-1
                                          2209 TSF:MSG:SEND,2-2-0-0,s=0,c=1,t=1,pt=2,l=2,sg=0,ft=0,st=OK:412
                                          2214 MCO:SLP:MS=30000,SMS=0,I1=255,M1=255,I2=255,M2=255
                                          2220 MCO:SLP:TPD
                                          
                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          21

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular