Author Topic: 24 Hour Clock with Weather Announcement  (Read 9307 times)

Spitfire2600

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
24 Hour Clock with Weather Announcement
« on: September 03, 2015, 01:04:52 am »
I have done some tinkering with a combination of plugins to make something great. It could be much better but this is a crude effort from very limited programming knowledge.

24 Hour Alarm v1 - is the standard 12 hour clock. 1-12am, 1-12pm. Note: bug when saving time, it does actually save the time but if you refresh the plugin you will have to set the alarm time again. I'm a little lost as to why it does this and how to fix it while still maintaining the 12 hour am-pm format. 

24 Hour Alarm v2 - is the international 24 hour clock. It does not share the same bug as it's predecessor, however it will only work if system time is 24 hour format.

These projects are identical besides the time format. Theoretically, it should be expandable, i.e. adding news announcements, playing music, etc.
These were created using an Alarm plugin and a Weather Alert Plugin, both of which are credited in the .uhp.
They were designed to work with both individual plugins (Alarm and weather) without interference.

Make note to change the weather code to your area. as in the 'KIND' in the weather link. http://w1.weather.gov/obhistory/KIND.html
In the code, it is marked with 'XXXX', please be sure to change it. 

Anyone should feel free to improve this because it really could be something great. Look at all the math!

Spitfire2600

     
« Last Edit: September 05, 2015, 12:06:36 am by Spitfire2600 »
 

Spitfire2600

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
Smart Alarm
« Reply #1 on: September 05, 2015, 12:03:05 am »
Alright, After much trial and error, I have figured out how time works..

In this code at least.. The previous bug is gone and this is a fully functioning alarm with current weather announcements. I lost the 24 hour format and fixed the time saving issue. Note, I'm looking to build more into it such as current news, music, etc. all as part of the alarm function for a very informative alarm clock that is guaranteed to get you out of bed in the morning and right to your computer to make it stop talking so you can go back to sleep.. Anyone is free to jump in and improve it. Set time in the dialog menu. And that's it. No bugs I've found. I've used it numerous times over a few days testing it.

This is also my first plug in, albeit a modified one. Cool!

Check it out, use it, change it up, make it better, share it here.


-Spitfire       

v2 update
- Simply drag the contents into the HAL install file (C:\Program Files (x86)\Zabaware\Ultra Hal Assistant) and enable the plug-in in the plug-in menu. Be sure to click APPLY CHANGES twice on first use and open HAL to build necessary database entries. Otherwise, set the clock a second time to fix.
« Last Edit: November 22, 2015, 08:09:06 pm by Spitfire2600 »
 

DemonRaven

  • Full Member
  • ***
  • Posts: 111
    • View Profile
    • chatbotfriends
Re: 24 Hour Clock with Weather Announcement
« Reply #2 on: September 05, 2015, 12:07:18 pm »
I got a message error about it the first time i used it. I enclosed a screen shot of it so you can see the message. I do like the idea of it and your other ideas of adding more to it as plug in's make hal more functional as a assistant.

Spitfire2600

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
Re: 24 Hour Clock with Weather Announcement
« Reply #3 on: September 05, 2015, 04:24:43 pm »
DemonRaven,

I'm afraid I am unable to replicate your error. Are you using this plugin with any other alarms or clocks? Have you tried disabling other plug ins and just trying the Smart Alarm? I believe the issue might be that the MinutesPram variable is referencing another plugin for some reason. I could try redefining a few other variables to see if this solves your issue, but disable all other plug ins first, then try the smart alarm. I have a dozen other active plugins as well, but I haven't received any errors like that.   

Spitfire2600
« Last Edit: September 05, 2015, 06:33:47 pm by Spitfire2600 »
 

Spitfire2600

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
Re: 24 Hour Clock with Weather Announcement
« Reply #4 on: September 05, 2015, 04:57:43 pm »
Okay, I have redefined a few variables and that should have fixed your error. Feel free to use this with other alarms now. I will re upload the Smart Alarm to the Smart Alarm post above.

-Spitfire2600
 
 

DemonRaven

  • Full Member
  • ***
  • Posts: 111
    • View Profile
    • chatbotfriends
Re: 24 Hour Clock with Weather Announcement
« Reply #5 on: September 07, 2015, 03:12:44 am »
What ever you did different fixed it thanks.

lightspeed

  • Hero Member
  • *****
  • Posts: 6764
    • View Profile
Re: 24 Hour Clock with Weather Announcement
« Reply #6 on: September 07, 2015, 08:29:45 am »
Hello Spitfire2600 , on the 24 hour weather clock announcement what exactly is it suppose to be capable of now that you have done changes to it ?  does it mean that a user can ask what the weather is (using their pre zip code info. ) anytime (24 hours a day ) and be able to get the current weather temp ? i thought the weather plug in already did that ?
 

Spitfire2600

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
Re: 24 Hour Clock with Weather Announcement
« Reply #7 on: September 07, 2015, 08:54:38 pm »
Lightspeed,

This is simply an alarm clock with weather announcements for now. It will not give weather on command, only when the alarm is activated. For that, you'll need the weather alert plug-in but this smart alarm is more than capable of working with both another clock and the weather alert plug-in flawlessly, at least, it has been working quite well for me.

Also, it doesn't work with zipcode, it required a 4 digit weather location code, (default set to New York City) which the link to find is included in the code, along with crediting all other plug-ins used.

As of now I have finished the v2 of this plugin, however as I referenced other plugins directly as opposed to adding them in the script such as the MP3 plug-in to play music in the morning and added a few HalCommands to open morning web pages.. So until I actually include the code to build an mp3 database, I'll hold on to that one.   

