my.GasBuddy 0.3

electron

Administrator
Staff member
title : my.GasBuddy
filename: my.gasbuddy.txt
version: 0.3
description: report preferred station using GasBuddy.com data
author: Dan (electron)
email: dan at marstracker dot org

changelog:
  • version 0.3 (09032005): include 'last updated' timestamp
  • version 0.2 (09032005): due to complex HTML code, switched code to use regular expressions
  • version 0.1 (09012005): created script
Instructions:
  • [1] Copy this script to the Homeseer scripts directory.
  • [2] Go to the GasBuddy.com site, pick your local GasBuddy site, and 'search' for your gas station. Try to narrow down the search as much as possible by specifying an Area and the type of gas station (you want to avoid your preferred station not showing up in the list).
  • [3] Set the variables in the 'User definable Settings' section, follow the provided example.

This script is far from done, but it's a start, so figured I would post it anyways. Go to gasbuddy.com, and look up the local gasbudy site (i.e. chicagogasprices.com). Then look up your gas station in that list, and look at the link which allows you to update the price for that gas station, it contains an ID. Copy & Paste that ID into the script (sPreferredStationID variable), and update the sSite variable as well, pointing to the new gasbudy site. Select the homeseer device you want to assign for use with this script (don't forget to create that device!), and create a recurring event running this script.

This script will update the device string with the latest price, and also store it in the device value (but the value has been multiplied by 100 since the devicevalue doesn't support decimals). This allows you to trigger events based on any changes to the price, eventho the script will allow you to to do this soon as well. I personally use this to automatically announce (TTS) and email any price changes to my cellphone.

Download

I will post better instructions, and an update, in a few days.
 
Now for a real challenge. Can you write a script to run the other way. You enter a price, say 1.25 and send it to your local gas station, then go fill up at that price. Now THAT would be a cool script! ;)
 
I already could do some of that, monitor gas prices, compare, open the garage door, and start the car ... that's about as how far I can get with automation ;) ;)
 
Invalid procedure call "mid" in line 48

connecticutgasprices.com

ID 17599730


This will be very cool... ;)
 
thats because the gas prices are too high to store the value in the amount of memory electron has allocated ;)
 
For anyone interested, here is a macro for PowerHome that does essentially the same thing, I just put the price into a Global Variable instead of a device string.

Make sure to create a Global Variable Called GasPrice!

Code:
SET SYSTEM [TEMP1] = ph_geturl("put the URL here")
SET SYSTEM [TEMP2] = "put the station ID here"
COMMENT Exit macro if page does not load
JUMP if( left( "[TEMP1]", 15) = "HTTP/1.1 200 OK", 1, 999)
SET SYSTEM [TEMP1] = "$ " + mid( "[TEMP1]", pos( "[TEMP1]", "[TEMP2]" ) + 10, 4)
COMMENT Exit macro if price has not changed, else update GasPrice
JUMP if( "[TEMP1]" = "{GasPrice}", 999, 1)
SET GLOBAL {GasPrice}="$ " + "[TEMP1]"
 
Rupp, you may need to go to the site and select your city first, then find the station ID.
 
Getting same thing as Skibum.

Terry

Gas, Grass, or @$$ no body rides for free!

2005 version

Forget the Grass or @$$ give me GAS!
 
Looks like the station has to be on the front page in order for this to work, so I will have to come up with a better way of getting this data, sorry about this. I will be updating it sometime tonight or tomorrow, as I will be away for the day. Thanks for testing guys! If you really want to use it now, use a station from the main page.
 
Rupp, try changing the url to...

alabamagasprices.com/index.aspx?s=Y&fuel=A&area=Huntsville&tme_limit=72
 
TonyNo said:
Rupp, try changing the url to...

alabamagasprices.com/index.aspx?s=Y&fuel=A&area=Huntsville&tme_limit=72
Thanks TonyNo. I wonder why it wasn't listed on the main page?
 
it would be great to add an "as of" to the string.

3.29 /gallon as of 7:20 Wednesday

Love the script. ;)
 
I am back, and will fix this mess. If your station is on the front page, it means either really good news (because it is one of the cheaper ones), or bad news (because it is one of the most expensive ones, which is where I am lol). I should have an update posted later today. I will add the timestamp as well, good idea, thanks for the feedback guys!
 
Back
Top