Phytonscript to recive a dim-value in eventghost.

Do you have questions about writing plugins or scripts in Python? Meet the coders here.

Phytonscript to recive a dim-value in eventghost.

Postby nilsme » Tue Apr 24, 2012 2:20 pm

Hey.
I need a simple python script that I wondered if anyone could help me with.

I use eventghost to controll a tellstick Duo, but actually uses homeseer as the main program for my home automation
I have therefore set up a XAP-XPL server that sends messages from homeseer to eventpro so i can control the tellstick in eventpro from homeseer.

Works very well with devices that only have on/off, but need a script for the units that can be dimmed.

The problem is that the tellstick-plugin in eventghost is not able to retrieve a dimvalue from the XPL message from homeseer, and dim to that level. Its only possible to make events i eventghost with a preset dimvalue.
I would be possible to make an event for each dimvalue, but this would take to much time (100 events for each device).

Here is an example of a "dim" message from homeseer to eventghost!
xPL.XPL-TRIG: {: MI4-homeseer.computer_1.Master: *: Event = Dim, Count = 60, Device = C1,

(here homeseer tells eventpro to dim Device C1 to 60%)

Can anybody help me with a script to do this in eventghost, so that the unit be dimmed to the level it receives from homeseer?
nilsme
 
Posts: 3
Joined: Sat Apr 21, 2012 1:30 pm

Re: Phytonscript to recive a dim-value in eventghost.

Postby krambriw » Wed Apr 25, 2012 3:14 pm

Well, if you have the possibility to put the "Event = Dim, Count = 60, Device = C1" in the payload of the event it would be possible to have just one event with different payloads. Try to see if you can configure this in the XPL server. This is the starting point get further. Otherwise you have to do what you wrote, make one macro/action for each device and dim level you need. But this will be complex and any configuration changes will need a lot of work.

What I meant above is that you shall try to make so that the event has one static unique part and one dynamic part that you shall put in the payload. In this way you can have one single macro where you put the event (and a python script).
The python script will then be made so that it captures and decodes the data in the payload and then calls an action of the TelldusDuo plugin to dim the device to the correct level.

The event could typically look like this format when you look in the eg log:


Code: Select all
xPL.XPL-TRIG: {: MI4-homeseer.computer_1.Master: *:  'Event = Dim, Count = 60, Device = C1,'


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


Return to Coding Corner

Who is online

Users browsing this forum: No registered users and 1 guest