All it is basically, is a clicker saver. By v3, It will wake you up in the morning, open your morning web pages, emails, play some music, tell you the weather, news, and traffic, and maybe by v4, prepare coffee and warm up the car.

Let me at least know if this v1 of the code works for everyone, then I can get to work recompiling v2 for upload.

- Spitfire2600
« Last Edit: September 07, 2015, 09:00:43 pm by Spitfire2600 »
 

Spitfire2600

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
Re: 24 Hour Clock with Weather Announcement
« Reply #8 on: September 13, 2015, 03:15:50 am »
I did discover the error you received was that the main database file did not write the necessary components. Also I noticed this plug-in doesn't actually incorporate the 24/12 hour time conversion, either. I have indeed fixed this to function only once when set within a 24 hour period unless reset, of course. I added AM/PM as a separate variable to allow the clock to distinguish the two 12 hour cycles. The problem however, is that it requires manually adding an entry to a table in MiscData for it to function properly. I have coded it properly, as in adding a read only command if the file exists however, I receive errors and it doesn't overwrite previous AM/PM entries, which probably means I didn't code it right. I am working on this. Like I said, it works with the addition of a database entry. So Version 2 should be soon.
This is a great learning experience. I should be able to tackle a real plug-in in 10-15 years.


Spitfire.           
 

onthecuttingedge2005

  • Guest
Re: 24 Hour Clock with Weather Announcement
« Reply #9 on: September 13, 2015, 11:46:15 am »
see if this helps...

Code: [Select]
VBScript displays date and time in one format by default but you can change this using the FormatDateTime() function.
 Syntax:FormatDateTime(dateOrTime, format)  The dateOrTime parameter is the date or time you want to format, and the format parameter is the type of formatting to apply.
 The format parameter can take a value from 0 - 4, each value signifying a different type of formatting:
 0 (used for dates) - display a date in the format mm/dd/yy (default)
 1 (used for dates) - display a date in the format day, month and month day, year
 2 (used for dates) - display a date in the format mm/dd/yy (default (same as 0))
 3 (used for time) - display time in the format hh:mm:ss: PM/AM (12 hour format)
 4 (used for time) - display time in the format hh:mm (24 hour format)
 Example:<script type="text/vbscript"> document.write("Current date: " & FormatDateTime(Date, 0) & "<br />") document.write("Current date: " & FormatDateTime(Date, 1) & "<br />") document.write("Current date: " & FormatDateTime(Date, 2) & "<br />") document.write("Current time: " & FormatDateTime(Time, 3) & "<br />") document.write("Current time: " & FormatDateTime(Time, 4)) </script>

Spitfire2600

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
Re: 24 Hour Clock with Weather Announcement
« Reply #10 on: September 13, 2015, 10:04:23 pm »
Thanks!

I believe I've sorted out the issues. I am pleased to announce the v2 release. After a week of beta testing and a week of bashing my head against the wall trying to think of what to do about the 12/24 hour issue. However, it's now been solved. I added an AM/PM variable to the 24 hour setup, so it should work regardless of whichever clock time is use. 

I will upload v2 in the Smart Alarm post above. Feel free to use, amend, share, and repost. I'm interested to see if this serves any real purpose.

Drag the contents into the hal main folder, which is by default C:\Program Files (x86)\Zabaware\Ultra Hal Assistant\, otherwise you'll have to redefine a few things. When activating the plug-in on first use, be sure to click both APPLY CHANGES and APPLY twice and then open HAL. Only on first use and after that, it's good to go for as long as you use it. I'm not sure why, it doesn't build the necessary "MINUTES" variable, in which case, just set the clock again to fix it. And... that's all i've got. I may have gone a little overboard with it, but it's nice. 'Smart' Alarm is fitting.

Also, in the code, I left room to expand. I disabled a few things, such as MP3 auto-play, and auto-running programs, such as email. They can be reactivated by simply deleting the " ' " where necessary after redefining your variables. Also, the MP3 function won't work without the vrMP3 plugin installed as well. I left active Auto-run websites, of course time and weather.

Hope everyone will enjoy, and now no one ever has an excuse to be late.

- Spitfire         
« Last Edit: September 13, 2015, 10:30:03 pm by Spitfire2600 »
 

raybe

  • Hero Member
  • *****
  • Posts: 1067
    • View Profile
Re: 24 Hour Clock with Weather Announcement
« Reply #11 on: September 16, 2015, 01:32:40 pm »
Thanks for all your work and was OTCE information helpful for you because he also takes his own time to help us out. So I'm thankful to you for your contribution and will give it a spin.

OTCE, always a thanks for posting your insights and help.

raybe
 

Spitfire2600

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
Re: 24 Hour Clock with Weather Announcement
« Reply #12 on: November 22, 2015, 08:10:17 pm »
I upload Version 3, the final bug free, fingers crossed, version here:

http://www.ultrahal.com/community/index.php?topic=12859.0
 
 

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3857
    • View Profile
Re: 24 Hour Clock with Weather Announcement
« Reply #13 on: November 22, 2015, 09:12:05 pm »
Great! So this is the one: 'By v3, It will wake you up in the morning, open your morning web pages, emails, play some music, tell you the weather, news, and traffic, and maybe by v4, prepare coffee and warm up the car.'?

I could use the part about preparing the coffee and warming the coffee as it's getting a lot cooler here on the east coast of mid Atlantic!  ;D :D

Thanks for forging ahead and experimenting! Things were starting to get a bit static around here!
In the world of AI it's the thought that counts!

- Art -

Spitfire2600

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
Re: 24 Hour Clock with Weather Announcement
« Reply #14 on: November 23, 2015, 01:55:38 pm »
Haha! I should have stated that until I start playing around with home automation, the coffee machine will probably have to wait until a later version.