logo_twitterThe script that will be posted here is in beta testing now. Support is limited and will be done through .

IMPORTANT UPDATE: 2013 March 18th
Updated code is posted below supporting the new v1.1 API. See this post for the changes or download the new script. 

It’s a script that allows Homeseer to Twitter information you that you configure.

What can you do?
Send a tweet when

  • It starts raining and doors or windows are open
  • Your car is away or back home
  • Every evening at 23:55 containing the water/gas/electricity usage of that day
  • Your frontdoor opens when you are not at home
  • The temperature reaches a certain level

Download
DJ_Twitter script 0.2 (Sep 13 2009)
DJ_Twitter script 0.3 (Sep 17 2009) for Prowl APNS support
DJ_Twitter script 0.4 (Nov 09 2009) Added fix for multiple strings/values and incorrect day-of-week-name
DJ_Twitter script 0.4b (Aug 16 2010) Added workaround for Twitter not supporting Basic Authentication anymore.
DJ_Twitter script 0.5 (Mar 07 2011) Added Prowl Application name and Priority
DJ_Twitter script 0.5b (Mar 18 2013) Fixed the new v1.1 Twitter API compatibility

What’s next?
The next version of this script will also support Notify My Android (the Android equivalent of Apple’s push notification).

IMPORTANT UPDATE!
Twitter stopped supporting Basic authentication in favor of the oAuthHow to continue basic authentication with minimal changes, please check out the instructions at the end of this page.

