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.

RFXtrx

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: RFXtrx

Post by krambriw »

Hello James, below is a sample script you could try with your AC.

To get it going,
1) Make a new macro, name 'AC Unit Control' or something and put the python script inside
2) Drag the RFXtrx event to the same macro (in your example the RFXtrx.Type: La Crosse TX3, TX4, TX17 id: 17920)
3) Make two other macros, one for "AC Unit ON" and one for "AC Unit OFF"
4) In each of them respectively, put the action that sends the ON and OFF commands to the AC Unit and drag/define the events generated from the script execution. See picture as example of a typical configuration.
Image2.jpg
First time the temperature goes below the low limit, the AC will be sent an OFF command and when it reaches just above the high level, an ON command will be sent.

Similar scripts and macros can be defined for fans, heaters etc.

Best regards, Walter

Code: Select all

#AC Unit Control
newEvent = str(eg.event.suffix)
newPayload = eg.event.payload
name = 'My AC Unit'
id = 17920
high_level = 25.0
low_level = 22.0

try:
    status
except NameError:
    status = None

if newEvent.split(':')[2].find(str(id)) > 0:
    temp = newPayload.split(' ')[2]

    if(
        float(temp) > high_level
        and (
                status == 'OFF'
                or
                status == None
            )
    ):
        eg.TriggerEvent(
            name
            +"|"
            +'High Temp Level reached'
            +"|"
            +str(id)
        )
        status = 'ON'
           
    if(
        float(temp) < low_level
        and (
                status == 'ON'
                or
                status == None
            )
    ):
        eg.TriggerEvent(
            name
            +"|"
            +'Low Temp Level reached'
            +"|"
            +str(id)
        )
        status = 'OFF'
           


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

Re: RFXtrx

Post by krambriw »

New version uploaded in first post
jamesst
Posts: 18
Joined: Thu Dec 22, 2011 7:13 pm

Re: RFXtrx

Post by jamesst »

Hi Walter,

Sorry I havent had time to thank you for the script before.

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

Re: RFXtrx

Post by krambriw »

No problem James, I hope it works as expected. otherwise just drop a note.
Best regards, Walter
jamesst
Posts: 18
Joined: Thu Dec 22, 2011 7:13 pm

Re: RFXtrx

Post by jamesst »

Thanks Walter, it works as expected althought I'am not very happy with RFX sensitivity towards Lacrosse TX3 sensors. It doesnt pick up every transmiton from the sensor. I am using firmware .48

Anyway how can I now put the time frame to the script you sent me. So for example towel heater in the bathroom can go of and on only in the morning betwen 6:00 and 9:00, or that the humidity fan doesnt turn on during night?

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

Re: RFXtrx

Post by krambriw »

I'am not very happy with RFX sensitivity
Have you tried with a better antenna?

To control the towel heater, use the Scheduler or SchedulGhost plugin and set the times (I use that myself since many years). If you really like hot towels after the morning shower, I recommend that you turn on the heater a bit earlier (mine are controlled with the Scheduler according to the picture below).
Image2.jpg
You can also use the Scheduler to block the humidity fan during nights (just turn off power to it during night). No scripts needed for this.
Image4.jpg
Only reason for having a script would be if you start to measure humidity level in the bathroom and starts the towel heater and humidity fan until it gets down to a normal level. But I would start with what I wrote above.

BestR Walter
jamesst
Posts: 18
Joined: Thu Dec 22, 2011 7:13 pm

Re: RFXtrx

Post by jamesst »

I'll check about antenna, tnx.

I have used scheduler before, but isnt the script that checks humidity going to turn fan on anyway, if humidity level rises during night?

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

Re: RFXtrx

Post by krambriw »

That can be solved in another easy way; At the same time the scheduler powers off, we can disable the macro with the script and then enable it again when power is turned on.

BestR Walter
jamesst
Posts: 18
Joined: Thu Dec 22, 2011 7:13 pm

Re: RFXtrx

Post by jamesst »

hey Walter,

