Jump to content


Photo
- - - - -

How to display temperature along with the date and time.


  • Please log in to reply
22 replies to this topic

#1 123

123

    Cocoonut

  • Registered
  • PipPipPipPip
  • 1978 posts
  • Location:Montreal, QC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1

Posted 01 November 2008 - 09:49 PM

Here's how to display the current temperature along with the date and time.

The source of the temperature reading is subject to your discretion. It can be a reading captured by your weather station or a temperature probe. I use a custom Module to retrieve weather information from Environment Canada's RSS feed.

In this example, I'll use the temperature retrieved from The Weather Channel (TWCi) by the XMLWeather Module. Let's assume the TWCiWeather object is located here: "Home.TWCiWeather".

1. In Premise Builder, click Modules in the Shortcut Bar.
2. Navigate to: Modules > AutomationBrowser > DateTime > Classes > DateTime > RenderPlugin
3. Copy and paste the following code immediately after line 12.
if not Home.TWCiWeather is nothing then
		tStr = tStr & ("&nbsp&nbsp&nbsp" & Home.TWCiWeather.Temperature)
	end if
4. Press F12 to commit the changes.

Open Premise Browser and confirm the temperature appears next to the time. You may need to refresh the browser (F5) to see the changes.

This tip works for Themes that display date and time in multi-line mode. Some Themes, like Space, might also require moving the text's position to improve its appearance. Navigate to Modules > Plugins > Themes > Space > DateTime > Left and change the value from -230 to -220.

Attached Files


Edited by 123, 01 November 2008 - 09:54 PM.


#2 Waynedb

Waynedb

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 346 posts
  • Location:California
  • Experience:average
  • Software:CQC
  • Hardware:ISY-99
  • Tech:INSTEON
  • Audio:Custom
  • Video:SageTV
  • CCTV:ip
  • Phone:OBi100/110

Posted 04 November 2008 - 12:20 PM

Thanks, very nice.

#3 123

123

    Cocoonut

  • Registered
  • PipPipPipPip
  • 1978 posts
  • Location:Montreal, QC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1

Posted 04 November 2008 - 08:30 PM

Thanks, Waynedb!

Another useful Premise Browser tweak is dquigley's response to this post. It explains how to display a scrolling status message in the clock area.

I like the idea of showing status messages; however, I plan to create a dedicated "Status Panel". I believe I can position it at the bottom of the screen where, hopefully, it will not interfere with existing UI widgets. The sole exception is the MediaCenter theme because, unlike other themes, it places the Navigation Bar on the bottom.

Edited by 123, 04 November 2008 - 08:30 PM.


#4 Waynedb

Waynedb

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 346 posts
  • Location:California
  • Experience:average
  • Software:CQC
  • Hardware:ISY-99
  • Tech:INSTEON
  • Audio:Custom
  • Video:SageTV
  • CCTV:ip
  • Phone:OBi100/110

Posted 05 November 2008 - 10:30 AM

Thanks, Waynedb!

Another useful Premise Browser tweak is dquigley's response to this post. It explains how to display a scrolling status message in the clock area.

I like the idea of showing status messages; however, I plan to create a dedicated "Status Panel". I believe I can position it at the bottom of the screen where, hopefully, it will not interfere with existing UI widgets. The sole exception is the MediaCenter theme because, unlike other themes, it places the Navigation Bar on the bottom.


Thanks for the link.

#5 chucklyons

chucklyons

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 637 posts
  • Location:Santa Cruz, Ca
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1
  • Tech:INSTEON, Z-Wave, RadioRA
  • Audio:Xantech
  • CCTV:ip

Posted 10 January 2009 - 02:08 PM

I've been using Rob Brun's VWS WeatherStation module (which I'll post when I figure out this problem)...

When I add your code snippet, the temperature displays KELVIN vs Farenheit! I have traced thru Rob's code and don't see how/why it is doing that....I haven't had any luck in trying to use a formula to convert it from kelvin to Farenheit (my poor coding ability, I'm sure!).

The configuration has degrees set to F.....

Any ideas?

#6 123

123

    Cocoonut

  • Registered
  • PipPipPipPip
  • 1978 posts
  • Location:Montreal, QC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1

Posted 11 January 2009 - 12:01 AM

Chuck,

You're saying the code in the first post is causing VWS WeatherStation to display its temperature readings in Kelvin?

If so, that has me stumped too because I can't see the connection. Maybe it is the other tweak I provided? That's the one that displays a sensor's temperature under its icon. That may be the more likely culprit.

That tweak checks the default Temperature Scale (Kelvin, Celcius, Fahrenheit, Rankine) set for the current web session and then uses it to convert the temperature value accordingly. Do all temperature values display in Kelvin, even devices not associated with VWS?

Edited by 123, 11 January 2009 - 12:17 AM.


#7 chucklyons

chucklyons

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 637 posts
  • Location:Santa Cruz, Ca
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1
  • Tech:INSTEON, Z-Wave, RadioRA
  • Audio:Xantech
  • CCTV:ip

