Basic Home Automation via xAP BSC enabled devices (updated 9-01-2008) (1 Viewer)

ronsonol

MP Donator
  • Premium Supporter
  • April 2, 2007
    178
    23
    Kingston
    Home Country
    Canada Canada
    Patrick,

    I am not seeing the device status represented...it remains in the 'unknown state'.
    When I run the commands, queryplc d1 on and queryplc d1 dim I do not see anything returned, just a blank line from the command prompt. Will it supress error codes from the command prompt?

    If I omit something it tells me that the format is incorrect, so I'll assume your format is what it is expecting. I am also not sure how this queryplc is used, or if it works at all!

    I turned debug on in the logging options, and it returns this;
    5/19/2007 3:20:04 PM - AclStatusThread: Sending Arguments: queryplc d1 on
    5/19/2007 3:20:05 PM - AclStatusThread: Command Output Recvd:

    I know how difficult this must be to program for a device you cannot even test with, so I will do anything I can to help!

    Many thanks.
     

    ronsonol

    MP Donator
  • Premium Supporter
  • April 2, 2007
    178
    23
    Kingston
    Home Country
    Canada Canada
    Patrick, I found of a couple of things,

    first, the queryplc function as part of the ahcmd.exe is broken in the release I have. It always returns an errorcode of 0 (OFF) using this simple batch script.

    @echo off
    call "c:\Program Files\Common Files\X10\Common\ahcmd.exe" queryplc d1 on
    IF ERRORLEVEL 1 goto itson
    IF ERRORLEVEL 0 goto itsoff
    echo Unknown Status!
    goto end

    :itsoff
    echo Off!
    goto end

    :itson
    echo On!
    :end

    I found a message board where they were discussing the broken feature of the queryplc, and they included a fixed ahscript.dll. After using this version, the batch script, and the queryplc works fine.

    If the device is off - it goes to off, and the same for on. If no such device exists(ie. wrong address) if returns nothing - no error level, and the batch script returns with Unknown Status.

    I am not sure how your code is checking/receiving the errorlevel, but the logs indicate an empty respone.

    The above batch script seems to work fine with the updated dll, which I'll include here.

    Cheers,
     

    patrick

    Portal Pro
    April 20, 2005
    608
    45
    Southeast
    Home Country
    United States of America United States of America
    ronsonol,

    Thanks for the info and file!

    I think I just ran on a similar (or the same) post.
    Also finally ran on C# sample code for the SDK on the same board so thinking about
    what to do.

    Should not take too long, the code that sends command and queries the status
    is pretty isolated so should not take long to change.

    Also, did not know the output was returned as an error and was reading the standard output so this is probably why it still does not work.

    Thanks!
    patrick
     

    patrick

    Portal Pro
    April 20, 2005
    608
    45
    Southeast
    Home Country
    United States of America United States of America
    Ronsonol,

    I have not had time to test or put together the entire download
    but if you could try this new version just put the "Interop.ActiveHomeScriptLib.dll"
    in your MediaPortal folder and the new "BHAAhCmdLine.dll" in the
    "MediaPortal\plugins\BHAPlugins" folder and let me know what happens and
    info from the logging if there are problems that would be great.
    (Assuming you still have the full BHA plugin installed ;) )

    Thanks,
    patrick
     

    ronsonol

    MP Donator
  • Premium Supporter
  • April 2, 2007
    178
    23
    Kingston
    Home Country
    Canada Canada
    Hi Patrick,

    I've tried the new update, and the query function is working well. With the addition of the SDK the query time is almost immediate. A very nice touch. So the timed polling option may no longer be necessary, other than on startup.

    For binary devices, if picks up the on or off status. For dimmable devices, it also picks up the on, off, and dim level. Pictures working well too.

    The only trouble I see is the behaviour of the buttons, as mentioned in my first post. They still behave in the same fashion, where the bullseye toggle sends nothing - in any state, and the for dimmable devices, the on(bright) only sends the bright command, and the dim sends the off command.

    To recap;
    For dimmable devices (the 3 buttons) send bright, off, nothing.
    For binary devices (the 3 buttons) send on, off, nothing.

    Also, the issue I am having with changes not being save occur when you update a devices settings, maybe the picture, or category/location. If I close the plugin setup immedietly after making changes they are gone. If I click on another device already in the list before exiting, they are saved.

    Many thanks,
     

    patrick

    Portal Pro
    April 20, 2005
    608
    45
    Southeast
    Home Country
    United States of America United States of America
    Hi ronsonol,

    Thanks for the fast testing!

    To recap;
    For dimmable devices (the 3 buttons) send bright, off, nothing.
    For binary devices (the 3 buttons) send on, off, nothing.

    I think ;) I found the toggle button problem for both dimmable and binary devices.

    I made some changes to the code for checking the dim button on level devices
    but I am not sure this will fix it (maybe I am just looking at it too hard to see it :) )
    but maybe we will get lucky.


    Also, the issue I am having with changes not being save occur when you update a devices settings, maybe the picture, or category/location. If I close the plugin setup immedietly after making changes they are gone. If I click on another device already in the list before exiting, they are saved.

    Many thanks,

    Think I got this one now, saving the currently selected device on close.
    I was not thinking about just editing one device and closing, my bad.


    So new test files attached. (The saved settings fix should be in the next full upload).

    Thanks again for testing!
    patrick
     

    ronsonol

    MP Donator
  • Premium Supporter
  • April 2, 2007
    178
    23
    Kingston
    Home Country
    Canada Canada
    Patrick,

    The toggle switch is acting better, but now I see that this release is having trouble reconizing the device dim levels.

    The first posting you made, the query/updates were able to show the correct dim level, and appropriate bha image for dim level. Now it doesn't do that as well. For example, dim 10, show a dim level of 10, instead of 90. But later, when the timed polling comes around it seems to correct this based on the response back.

    Also, I wonder if it wouldn't just be easy to code/ more intuitive to use if you just have dedicated buttons - no toggles for the device. For example, a binary device has just two buttons (on/off) a dimmable device has four (on, off, bright, dim). The layout looks like it allows for four button nicely.
     

    patrick

    Portal Pro
    April 20, 2005
    608
    45
    Southeast
    Home Country
    United States of America United States of America
    ronsonol,

    Think I found the problem with recognizing the dim levels after a command.
    It was in handling the RecvAction sent after a command.

    I could not tell from your post but are the level commands (up/down) working
    (when the correct level is detected :) )?
    For example, when dim level 80 is detected, are you able to change it to 70 or 90?

    Also, I wonder if it wouldn't just be easy to code/ more intuitive to use if you just have dedicated buttons - no toggles for the device. For example, a binary device has just two buttons (on/off) a dimmable device has four (on, off, bright, dim). The layout looks like it allows for four button nicely.

    The toggle comes from xAP. It supports the toggle command natively.
    I could only get four buttons to look right in the skin, five made them look too small.
    So, for "level devices" I had to decide between up/down/on/off and up/down/toggle.
    (Although my graphics skills are so bad it was difficult to get a button to represent any of them much less toggle.)

    Thanks again!

    patrick
     

    ronsonol

    MP Donator
  • Premium Supporter
  • April 2, 2007
    178
    23
    Kingston
    Home Country
    Canada Canada
    Patrick,

    For dimmable, here is what I am seeing now; When the device is off, the first button still sends the bright command of 10 to turn it On. After polling now, dim is returned as 10, and the level image stays the same(yellow bars a tenth of the full image). If I send the bright command again, it shoots up to 20. After this I can dim back down to 10. If I dim again, the status turns to ON, with no yellow level bars in the image. If you know what I mean.

    I am not seeing the update to 90 like I was yesterday, but this may have been my mistake... I was also playing around with the remote for X10 I have. It will turn the device ON first, before it sends a dim command.

    I think the trouble here, when a device is off, the first button needs to send the ON command, not Bright 10. Using that sdk program from the forum you mentioned, when I turn on the lamp...the status shows as 100 in your plugin, with the correct image levels. Then, dim/bright work exactly as they should.

    If I use the toggle button, everything works as it should - the lamp goes on, 100%full image levels, and I can bright and dim as expected. Maybe this is how its suppose to work, I'm still a little unclear...I guess from using other software I get in the habit of pressing the first button to turn something on.

    Many thanks for all your great work,
     

    patrick

    Portal Pro
    April 20, 2005
    608
    45
    Southeast
    Home Country
    United States of America United States of America
    ronsonol,

    Ok, think I see what you are saying.
    I was assuming that sending the bright command would automatically turn the device On and set it to the specified level. And when dimmed to zero I thought
    it would automatically set the device to off.

    Let me make sure this is what you want:
    - When the device is off and the bright(up) button or toggle button is clicked you want to send the "ON" ONLY. (And this should set the level to 100%)
    - When dimmed to zero send the "dim" command and then send the "off" command.


    Thanks again,
    patrick
     

    Users who are viewing this thread

    Top Bottom