Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Tellstick Duo - how to use temperatures?

Questions and comments specific to a particular plugin should go here.
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Tellstick Duo - how to use temperatures?

Post by krambriw »

I'll support you of course as long as I see your genuine interest in mastering the things.

Good luck with the course, excellent.

Best regards, Walter
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Tellstick Duo - how to use temperatures?

Post by krambriw »

As example you can study the following (updated) script. It is like before but it has a memory to avoid that you send commands to the heater every 30 seconds. It will only send once when it starts or stops the heater.

Best regards, Walter

Code: Select all

try:
    heating
except NameError:
    heating = False

m = [0.0]
n = [0.0]

m = eg.event.suffix.split('.')
n = eg.event.payload.split('|')

if float(n[0])>23.0 and heating:
    print "Do something like turn off heating"
    eg.TriggerEvent("Do something like turn off heating")
    heating = False
    
if float(n[0])<20.0 and not heating:
    print "Do something like turn on heating"
    eg.TriggerEvent("Do something like turn on heating")
    heating = True

if heating:
    str = "ON"
else:
    str = "OFF"

print "Current Status: ", str
LoA
Posts: 24
Joined: Wed Sep 28, 2011 7:48 am

Re: Tellstick Duo - how to use temperatures?

Post by LoA »

Thanks a lot, it┬┤s seems just as logical as I would have hoped. As I said earlier, I don┬┤t know Python (yet) but I┬┤m not afraid of it either :-)

There is still one thing that I can┬┤t get sorted, as long as I use the temp-plugin EG crashes everytime I try to add a new macro. I have to close EG and remove the temp-folder, start it again and add my macro, the close it again and put the temp-folder back...

Can you se any reason for this?
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Tellstick Duo - how to use temperatures?

Post by krambriw »

What temp-folder?

You should not create such thing. Only thing you shall do is:
- have the latest plugin for TellStick Duo in the "plugins/TellStickDuo" folder
- create the script using the feature of EvenGhost, add macro...copy paste the script I wrote above into the foreseen window. Apply, OK, SAVE

No manual creation of temp folders and putting scripts there. EvenGhost will then think this is a plugin and then report errors (or crash)

Maybe this is what is wrong

Bets regards, Walter
LoA
Posts: 24
Joined: Wed Sep 28, 2011 7:48 am

Re: Tellstick Duo - how to use temperatures?

Post by LoA »

Ok, I didn┬┤t realize that the plugin you gave me was a replacement for Tellstick Duo plugin, I┬┤ve been running them side-by-side (naming one of the "temp") and it┬┤s been working with exeption from adding new macros. Now I┬┤ve replaced this two plugins with the new one from today and everything works fine :-)
eddiex666
Posts: 41
Joined: Fri Sep 12, 2014 10:34 pm

Re: Tellstick Duo - how to use temperatures?

Post by eddiex666 »

Hello,

I just read this tread and I have just got a tellstick Duo and I have a temp sensor that is added into TellusCenter.
It reporting as this:
TellStickDuo.RawEvent: class:sensor;protocol:mandolyn;id:11;model:temperaturehumidity;temp:12.0;humidity:80;Duo_ID:3

I am looking for a script to turn on a device if temp between -40 and +10 (for my car)

Itryed your script and I is also newbe to python scripting.

I got this error when i tryed your script:
Traceback (most recent call last):
Python script "31", line 123, in <module>
class TellStickDuo(eg.PluginClass):
File "C:\Program Files\EventGhost\eg\Classes\PluginMetaClass.py", line 28, in __new__
sys.modules[newClass.__module__].__pluginCls__ = newClass
KeyError: '3
1'


Do you have any ideas?

Greetings Eddie
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Tellstick Duo - how to use temperatures?

Post by krambriw »

Hello Eddie, welcome to the EG community,

First you need to use the correct event. You have activated also logging of 'Raw' events, normally this is only needed when debugging and you could actually turn it off unless you really need it...

Look for the other event from the sensor, then copy paste it here in your response. I think the script must be slightly adopted to make it work with your sensor since it provides both temperature and humidity but that is simple and we do it in the next step.

Best regards, Walter
eddiex666
Posts: 41
Joined: Fri Sep 12, 2014 10:34 pm

Re: Tellstick Duo - how to use temperatures?

Post by eddiex666 »

Hi, K-..

tnx for reply,...

maybe you can help me with some answers :-)
(i am not good at python, but know some other programing language, php, batch, etc etc..)

