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 8.9k 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
    #1

    Hi ,

    I want to link with blocky one soil moisture sensor and one Relay , but it always comes error message. I use MySensors hardware.
    Very simple but not work ?!

    https://www.domoticz.com/forum/viewtopic.php?f=62&t=17211

    My blueberries need soon the water. Please help me ! :?

    Thanks !

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

      Did you try to make some other rules involving either soil sensor or relay and see if error follows the soil sensor?

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

        Hi ,
        thank you for your answer . I have tried others rules with relay and time. Everything works. Only if Moisture value is in function , come error message.

        2017-04-24 21:46:05.283 Error: EventSystem: Lua script error (Blockly), Name: soil moisture_1 => [string "result = 0; weekday = os.date('*t')['wday']; ..."]:1: attempt to index global 'utilitydevice' (a nil value)

        I have no experience with this thing i currently have no idea :disappointed:

        It would be good if works

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

          How do you present the soil sensor? Maybe I can try to replicate your error

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

            Sorry !!! I have not seen your answer again !
            I tried everything but it did not work. The problem is value from soil moisture sensor . I think so !?
            If you fix the problem you have a drink from me :grinning:
            5_1493474335770_2017-04-29 15_46_39-Domoticz.png 4_1493474335769_2017-04-29 15_46_03-Domoticz.png 3_1493474335768_2017-04-29 15_44_25-Domoticz.png 2_1493474335767_2017-04-29 15_44_11-Domoticz.png 1_1493474335765_2017-04-29 15_43_47-Domoticz.png 0_1493474335763_2017-04-29 15_43_25-Domoticz.png

            1 Reply Last reply
            0
            • 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

                                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                          With your input, this post could be even better 💗

                                          Register Login
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          15

                                          Online

                                          12.0k

                                          Users

                                          11.2k

                                          Topics

                                          113.4k

                                          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