Installation

  • Copy DJ_Twitter_xx.vb to your HomeSeer \scripts directory
  • Modify this script (change username/password/WGET directory variables)
  • version 0.3: if using Prowl Notification services – update API key
  • Download (WGET.EXE) (more info hereand copy this to the “C:\Program Files\HomeSeer 2\” directory
    • If this is not your HomeSeer directory please update the HomeSeer path variable in the DJ_Twitter_xx.vb script.
  • Create an event that runs the DJ_Twitter script based on specific triggers. (door open, high temp, power usage, etc)

Upgrade

  • Copy new script to your HomeSeer \scripts directory
  • Modify script as you had done with the previous build
  • Update all of your HomeSeer events to use the new script
  • Test new script with your existing events (both Twitter & APNS)

Version 0.2 Script parameters

(“Main”,”<twitter_string>|<send?>”)

  • Twitter text you want to send
    • ‘vv[<device>]’ to insert VALUE of a HS device
    • ‘ss[<device>]’ to insert the device STRING
    • ‘dd[<dateformat]’ to insert a date. Use the following variables:
      • D=day-number, DD=short-day-name, DDD=full-day-name
      • M=month-number, MM=short-month-name, MMM=full-month-name
      • YYY=year
      • hh=Hours, mm=Minutes
      • Example: “dd[DDD, D MMM]” creates “sunday, 6 september” or
      • Example: “dd[M-D-YYY hh:mm]” creates “9-6-2009 15:22”
  • <send?> (optional) Do you want send the twitt (for debugging purposes) ? ‘yes’ or ‘no’ – default=’yes’
  • EXAMPLE Run ‘DJ_Twitter_xx.vb’ in HomeSeer with these parameters:
    • Example: (“Main”,”Front door is ss[^7] and the temperature is vv[T8] on dd[DDD, D MMM YYYY]”)
    • Example: (“Main”,”The temperature is vv[T8] |no”) (if you only want to log the event and not actually send it)

Version 0.3 / 0.4 Extra Script parameters

Starting 0.3 you can update the parameter ‘send’ with ‘prowl’. This is used for Prowl’s Apple Push Notification Service (APNS). How?

  • Create account at Prowl – click register tab (no email required!)
  • Get API key (settings tab)
  • Copy API key into script (version 0.3 or later)
  • Get Prowl application on iPhone/iPod (€ 2,39)
  • Run script, example: (“Main”,”Energy used today vv[P21]W|prowl”)

Version 0.5 Extra Script parameters

With this release you have 2 extra features:

Prowl (Push notification) Application name for custom redirects.

Use the application name parameter in the script
Example: (“Main”,”Energy used today vv[P21]W|prowl|Energy|2″)
In the Prowl app on your phone you can define custom redirects based on this string

Prowl (Push notification) priority

Use the priority parameter in the script
Example: (“Main”,”Energy used today vv[P21]W|prowl|Energy|2“)

Future/bugs

  • SEV3: (jruys) Remove requirement to have a space after “ss” command. “ss^9 test” is accepted, “ss^9test” or “ss^09test” strips the “test” text. Suggestion: force number to be 2 digits, or terminate with a known character. Maybe “ss[^09]”?
    • DJ: Fixed in release 0.2
  • SEV2: (jruys) Error if string passed has a variable at end but no space. Example “Test vv^1|yes|yes” fails but “Test vv^1 |yes|yes” works
    • DJ: Fixed in release 0.2 (using different format)
  • SEV3: (jruys) Remove leading and trailing spaces from “ss” output, because output “power used:ss^9 .” looks like “power used:[2 spaces]12kWh[space].”
    • DJ: Fixed in release 0.2
  • SEV4: (jruys) Would like option to only inject time (so not time *and* date) and at beginning of string. Maybe “dd” to inject date and “tt” for time?
    • DJ: Fixed in release 0.2 (see script parameters)
  • SEV4: (jruys) Strings may contain “ss” or “vv” which will upset the system – use escape character? “~ss or %ss?”
    • DJ: Fixed in release 0.2
  • SEV6: Support Prowl for iPhone Push Notification
    • DJ: Fixed in release 0.3
  • SEV2: (???) Using 2 strings of values in one line causes error or 2nd string/value not to be translated.
    • DJ: Fixed in release 0.4
  • SEV2: (Chak) Day of week name is displayed wrong. Monday should be Sunday, Tuesday should be Monday etc.
    • DJ: Fixed in release 0.4
  • SEV1: (Jeroen) New Twitter API (v1.1) is not supported, script broken
    • DJ: Fixed in release 0.5b (thank you JW)
  • SEV2: (Chak) Device starting with ‘(‘ doesn’t display
    • DJ: Fixed … when?

Example

hs_twitter

 

NOTE: Android devices don’t have a Push Notification mechanism like Apple. You could think about NMA (Notify My Android). I have not implemented this.

 

Workaround for Authentication

As I don’t have the programming skills to implement the new oAuth model I will use an easy workaround from http://www.supertweet.net. They will serve as a Twitter Basic Authentication proxy.

  • Go to http://www.supertweet.netand click on the ‘sign in with Twitter’ icon
    • supertweet01
  • Now log-in to your twitter account and give MyAuth API proxy access.
    • supertweet02
  • Set a password (‘secret’) at SuperTweet.net. This password should not be the same as your Twitter password. Make a note of this password as it’s what you’ll have to change in the DJ_Twitter_xx.vb script.
    • supertweet03
    • supertweet04
  • Copy DJ_Twitter_0x.vb to your HS Scripts directory
  • Edit the DJ_Twitter_0x.vb script and change the password variable from your original Twitter password to the one you supplied to SuperTweet.net
  • Update a Twitter event to use the new script and test it. Make sure tweets are posted.
  • Now update your Twitter events to use the new script.

 

Prowl Custom Redirects

With the latest Prowl version (launched early 2011) you can createa  custom redirect based on an application name.

Prowl event in my script before v0.5:
– Event name: “My Home”
– Application name: “says:”

Prowl event in script starting v0.5:
– Event name: “My Home”
– Application name: “Doorbell” (for example”

In the Prowl application you can define a custom redirect. See the following 2 screenshots.

img_0948 img_0947
click to zoom

To setup a redirect that works for both internal (local LAN) and external (Public internet) networks, please check out the tips in the “New Prowl features in Twitter script” post.

 


Comments

Twitter — 2 Comments

  1. Pingback:Holiday – what should your house do? – Domoticaworld.com

  2. Pingback:Homeseer Twitter: Push Notifications – Domoticaworld.com

Leave a Reply