Posted 11 January 2009 - 04:36 PM

Chuck,

You're saying the code in the first post is causing VWS WeatherStation to display its temperature readings in Kelvin?

If so, that has me stumped too because I can't see the connection. Maybe it is the other tweak I provided? That's the one that displays a sensor's temperature under its icon. That may be the more likely culprit.

That tweak checks the default Temperature Scale (Kelvin, Celcius, Fahrenheit, Rankine) set for the current web session and then uses it to convert the temperature value accordingly. Do all temperature values display in Kelvin, even devices not associated with VWS?


I can't tell you how long it took me to figure out it was Kelvin....

The bizarre part, which has caused me the most mental pain is the temperature is accurately displayed in the object view from the browser and the object properties in builder...I have to keep going on it because it drives me nuts AND I like your simple solution....

#8 chucklyons

chucklyons

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 637 posts
  • Location:Santa Cruz, Ca
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1
  • Tech:INSTEON, Z-Wave, RadioRA
  • Audio:Xantech
  • CCTV:ip

Posted 11 January 2009 - 04:56 PM

Got it......

if not Home.WS_Temp_Sensor is nothing then

		 tStr = tStr & ("   " & Home.WS_Temp_Sensor.Temperature.Fahrenheit)

		end if



...and yes, 71.8F is right!!!!

Attached Files


Edited by chucklyons, 11 January 2009 - 04:57 PM.


#9 123

123

    Cocoonut

  • Registered
  • PipPipPipPip
  • 1978 posts
  • Location:Montreal, QC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1

Posted 11 January 2009 - 10:33 PM

Doh! I didn't realize you'd be using the VWS temperature reading as the source for the temp display with Date and Time.

My source is Environment Canada and the temperature reading is stored in Celsius. Therefore I don't bother to convert it for display purposes.

VWS must store its readings using Premise's default temperature scale, Kelvin ... which happens to be the right way to do it. The displayed value is then converted into whatever is the preferred scale (Fahrenheit or Celsius).

#10 chucklyons

chucklyons

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 637 posts
  • Location:Santa Cruz, Ca
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1
  • Tech:INSTEON, Z-Wave, RadioRA
  • Audio:Xantech
  • CCTV:ip

Posted 12 March 2009 - 12:07 AM

Well, I loved 123's little tweak, so I decided to kick it up a notch.....(I use Rob Brun's excellent Ambient VWS weather module...which I will put up when I get a couple more of the bugs worked out)

I first made sure I stuck with a solid temperature, and then I added the degree symbol......
if Home.Outside.WS_Temp_Sensor nothing then
							  tStr1 = CInt (Home.Outside.WS_Temp_Sensor.Temperature.Fahrenheit)
							  tStr2 = chr(176)





Then I decided I would add the rain for the day......(I have a well.....I worry)




	  If not Home.WS_Rain_Gauge is nothing then
	  tStr3 = Home.WS_Rain_Gauge.Rain24HrInches
	  'if it isnt raining, then lets just throw out the temperature...  
	  tStr3 = "0" then  
	  tStr = tStr & " Outside Temp " & tStr1 & tStr2	
	'Otherwise, lets show the temp AND the amount of rain
	else
	tStr = tStr & " Outside Temp " & tStr1 & tStr2 & "<BR>" & "Today's Rain: " & tStr3 & "in"
	End If




So now I can see the temp in whole numbers, see how much rain we've gotten for the day...and my wife loves it!



Thanks, 123!






#11 chucklyons

chucklyons

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 637 posts
  • Location:Santa Cruz, Ca
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1
  • Tech:INSTEON, Z-Wave, RadioRA
  • Audio:Xantech
  • CCTV:ip

Posted 21 March 2009 - 09:16 PM

In my efforts to finish Rob Brun's excellent Weather Module (which uses Ambient as the source), I was trying to take an .jpg and have it displayed in the date/time area....

I have yet to figure out how to do that. I know it has to be so painfully easy, but I'm stuck...

I'm also ready to upload the .xdo, the .exe, and most importantly, the instructions....

Basically, what happens is that you can configure Ambient to change the type of icon file it generates, based on different parameters. So, today, (early), the icon was clear, with the temperature displayed with the sun. By evening, the icon.jpg changed to rain, with the temperature displayed.

I have ambient changing the icon.jpg approximately every 5 mins (you can set the rate), and it loads up to Premise about the same.

So currently, I have the icon.jpg as the image for the weather class - so it displays on the main page...now if I could display it with the time and date...

S.O.S?

Attached Files


Edited by chucklyons, 21 March 2009 - 09:18 PM.


#12 123

123

    Cocoonut

  • Registered
  • PipPipPipPip
  • 1978 posts
  • Location:Montreal, QC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1

Posted 21 March 2009 - 10:36 PM

The appearance of Premise Browser's "DateTime" section is controlled here:
Modules > Plugins > Components > DateTime

Copy the weather image file (Weather.jpg) into \program files\premise\sys\web\images