I am trying to execute a action at a spesific time, when the temprature is lower than... and this is working ..
I was able to read the values of the temp by using this script:

Code: Select all

temp0 = eg.event.suffix.split(';')
print temp0

temp1 = temp0[4]
print temp1

temp2 = temp1[5:9]
print temp2

if float(temp2[0])>25.0:
    print "TellStickDuo: Turn off Spisestue tak"
    eg.TriggerEvent("Turn off Spisestue tak")
       
if float(temp2[0])<25.0:
    print "TellStickDuo: Turn on Spisestue tak"
    eg.TriggerEvent("Turn ON Spisestue tak")

The event shows reports....
['RawEvent: class:sensor', 'protocol:mandolyn', 'id:11', 'model:temperaturehumidity', 'temp:21.4', 'humidity:27', 'Duo_ID:3']

My scripts shows:
is both working and now...
a) just after I see a event report (in the live windows), that means the temprature sensor reports into TellStickCenter and also into EventGhost.
Python Script
['RawEvent: class:sensor', 'protocol:mandolyn', 'id:11', 'model:temperaturehumidity', 'temp:19.5', 'humidity:34', 'Duo_ID:3']
temp:19.5
19.5
TellStickDuo: Turn on Spisestue tak
Main.Turn ON Spisestue tak

This IS working....


b) BUT after 3-4 second later, I get this error... and it failes...
Python Script
[u'Activated.EventGhost']
Traceback (most recent call last):
Python script "1290", line 4, in <module>
temp1 = temp0[4]
IndexError: list index out of range


So the questions will be:
1) should I use a shedule to run the script at my prefered time??? or just put my script into root/autorun..

2) Should I use file read (of the log file to EventGhost) and read the temp var?

3) I also have 2 temprature sensors,,, how can I diffrence on the events?
INFO:root:2014-09-12 22:09:47: RawEvent: class:sensor;protocol:oregon;model:EA4C;id:176;temp:22.7;Duo_ID:3
and
INFO:root:2014-09-12 22:10:04: RawEvent: class:sensor;protocol:mandolyn;id:11;model:temperaturehumidity;temp:11.9;humidity:76;Duo_ID:3


any tips will be helpful.. :-)


Eddie
eddiex666
Posts: 41
Joined: Fri Sep 12, 2014 10:34 pm

Re: Tellstick Duo - how to use temperatures?

Post by eddiex666 »

I testet the filemonitor plugin and it working...
i can read the last lines of the telluslog, now i have to....

filter the latest line with "one spesific" text...

so if the log file looks like...
INFO:root:2014-09-12 22:14:04: RawEvent: class:sensor;protocol:mandolyn;id:11;model:temperaturehumidity;temp:11.8;humidity:76;Duo_ID:3
INFO:root:2014-09-12 22:14:59: RawEvent: class:sensor;protocol:oregon;model:EA4C;id:176;temp:22.7;Duo_ID:3
INFO:root:2014-09-12 22:15:00: Spisestue tak.ON.selflearning-switch:nexa.9

I would like to grep/grab the latest 10 lines in this file...
and then fins the latest line with , FEKS: Mandololyn (aand then get the var TEMP, i have a fix for reading the temp var. :-)

Any 1 knows hos to filter in the script?,
latest line with xxxx


I will choose to search in the file because it may be safer and I can search for all sensors, and then start difrent units.



Eddie
eddiex666
Posts: 41
Joined: Fri Sep 12, 2014 10:34 pm

Re: Tellstick Duo - how to use temperatures?

Post by eddiex666 »

lastest famos :-)

I created a dos script that split the log file and create 1 file for every sensors i have...
so created I a EG script...

Code: Select all

print eg.result

temp0 = eg.result.split(';')
print temp0

temp1 = temp0[4]
print temp1

temp2 = temp1[5:9]
print temp2

if float(temp2[0])>25.0:
    print "TellStickDuo: Turn off Spisestue tak"
    eg.TriggerEvent("TellStickDuo.Spisestue tak OFF'")
       
if float(temp2[0])<25.0:
    print "TellStickDuo: Turn on Spisestue tak"
    eg.TriggerEvent("TellStickDuo.Spisestue tak ON")
NB: I have a macro called - "Turn OFF Spisestue tak"
and i have a action inside that called "TellStickDuo: Turn off Spisestue tak"

I tryed both but...
. i am not able to call / jump to the eveent, action - turn on xxxxx

Do you have ny tips?

