Integrating Tellstick with csv data

If you have a question or need help, this is the place to be.

Integrating Tellstick with csv data

Postby bontwoody » Mon Feb 06, 2012 6:25 pm

Hi

Im a complete newbie to eventghost but I think that it may be suitable for what I want to do. I want to use a Tellstick for home automation but integrate data from other sources such as my solar panels and water temperature that I have managed to save onto my PC in csv format. The values in the files are updated every five mins.

Ideally Id like to do something like turn on my heat pump if Im producing over 1kW of power from my solar panels or the time is after 10am when my tank temp is lower than 35 degrees. Is this possible to do? and could you point me in the right direction to start. I havent used python before but can handle basic well enough.

Hope you can help. Woody
bontwoody
 
Posts: 4
Joined: Mon Feb 06, 2012 6:17 pm

Re: Integrating Tellstick with csv data

Postby bontwoody » Tue Feb 07, 2012 7:06 pm

Ive done some playing in Event Ghost and used a Python Script to create the following

import csv
reader = csv.reader(open("C:\Documents and Settings\Mark\My Documents\SMA\Sunny Explorer\currentkw.csv", "rb"))
for row in reader:
vKw=str(row).strip('[]')
print vKw

if vKw>1:
print "high output"
else:
print "low output"



am I on the right lines? and how to I get this to cause an event with a tellstick. Ive added the Tellstick plugin but im waiting for one to be delivered.

Thanks Woody
bontwoody
 
Posts: 4
Joined: Mon Feb 06, 2012 6:17 pm

Re: Integrating Tellstick with csv data

Postby bontwoody » Tue Feb 07, 2012 8:00 pm

Actually I mean cause an action not an event. eg if vKw>1 then cause a switch to turn on via tellstick.

Any help much appreciated. Woody
bontwoody
 
Posts: 4
Joined: Mon Feb 06, 2012 6:17 pm

Re: Integrating Tellstick with csv data

Postby krambriw » Wed Feb 08, 2012 10:53 am

You can create an event on the criteria from the script as you have started on. To generate an event from a script you can use a code line like:
Code: Select all
eg.TriggerEvent('Turn Heatpump ON', payload = None)


Test the script and when you get the event, you can drag this event from the log on the left side to a macro on the right side where you have a Tellstick action inside that will send a Tellstick command like on or off.

Best regards, Walter
krambriw
Plugin Developer
 
Posts: 1151
Joined: Sat Jun 30, 2007 2:51 pm

Re: Integrating Tellstick with csv data

Postby krambriw » Wed Feb 08, 2012 10:58 am

Part of your example is below. It will generate an event if vKw is larger than 1. You can run it, change the value and play a bit with it and you will get the idea.

Best regards, Walter

Code: Select all
vKw = 2
if vKw>1:
    eg.TriggerEvent('Turn Heatpump ON', payload = None)
    print "high output"
else:
    eg.TriggerEvent('Turn Heatpump OFF', payload = None)
    print "low output"
krambriw
Plugin Developer
 
Posts: 1151
Joined: Sat Jun 30, 2007 2:51 pm

Re: Integrating Tellstick with csv data

Postby bontwoody » Wed Feb 08, 2012 10:18 pm

Excellent! Thanks Walter I get it now. Justing waiting for the Tellstick which seem exceedingly difficult to source in the UK.

Thanks for taking the time to get me started.

Woody
bontwoody
 
Posts: 4
Joined: Mon Feb 06, 2012 6:17 pm


Return to General Support

Who is online

Users browsing this forum: Google Adsense [Bot] and 3 guests

cron