Getting numbers from Vera to a sensor
-
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
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)


- i think the message.data is not a string....
-
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?
-
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 ?
-
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 ?
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.
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?

-
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....
-
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....
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
-
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....
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.
-
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....
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?
-
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!
-
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?
@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.
-
@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.
-
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!
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.