Page 1 of 9 123 ... LastLast
Results 1 to 10 of 84

Thread: xPLGirder

  1. #1
    Join Date
    May 2004
    Location
    Dallas, TX
    Posts
    1,125

    Default xPLGirder

    As mentioned in another thread, I have begun to put together a plug-in for Girder to communicate with other devices/applications on an xPL network. It is still in the very early stages of development, so I would like some input from interested users.

    Short list of ideas:
    1. Providing an action that will allow the sending of xPL messages based upon events that occur in Girder. Examples: TTS, Caller ID, etc...

    2. Provide a mechanism for xPL messages coming into Girder to be processed and acted upon. A little unclear at the moment on how to best handle this. Looking for comments.

    Any other ideas, feel free to add them to the list.

    Update: Included xPLGirder Plug-in

    The plug-in creates an action in the action tree to send message to the xPL network. In the action tree look for xPLGirder to add an action. For those familiar with xPLHAL, the send message dialog for Girder is the same as xPLHAL.
    Last edited by harleydude; June 1st, 2011 at 11:42 AM. Reason: Removed obsolete files
    Rick

    Girder 6.0 - Elk M1 Gold - JRMC 11.1 w/ M-Audio Delta 410 - NetRemote - BlueIris DVR
    Girder 6 Plugins - Elk M1/EZ8, Pushover Connector and more on the way.


    Visit My Showcase

  2. #2
    Join Date
    Jul 2007
    Location
    Netherlands
    Posts
    368

    Default

    first of all; great that someone makes an effort to pick this up! Thanks

    As for content;
    1) shouldn't be very difficult, a dialog with all the xPL elements in there should do the trick. A more advanced item would be to allow for an escape sequence to add lua variables; ## would then be replaced by #, #myLuaVar# would be replaced by the value of lua variable myLuaVar. Or something similar.

    2) this one is more complex. as xPL has multiple fields of info that could be used. Target address would not be required as that should always be Girders xPL address (though it might be a group address...). The source address and schema would make sense. The event string would then be 'vendor.device-instance.schema.type'. Then again that would make it dificult to catch a specific schema independent of its source.

    Taking an approach that sets up a list of device addresses and maps them onto Girder device ID's might make more sense, where one deviceid is created that is sourceaddress independent (but that would generate 2 girder events for each xPL message...)

    maybe as simple as the eventstring being the source address, and then a conditional that allows for selecting based upon schema's or specific key/value pairs. The conditional is probably a good idea for any approach.


    one of the payloads for the event should be a global lua variable name, which is then a lua table representing the contents of the specific message. This would require some cleanup attention, delete messages from the global namespace after 60 seconds for example, or rotate them so only the last 20 received remain available.

    A generic filter in the plugin that selects for what messages to create a girder event and for which not might be a good idea to prevent an overload of events (expensive to process), eg. filtering the heartbeats for example.

    sorry, the post is probably a bit messy, just writing as I think. Any usefull ideas?

    I haven't looked at how this was solved for the xAP plugin...
    Using: Win7 MCE, Girder, xPL, RFXcom, HomeEasy

    http://www.thijsschreijer.nl

  3. #3
    Join Date
    May 2004
    Location
    Dallas, TX
    Posts
    1,125

    Default

    Added source files for plug-in in first post.
    Rick

    Girder 6.0 - Elk M1 Gold - JRMC 11.1 w/ M-Audio Delta 410 - NetRemote - BlueIris DVR
    Girder 6 Plugins - Elk M1/EZ8, Pushover Connector and more on the way.


    Visit My Showcase

  4. #4
    Join Date
    May 2004
    Location
    Dallas, TX
    Posts
    1,125

    Default

    New version available in first post.

    Changes
    1. Now calculates broadcast address. Thanks to Ron.
    2. Responds to tts.basic messages received.

    Any other messages that is needs to support by default? X10?
    Rick

    Girder 6.0 - Elk M1 Gold - JRMC 11.1 w/ M-Audio Delta 410 - NetRemote - BlueIris DVR
    Girder 6 Plugins - Elk M1/EZ8, Pushover Connector and more on the way.


    Visit My Showcase

  5. #5
    Join Date
    Jul 2007
    Location
    Netherlands
    Posts
    368

    Default

    How about forwarding Girder events outbound? (preferably with some filter mechanism)
    Using: Win7 MCE, Girder, xPL, RFXcom, HomeEasy

    http://www.thijsschreijer.nl

  6. #6
    Join Date
    May 2004
    Location
    Dallas, TX
    Posts
    1,125

    Default

    Including built in support for all the various plug-ins will be difficult. However, there is already support for sending xPL messages from Scripting actions. You will have to receive the event, parse the data, format the message and pass it to the xPLGirder plug-in to send it.

    Example
    Code:
    local msg = "xpl-cmnd\n{\nhop=1\nsource=slyfox-girder.ncc1701e\ntarget=*\n}\ntts.basic\n{\nspeech=Hello World\n}\n"
    xPLGirder:SendMessage(msg)
    Some things like CallerID will be fairly easy to native support for, some things will have to be handled through scripting.

    Let me know if there is anything in particular that you want.
    Rick

    Girder 6.0 - Elk M1 Gold - JRMC 11.1 w/ M-Audio Delta 410 - NetRemote - BlueIris DVR
    Girder 6 Plugins - Elk M1/EZ8, Pushover Connector and more on the way.


    Visit My Showcase

  7. #7
    Join Date
    Jul 2007
    Location
    Netherlands
    Posts
    368

    Default

    Quote Originally Posted by harleydude View Post
    Including built in support for all the various plug-ins will be difficult.
    That's absolutely true, just trying to do so would probably end up in a mess because there are so many and it would probably be impossible to keep up with changes over time.

    Quote Originally Posted by harleydude View Post
    However, there is already support for sending xPL messages from Scripting actions.
    Would it be possible to do it from a GUI, instead of through scripting?
    Using: Win7 MCE, Girder, xPL, RFXcom, HomeEasy

    http://www.thijsschreijer.nl

  8. #8
    Join Date
    Jul 2007
    Location
    Netherlands
    Posts
    368

    Default

    Just tried the plugin. Works very well.

    I added to your code, can you sent me a PM with your email address so I can sent you the code? (or an alternative means)

    Changes I made;
    • Store messages using rotation (max 50 messages stored)
    • added a Girder event for each message (eventstring: sourceaddress + schema), payload contains reference to the message received
    • bug fix; 'forus' was determined by source instead of target address

    All changes have been marked with 'Tieske' in comments

    Other items
    • Bug found, not fixed: In the Send action, the source and target address are switched (source should be fixed, target should be editable)
    • One thing I did wrong; I think I used the actionID in the girderevent instead of the plugin ID. That needs to be adjusted, but I couldn't find a plugin ID in the files.
    • Question; is there a specific reason for the message structure you choose? Wouldn't it be easier to create a message table with 6 elements; type, source, target, hop, schema and body, where body would then be a subtable with the key-value pairs? (a caveat here is that xPL messages can contain the same key multiple times, maybe its an idea to create the message as an object, with some functions to retrieve the values, to make it as easy as possible)


    Did you apply for an xPL vendor ID? (slyfox), if you didn't, then I wouldn't mind if you use mine (tieske), in that case I'll create and update the xPL applications description xml file (on the xPL site its referenced as the 'vendor plugin' file)
    Using: Win7 MCE, Girder, xPL, RFXcom, HomeEasy

    http://www.thijsschreijer.nl

  9. #9
    Join Date
    May 2004
    Location
    Dallas, TX
    Posts
    1,125

    Default

    New version uploaded in post #1.

    Tieske8,
    The plug-in has progressed since I last uploaded a version.

    I fixed a couple of the bugs you mentioned. I have also reformatted the parsing as you suggested, the original format was based on the xAP plug-in.

    For event triggering I opted for a different method. I did not see any reason to have the plug-in manage a queue for the messages, just create additional overhead. Whenever an xPL message is received, that is not a heartbeat, the plug-in triggers an event with the following:

    EventString: source:Schema=schema, ex: xpl-xplhal2.ncc1701e:Schema=tts.basic
    pld1: contains the actual parsed message received in a string

    Script Action to process received xPL messages:
    Code:
    require ('pickle')
    
    --split the EventString variable into source and schema
    local _, _, source, schema = string.find(EventString, "(.+):Schema=(.+)")
    
    --put the message data back into a table 
    local data = unpickle(pld1)
    table.print(data)
    
    --do something with the message
    --for this example grab the text and parse any other key/values
    --when done with speak the text
    local text
    local voice
    local volume
    
    for k,v in ipairs(data.body) do
    	if v.key == 'speech' then
    		text = v.value
    	elseif v.key == 'voice' then
    		voice = v.value
    	elseif v.key == 'volume' then
    		volume = tonumber(v.value)
    	end
    end
    Voice:SetVoice(voice)
    Voice:SetVolume(volume)
    Voice:Speak(text)
    Let me know how this works for you. I will eventually request a vendor ID for the plug-in, just wanted to make sure this made some progress before the request.

    Thank you for your request and suggestions on the development of this plug-in. I hope that others will add some input as well.
    Last edited by harleydude; February 12th, 2011 at 10:20 PM.
    Rick

    Girder 6.0 - Elk M1 Gold - JRMC 11.1 w/ M-Audio Delta 410 - NetRemote - BlueIris DVR
    Girder 6 Plugins - Elk M1/EZ8, Pushover Connector and more on the way.


    Visit My Showcase

  10. #10
    Join Date
    Jul 2007
    Location
    Netherlands
    Posts
    368

    Default

    exellent, will give it a try later. Using pickle to deliver the entire message in a payload value is indeed a far better solution than the rotation (bit rusty on my lua )
    Using: Win7 MCE, Girder, xPL, RFXcom, HomeEasy

    http://www.thijsschreijer.nl

Page 1 of 9 123 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •