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. Troubleshooting
  3. if use sleep() the node can't receive message?

if use sleep() the node can't receive message?

Scheduled Pinned Locked Moved Troubleshooting
9 Posts 4 Posters 3.5k 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.
  • Magic WM Offline
    Magic WM Offline
    Magic W
    wrote on last edited by
    #1

    If i use sleep(3000) function in loop(),It can't recieve message from controller?
    the log is:
    2016/7/27 0:29:20 RX 0;255;3;0;9;!TSP:MSG:SEND 0-0-1-1 s=5,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=fail:5 (i test it on MYSCtroller).

    if remove the sleep() function,and use delay() funtion the node can receive the message!

    Talat KeleşT T A 3 Replies Last reply
    0
    • Magic WM Magic W

      If i use sleep(3000) function in loop(),It can't recieve message from controller?
      the log is:
      2016/7/27 0:29:20 RX 0;255;3;0;9;!TSP:MSG:SEND 0-0-1-1 s=5,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=fail:5 (i test it on MYSCtroller).

      if remove the sleep() function,and use delay() funtion the node can receive the message!

      Talat KeleşT Offline
      Talat KeleşT Offline
      Talat Keleş
      wrote on last edited by
      #2

      @Magic-W
      sleep() function is powering down both rf radio and arduino, therefore no way to get messages during that time. Maybe you can wake frequently and wait a brief time to check if any messages coming while gw sending messages for a few times repeatedly. I read this kind of thing on forum I guess it was about battery actuator.

      Meanwhile using delay() isn't that good since it is a blocking function, prefer wait() since it runs process() on background.

      1 Reply Last reply
      1
      • Magic WM Magic W

        If i use sleep(3000) function in loop(),It can't recieve message from controller?
        the log is:
        2016/7/27 0:29:20 RX 0;255;3;0;9;!TSP:MSG:SEND 0-0-1-1 s=5,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=fail:5 (i test it on MYSCtroller).

        if remove the sleep() function,and use delay() funtion the node can receive the message!

        T Offline
        T Offline
        tekka
        Admin
        wrote on last edited by
        #3

        @Magic-W Of course, a sleeping node is by definition not able to receive and process incoming messages.

        Magic WM 1 Reply Last reply
        0
        • T tekka

          @Magic-W Of course, a sleeping node is by definition not able to receive and process incoming messages.

          Magic WM Offline
          Magic WM Offline
          Magic W
          wrote on last edited by
          #4

          @tekka Thank you for your reply.!

          T 1 Reply Last reply
          0
          • Magic WM Magic W

            @tekka Thank you for your reply.!

            T Offline
            T Offline
            tekka
            Admin
            wrote on last edited by
            #5

            @Magic-W if you substitute delay() and sleep() to wait(), the node will process incoming messages.

            Magic WM 1 Reply Last reply
            0
            • Magic WM Magic W

              If i use sleep(3000) function in loop(),It can't recieve message from controller?
              the log is:
              2016/7/27 0:29:20 RX 0;255;3;0;9;!TSP:MSG:SEND 0-0-1-1 s=5,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=fail:5 (i test it on MYSCtroller).

              if remove the sleep() function,and use delay() funtion the node can receive the message!

              A Offline
              A Offline
              AWI
              Hero Member
              wrote on last edited by AWI
              #6

              @Magic-W When you have some control over what you want to receive and when you can trick it like:

              1. When you want to recieve information (possibly from the controller). use request(<sensor>)
              2. wait(<milliseconds>) (keep awake) for the sender to send the info.
              3. either receive the information or conclude that something went wrong (if you can expect there will allways be a value sent)
              4. sleep for as long as you want.

              It will depend on your controller if and how it reacts to request. For Domoticz V_STATUS and V_TEXT do work.

              You can also build a "broker" node (or integrate it in your gateway). Thise is very flexible and independent of your controller (but not very user friendly). I you need any how to's just let me know.

              Magic WM 1 Reply Last reply
              2
              • A AWI

                @Magic-W When you have some control over what you want to receive and when you can trick it like:

                1. When you want to recieve information (possibly from the controller). use request(<sensor>)
                2. wait(<milliseconds>) (keep awake) for the sender to send the info.
                3. either receive the information or conclude that something went wrong (if you can expect there will allways be a value sent)
                4. sleep for as long as you want.

                It will depend on your controller if and how it reacts to request. For Domoticz V_STATUS and V_TEXT do work.

                You can also build a "broker" node (or integrate it in your gateway). Thise is very flexible and independent of your controller (but not very user friendly). I you need any how to's just let me know.

                Magic WM Offline
                Magic WM Offline
                Magic W
                wrote on last edited by
                #7

                @AWI thanks for your replay!
                in your way,the node can always sleep if it don't send mesage? When i want to wake it up,i can send request(<sensor>) from the controller? How do I deal with the request message in the sensor node?

                Look forward to your reply!

                A 1 Reply Last reply
                0
                • T tekka

                  @Magic-W if you substitute delay() and sleep() to wait(), the node will process incoming messages.

                  Magic WM Offline
                  Magic WM Offline
                  Magic W
                  wrote on last edited by
                  #8

                  @tekka thank you for your reminding!

                  1 Reply Last reply
                  0
                  • Magic WM Magic W

                    @AWI thanks for your replay!
                    in your way,the node can always sleep if it don't send mesage? When i want to wake it up,i can send request(<sensor>) from the controller? How do I deal with the request message in the sensor node?

                    Look forward to your reply!

                    A Offline
                    A Offline
                    AWI
                    Hero Member
                    wrote on last edited by
                    #9

                    @Magic-W the intention is that you send a Request from your node when you want to Receive a status update from the controller. The controller sends you a response with the requested status. You keep the node awake Wait until you receive the message from the controller.

                    In fact you are polling for new messages every x time or whenever you need an update.

                    1 Reply Last reply
                    1

                    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


                    6

                    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