Eddie
eddiex666
Posts: 41
Joined: Fri Sep 12, 2014 10:34 pm

Re: Tellstick Duo - how to use temperatures?

Post by eddiex666 »

the result is:
Sjekkvarmeinne
File Operations: Read text from file: oregon.log
sjekktempinne
INFO:root:2014-09-13 20:53:28: RawEvent: class:sensor;protocol:oregon;model:EA4C;id:176;temp:22.9;Duo_ID:3
[u'INFO:root:2014-09-13 20:53:28: RawEvent: class:sensor', u'protocol:oregon', u'model:EA4C', u'id:176', u'temp:22.9', u'Duo_ID:3']
temp:22.9
22.9
TellStickDuo: Turn on Spisestue tak
Main.TellStickDuo.Spisestue tak.ON'
krambriw
Plugin Developer
Posts: 2570
Joined: Sat Jun 30, 2007 2:51 pm
Location: Stockholm, Sweden
Contact:

Re: Tellstick Duo - how to use temperatures?

Post by krambriw »

Many questions very mixed up...really hard to follow what you are doing and how it looks like right know...

1) You still insist to use RAW events, I specifically recommended you NOT to do that. Please read my advises more carefully.

2) Your script you started working on was on the right way but you trigger it with all kind of events, that's why it crashes after a few seconds [u'Activated.EventGhost']. Only drag the event you really want to trigger the script to the macro.

3) You have to make the script more fail-safe.

You are desperately jumping between various methods, now obviously reading log files, which is possible but for sure not the recommended way. I think it is much better to have an event driven solution.

If you don't publish what I ask for, I cannot help

1) start using normal sensor events, NOT raw events

2) copy & paste such an event here so I can see the syntax

3) go back to the first script, skip reading log files

3) create a macro only with the script and the sensor event inside

4) publish a screen shot of your macro

BR
eddiex666
Posts: 41
Joined: Fri Sep 12, 2014 10:34 pm

Re: Tellstick Duo - how to use temperatures?

Post by eddiex666 »

So yes. now i figure out why not use "RAW" event thing...
I didnt have the latest TellStickDuo plugin, thats why :-)

But now I has it....

So I created a macro:
Macro - CHECK-TEMP-TURN-ON-HEAT
Event - TellStickDuo.mandolyn.temperaturehumidity.13.Temperature.Humidity
Action - sjekktempoppe (PY script)
action - turn on lamp (Tellstick turn on)

sjekktempoppe - script
print eg.result

Result:
TellStickDuo.mandolyn.temperaturehumidity.13.Temperature.Humidity '22.1|36'
CHECK-TEMP-TURN-ON-HEAT
sjekktempoppe2
None
TellStickDuo: Turn on: Spisestue tak


need:
how to get the event temp into the script?

In the script i will use if ... :-)
Attachments
check-temp-result.PNG
check-temp-result.PNG (8.08 KiB) Viewed 6417 times
Check-temp-macro.PNG
Check-temp-macro.PNG (5.8 KiB) Viewed 6417 times
eddiex666
Posts: 41
Joined: Fri Sep 12, 2014 10:34 pm

Re: Tellstick Duo - how to use temperatures?

Post by eddiex666 »

Walter, sorry for beeing that stabish :-)
I didnt undertand the RAW and normal device event thing... :-)

I also added
print eg.result
print eg.event.suffix
print eg.event.payload

so I will test and see if I can get the temp valu inside my script...

Eddie
eddiex666
Posts: 41
Joined: Fri Sep 12, 2014 10:34 pm

Re: Tellstick Duo - how to use temperatures?

Post by eddiex666 »

Yezz.. the "normal device event" is working mutch better..
eg.event.payload is working as well...

nice..


my next question :-)

My temprature sensor is outside...
will it be any problem to compare temp?
this is the script...
mintemp = ('5') - (my limith temprature for turning ON the car heater)
temp0 = eg.event.payload.split('|')
temp1 = temp0[0]
temp2 = temp1 (un nessesary , I will remove it later)

def doTurnOn():
print "Colder than "+ mintemp + " turn heater on"
eg.plugins.TellStickDuo.TurnOn(u'Ute bil')

def doTurnOff():
print "warmer than "+ mintemp + " turn heater off"
eg.plugins.TellStickDuo.TurnOff(u'Ute bil')

if temp2<mintemp:
doTurnOn()
elif temp2>mintemp:
doTurnOff()



what will happens when temp2 = -10 ???


Eddie
Post Reply