exactly, but how do I do that...you're going to kill me

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

Re: RFXtrx

Post by krambriw »

You could do like in the picture. You use the events from the Scheduler twice; once for turning the power supply on/off with RFXtrx using regular switch devices, secondly to disable/enable the macro where your humidity evaluation script is in.
This script has to be written in a similar way as the temperature sample I gave you earlier but now instead, measuring the humidity levels.

EDIT: Or even simpler, only use the events from the Scheduler to enable/disable the macro, the script will do the rest.

BestR Walter
Image2.jpg
Image2.jpg (11.15 KiB) Viewed 7633 times
jamesst
Posts: 18
Joined: Thu Dec 22, 2011 7:13 pm

Re: RFXtrx

Post by jamesst »

Hi Walter,
Onece again I need your help. Everething that you have sent me works like a charm.Thank you.
How can I send this temp/humidity sensor data via broadcater as an UDP massage. So whenever temp sensor updates that just temp or humidity value is brodcast to my other computer: Broadcaster.broadcast: 25┬░C.
I guess I need one more script?

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

Re: RFXtrx

Post by krambriw »

Lets assume the same type of event as before:

RFXtrx.Type: La Crosse TX3, TX4, TX17 id: 17920 ' temperature: +26.9 deg C signal: 8 battery: 9'

the event suffix is: RFXtrx.Type: La Crosse TX3, TX4, TX17 id: 17920

and the payload is: temperature: +26.9 deg C signal: 8 battery: 9

First you need to add the Broadcaster plugin (accept the default settings with port 33333).

Then create a new python script macro, paste the code below into the script and click ok.

Code: Select all

#Broadcast RFXtrx events
newEvent = str(eg.event.suffix)
newPayload = str(eg.event.payload)
port = 33333

res = eg.plugins.BroadcastListener.Broadcast(
        newEvent,
        newPayload,
        port
      )
Add an event to the macro as the event suffix above. You should now have a macro that looks as this:
Image2.jpg
Image2.jpg (5.29 KiB) Viewed 7598 times
Install EG with the Broadcaster plugin on each computer you need to have the event received on.

If you have more sensors, just add an event in the macro for each of them (you can drag & drop them from the log first time they appear).

Each time the event happens, it will be broadcasted on your network.


Best regards, Good luck
jamesst
Posts: 18
Joined: Thu Dec 22, 2011 7:13 pm

Re: RFXtrx

Post by jamesst »

Thanks Walter,

It works but it broadcasts all it doesnt strips prefix, this is what i get on other comuters:

Broadcast.Type: La Crosse TX3, TX4, TX17 id: 20736 ' temperature: +26.5 deg C signal: 5 battery: 9'

I would like just "+26.5" broadcasted.

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

Re: RFXtrx

Post by krambriw »

it doesnt strips prefix
In the script, you decide what you would like to broadcast.

You are not interested in trying some python coding!? If you look into what you managed to extract yourself earlier it would be really easy to do the same here and extract the data and broadcast that instead,

Try to test using some more variables and do some splits...I leave it to you as a little exercise and when you have tried, we can continue the discussion.

a = newPayload.split(':')
b = a[1]
c = ....



BR Walter

PS Just an additional hint:

When experimenting, it is very convenient to use the python shell that is included in EG (select "Help, Python Shell"). In the picture below I started with the trials as discussed above. As you can see, you can print out the result to check that you got it right. Once finished you have the syntax you need to put into the script.
Image4.jpg
jamesst
Posts: 18
Joined: Thu Dec 22, 2011 7:13 pm

Re: RFXtrx

Post by jamesst »

Hi Walter,

Youe have a point. I have to do my homework.
I have played with newpayload.split(':') or leave it blank newpayload.split and than to chose [1] or [2] etc. With that and I have previously managed to get what I wont.Now I acctualy don't know where to insert that line so that the data that I wont is being broadcast. But to grasp the phyton in general I think I'll need much musch more time.
Anyway thanks for your help
James
Post Reply