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. Development
  3. Message.GetString() Error

Message.GetString() Error

Scheduled Pinned Locked Moved Development
7 Posts 4 Posters 2.6k Views 4 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.
  • G Offline
    G Offline
    gloob
    wrote on last edited by gloob
    #1

    Hello,

    I have a problem with the Message.GetString() function.
    I send a RGB value in HEX format to the node and when reading out the message content I get a strange behavior.

    The serial console tells me the following

    read: 0-0-16 s=0,c=1,t=40,pt=0,l=6,sg=0:FF9A00
    

    But when I try to read the message value I get:

    HEX: FF9A00de
    

    In the code I do the following:

    String hexstring = message.getString(); //here goes the hex color code coming from through MySensors (like FF9A00)
    Serial.print("HEX: "); Serial.println(hexstring);
    

    I don't think that this is an issue of the controller or the Arduino sketch.

    does somebody have an idea how to solve this?

    Thanks.
    Stefan

    barduinoB 1 Reply Last reply
    0
    • sundberg84S Offline
      sundberg84S Offline
      sundberg84
      Hardware Contributor
      wrote on last edited by
      #2

      Hi Stefan!
      Which version do you run? We had an issue in early 1.6 which has been solved.
      If you run 1.6 this will go away if you download latest 2.0

      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
      • G Offline
        G Offline
        gloob
        wrote on last edited by gloob
        #3

        Currently I am using the latest stable version from the website:

        link text

        Should be version 1.5

        Do I need to do any changes in the controller, when I'm using the 2.0 version?
        Do I need to update the gateway as well?

        I'm right that the development tree is the version 2.0 you are talking about?

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

          I dont think this was an issue in 1.5.... hmm, sorry - cant help you then. I hope someone else knows.

          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
          • G Offline
            G Offline
            gloob
            wrote on last edited by
            #5

            I did now include a

            hexstring.substring(0,6)
            

            To only get the first 6 characters.

            1 Reply Last reply
            0
            • G gloob

              Hello,

              I have a problem with the Message.GetString() function.
              I send a RGB value in HEX format to the node and when reading out the message content I get a strange behavior.

              The serial console tells me the following

              read: 0-0-16 s=0,c=1,t=40,pt=0,l=6,sg=0:FF9A00
              

              But when I try to read the message value I get:

              HEX: FF9A00de
              

              In the code I do the following:

              String hexstring = message.getString(); //here goes the hex color code coming from through MySensors (like FF9A00)
              Serial.print("HEX: "); Serial.println(hexstring);
              

              I don't think that this is an issue of the controller or the Arduino sketch.

              does somebody have an idea how to solve this?

              Thanks.
              Stefan

              barduinoB Offline
              barduinoB Offline
              barduino
              wrote on last edited by
              #6
              This post is deleted!
              1 Reply Last reply
              0
              • hekH Offline
                hekH Offline
                hek
                Admin
                wrote on last edited by hek
                #7

                Use:

                char *hextstring =  message.getString();
                

                Even though it's called getString we actually not use the String class (which isn't recommended to use on these small embedded systems)

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                11

                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