In the Properties window, find the CSS section and scroll down to the BackgroundImage property. Enter the following text: url(/images/Weather.jpg);background-repeat: no-repeat;background-position:right

The DateTime section of Premise Browser will now contain the weather image as its background.

The first problem you'll immediately notice is that the weather image is too large for the DateTime area (it'll get cropped). You can change the CSS Height property to 90px to expand the allowable area. But then the image will obscure the Shortcuts menu.

Here's my suggestion:
Navigate to: Modules > Plugins > Components > TaskList > GlobalTasks
Scroll down to the BackgroundImage property and enter the string shown above.
The weather image will appear in the background of the Shortcuts menu (a.k.a TaskList) where there is plenty of room. This menu's Alpha property is set to 70 so there is an existing transparency effect. This helps the weather image to blend into the background and not look too obtrusive.

If you have the ability to resize the weather images, you could make them wider to fit the full width of the menu.

#13 chucklyons

chucklyons

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 637 posts
  • Location:Santa Cruz, Ca
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1
  • Tech:INSTEON, Z-Wave, RadioRA
  • Audio:Xantech
  • CCTV:ip

Posted 22 March 2009 - 01:54 AM

Yes, yes, yes! A few observations. 1) I can't believe you responded in approx an hour after I posted...Bravo! 2) I have some tweaking to do, but your solution is supreme! 3) I can't believe I'm trying your solution at midnight! (of course, it's still raining/hailing - I don't have a .jpg for hail!) 4) As it's midnight, and I'm working your solution, my wife has decreed that you're not invited for Christmas. ;)

#14 123

123

    Cocoonut

  • Registered
  • PipPipPipPip
  • 1978 posts
  • Location:Montreal, QC
  • Experience:average
  • Software:Premise
  • Hardware:Elk M1

Posted 22 March 2009 - 07:16 AM

Premise users run the risk of becoming Premise addicts. For example, this morning I woke up and the first thing I had to do was post why my idea may not work properly!

The DateTime area is refreshed every minute by a timer. This use of polling is not used by the other elements of Premise Browser; most of its elements subscribe to changes in properties ... alter a property and its visual representation is automatically altered in Premise Browser.

Putting the external temperature reading, and the weather image, in DateTime is a good choice because the entire area gets redrawn every minute. However, the Shortcuts area is not periodically refreshed ... it uses subscription.

For subscription to work, the property has to change in order to trigger a transaction. So if you change the name of the file in BackgroundImage, that is a significant modification and Premise Browser will be updated. However, if you simply change the image file's content (i.e. the file name stays the same) that is not a significant change to the BackgroundImage property and nothing will be refreshed in the browser.

One solution may be to use SetValueForced to write to the BackgroundImage property (each time you need to update the weather image). It causes Premise to evaluate a property even if the property's value has not changed significantly. For example, if a light's PowerState is currently True, setting it to True again will not cause Premise to evaluate it (i.e. no transactions will be executed). However, if you use this.SetValueForced "PowerState", True it will force Premise to evaluate the property and trigger a transaction.

Addendum
Bah! SetValueForced is thwarted by Internet Explorer!

I ran a test. I changed the image file's content and altered the CSS to move the image's position (background-position:center). The result is that the image moves from right-justified to centered (yay!) but the image content is unchanged (boo!). Why? Because IE caches the image file! Altering IE's handling of caching "Tools > Internet Options > (Browsing History) Settings > (Check for newer versions of stored pages) Every time I visit the page" doesn't fix it. Premise Browser employs an AJAX-like technology that refreshes portions of the web page and not the whole page.

I think you'll have to shoehorn the image into the DateTime area. The only other solution would be to alter AutomationBrowser and create a new Component (i.e. a new permanent element in the Premise Browser's UI). I've experimented with this in the past and created a Status bar at the bottom of the screen. But it creates a compatibility problem ... like the Environment Canada Weather module I wrote, but haven't shared, because it demands the 1024x768 version of AutomationBrowser.

Edited by 123, 22 March 2009 - 09:30 AM.


#15 Waynedb

Waynedb

    Dedicated Cocooner

  • Registered
  • PipPipPip
  • 346 posts
  • Location:California
  • Experience:average
  • Software:CQC
  • Hardware:ISY-99
  • Tech:INSTEON
  • Audio:Custom
  • Video:SageTV
  • CCTV:ip
  • Phone:OBi100/110

Posted 22 March 2009 - 03:42 PM

I think you'll have to shoehorn the image into the DateTime area. The only other solution would be to alter AutomationBrowser and create a new Component (i.e. a new permanent element in the Premise Browser's UI). I've experimented with this in the past and created a Status bar at the bottom of the screen. But it creates a compatibility problem ... like the Environment Canada Weather module I wrote, but haven't shared, because it demands the 1024x768 version of AutomationBrowser.


What about using a font that has weather images, I know that I have seen fonts like that.
http://www.dingbatpa...l/special.shtml




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users