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. Receivetime and Request in 1.6

Receivetime and Request in 1.6

Scheduled Pinned Locked Moved Troubleshooting
5 Posts 2 Posters 2.1k Views 1 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.
  • S Offline
    S Offline
    sundberg84
    Hardware Contributor
    wrote on last edited by
    #1

    Hi!

    Im building a sketch in 1.6.0b where im first request time and then request a v_text (code pretty much standard)

    requestTime();
    request(messageCHILD, V_TEXT, 0);
    
    void receiveTime(unsigned long time) {
      // Ok, set incoming time 
      Serial.println("requesting time");
      setTime(time);
      timeReceived = true;
    }
    
    // This is called when a message is received 
    void receive(const MyMessage &message) {
        Serial.print("Msg 2 Child: "); Serial.print(message.sensor); Serial.print(", Message: "); Serial.println(message.getLong());
        if (message.sensor == messageCHILD){
            if (message.type==V_TEXT) {                     // Text content
            temp = message.getLong();        // copy it in
                newMessageAvailable = true ;
            }
        }
    }
    

    But the text and time as mixed up and i recieve not only my textmessage but also the time in V_TEXT:

    Log:
    requesting time
    read: 0-0-105 s=255,c=3,t=1,pt=0,l=10,sg=0:1450651817
    send: 105-105-0-0 s=8,c=2,t=47,pt=0,l=0,sg=0,st=ok:
    read: 0-0-105 s=8,c=2,t=47,pt=0,l=2,sg=0:10
    Message: 8, Message: 1050651817

    10 is read and its the right value, but the message.getlong is 1050651817

    @AWI or anyone?

    Controller: Proxmox VM - Home Assistant
    MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
    MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
    RFLink GW - Arduino Mega + RFLink Shield, 433mhz

    1 Reply Last reply
    0
    • H Offline
      H Offline
      hek
      Admin
      wrote on last edited by
      #2

      @sundberg84 said:

      temp = message.getLong();

      I don't understand why you try to get a long-value from the incoming text-message?

      You seem to receive a 2 byte string (pt=0) which indicates a string.
      https://github.com/mysensors/Arduino/blob/development/libraries/MySensors/core/MyMessage.h#L180

      If you read a long (4-bytes) you'll probably pick up trash from the previous message.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sundberg84
        Hardware Contributor
        wrote on last edited by sundberg84
        #3

        @hek Ok, I was thinkig that it can be a 10.7 as temp as well and i will only send temp values.
        What do you suggest i use?

        Controller: Proxmox VM - Home Assistant
        MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
        MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
        RFLink GW - Arduino Mega + RFLink Shield, 433mhz

        1 Reply Last reply
        0
        • H Offline
          H Offline
          hek
          Admin
          wrote on last edited by
          #4

          Try using msg.getString()

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sundberg84
            Hardware Contributor
            wrote on last edited by sundberg84
            #5

            Ok, tried that but it doesnt work. Its like the recieve time variable doesnt empty and the first numbers is just overwritten:

            read: 0-0-105 s=255,c=3,t=1,pt=0,l=10,sg=0:1451249777
            requesting time
            send: 105-105-0-0 s=8,c=2,t=47,pt=0,l=0,sg=0,st=ok:
            read: 0-0-105 s=8,c=2,t=47,pt=0,l=3,sg=0:5.5
            Msg to Child: 8, Message: 5.51249777

            So the variable with my time is 5.5 and 1249777 from time.

            Controller: Proxmox VM - Home Assistant
            MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
            MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
            RFLink GW - Arduino Mega + RFLink Shield, 433mhz

            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


            17

            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