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. Hardware
  3. Getting numbers from Vera to a sensor

Getting numbers from Vera to a sensor

Scheduled Pinned Locked Moved Hardware
20 Posts 7 Posters 9.5k Views 6 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.
  • greglG gregl

    Hi mate - looks good and im glad you brought this topic up...its something i was about to get to myself for my pool controller.
    Anyway, with respect to your "Todays Weather" var... i wonder if its similar to the problem i had here:
    http://forum.micasaverde.com/index.php/topic,24588.msg170887.html#msg170887

    • i think the message.data is not a string....
      What do you see if you do Serial.print (TodayWeather); ?

    HTH

    BulldogLowellB Offline
    BulldogLowellB Offline
    BulldogLowell
    Contest Winner
    wrote on last edited by
    #8

    @gregl

    Thanks for reminding me... It is the two lines between 'weather' and 'T: 75.20' Photo attached, it is returning two characters that I cannot cut and paste here.

    Some kind of unsigned character array? So I changed the variable declaration to :

    unsigned int TodayWeather;
    

    and now the string returns as to lines of zero, instead. Looks like progress... (2nd screen shot)

    Screen Shot 2014-05-01 at 12.06.55 AM.png

    Screen Shot 2014-05-01 at 12.16.24 AM.png

    1 Reply Last reply
    0
    • BulldogLowellB Offline
      BulldogLowellB Offline
      BulldogLowell
      Contest Winner
      wrote on last edited by
      #9

      I guess I have to change the title of this thread to "Getting Text from Vera to a Sensor."

      I wonder if there is a way to write the string in vera in a format that is better suited for the message?

      1 Reply Last reply
      0
      • greglG Offline
        greglG Offline
        gregl
        Hero Member
        wrote on last edited by
        #10

        you could use some luup code (from the weather plugin) to set the variable to a int
        http://code.mios.com/trac/mios_weather
        and http://www.wunderground.com/weather/api/d/docs?d=resources/phrase-glossary#forecast_description_phrases
        then in the sketch convert the var to a known string...

        ...but im sure there is a way to send the string without needing to do this.. Hek ?

        BulldogLowellB 1 Reply Last reply
        0
        • greglG gregl

          you could use some luup code (from the weather plugin) to set the variable to a int
          http://code.mios.com/trac/mios_weather
          and http://www.wunderground.com/weather/api/d/docs?d=resources/phrase-glossary#forecast_description_phrases
          then in the sketch convert the var to a known string...

          ...but im sure there is a way to send the string without needing to do this.. Hek ?

          BulldogLowellB Offline
          BulldogLowellB Offline
          BulldogLowell
          Contest Winner
          wrote on last edited by BulldogLowell
          #11

          @gregl

          So, I figured it out. it turns out I'm a <redacted>.

          TodayWeather = atoi(message.data);
          

          Will ALWAYS return an integer, because that is what it is supposed to do...

          void WeatherStatus(message_s message){
            if (message.header.type==V_VAR4) {
               String TodayWeather = String(message.data);
               Serial.println("weather: ");
               Serial.println(TodayWeather);
               delay(1000);
             }
          }
          

          brings in the string.

          can't believe I missed that one.

          my only problem is that the string has a little something extra, now and wouldn't print to the LCD, which I solved by appending in Vera the string I grab with an "&" and clipping it in Arduino:

          void WeatherStatus(message_s message){
            if (message.header.type==V_VAR4) {
               String Weather = String(message.data);
               int locator = Weather.indexOf("&");
               Weather = Weather.substring(0, locator);
               TodayWeather= Weather;
             }
          }
          

          and Lua

          local weather = luup.variable_get("urn:upnp-micasaverde-com:serviceId:Weather1","Condition", 59)
          weather = (weather.." &")
          luup.variable_set("urn:upnp-org:serviceId:VContainer1","Variable4",weather,58)
          

          And magically we have text and numbers!

          Now, I knock out the interrupt and get a 1 back to Vera and I am golden.

          @gregl

          thanks for the help.

          I'd like to post the (semi-rough) code but it is a nuisance having to indent every line. Is there a quick way? Hek?

          Screen Shot 2014-05-01 at 12.29.15 PM.png

          1 Reply Last reply
          0
          • N Offline
            N Offline
            NotYetRated
            wrote on last edited by
            #12

            Ohh good god, this is great. I was looking to delve in to something like this soon, for the same use: displaying weather.

            Thanks much for info. Where did you put the display(or plan to) if I may ask? I have been considering where to place them so that the light is not a nuisance....

            BulldogLowellB 3 Replies Last reply
            0
            • N NotYetRated

              Ohh good god, this is great. I was looking to delve in to something like this soon, for the same use: displaying weather.

              Thanks much for info. Where did you put the display(or plan to) if I may ask? I have been considering where to place them so that the light is not a nuisance....

              BulldogLowellB Offline
              BulldogLowellB Offline
              BulldogLowell
              Contest Winner
              wrote on last edited by BulldogLowell
              #13

              @NotYetRated

              So funny that you mentioned. In the sketch you will see my note that I have to figure out how to turn off that LED. I think it is very easy, I just need to find the command. I was hoping it was harder to move text and digits back and forth. I am tenacious when it comes to those things, so I will find out how. But, if you find out first, please let me know.

              The display/device will go into the guest bedroom, It will allow a guest to bump the A/C if they need more air conditioning. I am now in the process of adding in a flag to signal to Vera to take an action. I want a push of a button (interrupt) to signal an event. I feel like I got a lot done here already and am happy if it means you got there quicker. Please use the (albeit chunky) sketch. I will update it when it is done including the communication back to Vera.

              Cheers.

              does anyone know how to post code without having to indent every line by 4 spaces... troublesome.

              in any case I updated the MCV site with the sketch theta captures the text.

              Moved to next post

              1 Reply Last reply
              0
              • N NotYetRated

                Ohh good god, this is great. I was looking to delve in to something like this soon, for the same use: displaying weather.

                Thanks much for info. Where did you put the display(or plan to) if I may ask? I have been considering where to place them so that the light is not a nuisance....

                BulldogLowellB Offline
                BulldogLowellB Offline
                BulldogLowell
                Contest Winner
                wrote on last edited by BulldogLowell
                #14

                @NotYetRated

                Here is the sketch with the ability to toggle the LCD's backlight. The command was easy, It took me a while to find it. When I did, it occurred to me how obvious it should have been.

                I added a variable to the Hygrometer device (Variable2) and the code to get the LED to switch. It will be on if there is a 1 in the field and off if there isn't. The sketch calls back to Vera to update temperature, humidity, etc. every 60 turns (you can change) so it will switch when it makes that call.

                I set up PLEG to toggle Variable2 to "0" at 23:00 and to "1" 30mins after sunrise.

                I hope that helps.

                LCDSensor.ino

                1 Reply Last reply
                0
                • N NotYetRated

                  Ohh good god, this is great. I was looking to delve in to something like this soon, for the same use: displaying weather.

                  Thanks much for info. Where did you put the display(or plan to) if I may ask? I have been considering where to place them so that the light is not a nuisance....

                  BulldogLowellB Offline
                  BulldogLowellB Offline
                  BulldogLowell
                  Contest Winner
                  wrote on last edited by
                  #15

                  @NotYetRated

                  OKAY,

                  Interrupt is in, the button push on interrupt 1 will toggle 'on' a variable on the hygrometer (set it to "1").

                  You can use that to create a PLEG action and use that action to run a scene and the toggle it back to zero, if you want. You could do a lot with a couple pushbuttons next to the bed. Plus you can also use the regular available pins as interrupts with a little more effort. You could basically create a multi-button scene controller!

                  The thing runs clunky because of all of the delays (the weather has to cycle through but is easily fixable). I am going to get this cleaned up to get the feedback response as quickly as possible.

                  Sketch attached

                  going to a baseball game to get my head out of this... Its in a good place to do that.

                  Can you post Video here?

                  LCDSensor_ino.ino

                  hekH 1 Reply Last reply
                  0
                  • SleepyhatS Offline
                    SleepyhatS Offline
                    Sleepyhat
                    wrote on last edited by
                    #16

                    Wow - I was just logging in to ask about the details on if anyone had tried sending data from the gateway to sensors and here we are. This is great! I was looking to light up a LED when sensors tripped, but now I must send text to an LCD for a "real time feed" of what my sensors "see" or "know". I may need one of these by the arm chair in the den now that it can tell me useful stuff!

                    As to mounting and placement (not sure if NOTYETRATED was asking more along the lines of this context), I am mounting both Unos and Pro minis in standard light switch boxes (plastic electrical junction box). They are cheap and easy to "blend in" with a faceplate that matches everything else in my house that was built in the 1960's. I have several in my house that are duplex boxes where we are only using one switch, so I have the extra space for mounting a sensor and battery pack. An uno and batteries are pretty tight - I don't have any of these mounted "in production" yet. A mini pro mounted via "3M VHB Tape" (Very High Bond - stickiest tape I think ever made) works well.

                    Now to see about cutting a blank switchplate to mount an LCD, add a button and voila'! - weather by the back door to the garage!

                    BulldogLowellB 1 Reply Last reply
                    0
                    • BulldogLowellB BulldogLowell

                      @NotYetRated

                      OKAY,

                      Interrupt is in, the button push on interrupt 1 will toggle 'on' a variable on the hygrometer (set it to "1").

                      You can use that to create a PLEG action and use that action to run a scene and the toggle it back to zero, if you want. You could do a lot with a couple pushbuttons next to the bed. Plus you can also use the regular available pins as interrupts with a little more effort. You could basically create a multi-button scene controller!

                      The thing runs clunky because of all of the delays (the weather has to cycle through but is easily fixable). I am going to get this cleaned up to get the feedback response as quickly as possible.

                      Sketch attached

                      going to a baseball game to get my head out of this... Its in a good place to do that.

                      Can you post Video here?

                      LCDSensor_ino.ino

                      hekH Offline
                      hekH Offline
                      hek
                      Admin
                      wrote on last edited by
                      #17

                      @BulldogLowell said:

                      Can you post Video here?

                      There is a file upload limit of 2 megabyte.
                      Would prefer a youtube link (or similar).

                      I think I've seen a youtube (embed) plugin to this forum somewhere. Will install it together with next upgrade.

                      BulldogLowellB 1 Reply Last reply
                      0
                      • hekH hek

                        @BulldogLowell said:

                        Can you post Video here?

                        There is a file upload limit of 2 megabyte.
                        Would prefer a youtube link (or similar).

                        I think I've seen a youtube (embed) plugin to this forum somewhere. Will install it together with next upgrade.

                        BulldogLowellB Offline
                        BulldogLowellB Offline
                        BulldogLowell
                        Contest Winner
                        wrote on last edited by
                        #18

                        @hek

                        thanks, I'll get the next one on Video... MIND BLOWING!!!

                        Well... kinda cool at least.

                        1 Reply Last reply
                        0
                        • SleepyhatS Sleepyhat

                          Wow - I was just logging in to ask about the details on if anyone had tried sending data from the gateway to sensors and here we are. This is great! I was looking to light up a LED when sensors tripped, but now I must send text to an LCD for a "real time feed" of what my sensors "see" or "know". I may need one of these by the arm chair in the den now that it can tell me useful stuff!

                          As to mounting and placement (not sure if NOTYETRATED was asking more along the lines of this context), I am mounting both Unos and Pro minis in standard light switch boxes (plastic electrical junction box). They are cheap and easy to "blend in" with a faceplate that matches everything else in my house that was built in the 1960's. I have several in my house that are duplex boxes where we are only using one switch, so I have the extra space for mounting a sensor and battery pack. An uno and batteries are pretty tight - I don't have any of these mounted "in production" yet. A mini pro mounted via "3M VHB Tape" (Very High Bond - stickiest tape I think ever made) works well.

                          Now to see about cutting a blank switchplate to mount an LCD, add a button and voila'! - weather by the back door to the garage!

                          BulldogLowellB Offline
                          BulldogLowellB Offline
                          BulldogLowell
                          Contest Winner
                          wrote on last edited by
                          #19

                          @Sleepyhat

                          Great ideas. Post some photos when you are installing.

                          I posted my final code on this thread.

                          I removed all of the noisy delays and other clutter to get it to respond to the interrupt as quickly as I can. I can still improve that:) but the new code works really well.

                          Check it our and have some fun.

                          This one was "Man Vs. Arduino"

                          Man won.

                          1 Reply Last reply
                          0
                          • D Offline
                            D Offline
                            dayve218
                            wrote on last edited by
                            #20

                            is there a way to display these things (temp sensor readings) on to a web page?

                            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