Please login or register.

Login with username, password and session length

Author Topic: Problem with SDK turning on modules that use extended codes  (Read 5679 times)

JimAvanti

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 4
Problem with SDK turning on modules that use extended codes
« on: April 26, 2012, 04:56:56 PM »

I am having some weird issues with the SDK and VisualBasic.net.   I have found work-arounds, but I am curious if anyone knows why things don’t work the way they should.  I wrote a simple program with buttons that toggle x10 modules on and off.  I have the program query each device when it starts and highlights the button if it is on (And sets a variable to keep track of each button state so that it knows to turn off or on). 
The following code Handles ActiveHomeObj.RecvAction (Listens for activity and toggles buttons on/off depending on the results.  The code I commented out should have set the variable C1 to 0 or 1 depending on the status of the module and set the color of the button.  It worked for “off” and also worked for modules that use extended code 49, but would not work for “On”.  What I had to do instead was Query any module that activity was detected on and set the button color from the query result.

        Select Case vParm1
            Case "c1"
                C1 = ActiveHomeObj.SendAction("queryplc", ModCode1.Text & " on")
                x10Stream.AppendText(Mod1.Text & " Query=" & C1 & vbCrLf)
                If C1 = 1 Then
                    ButMod1.BackColor = Color.LightGreen
                Else
                    ButMod1.BackColor = Color.LightGray
                End If


                'If vParm2 = "Off" Then
                '    C1 = 0
                '    ButC1.BackColor = Color.LightGray
                'End If
                'If (vParm2 = "ExtCode" And vParm3 = 49) Or (vParm2 = "On") Then
                '    C1 = 1
                '    ButC1.BackColor = Color.LightGreen
                'End If

Another problem (a bigger problem) is that modules that use extended commands (Dimmers) don’t turn on or off when told to.  If I run ActiveHome along side my program and toggle buttons on/off in my program Active home also shows the switches toggle correctly, My program shows the switches toggle correctly and the query shows them toggle correctly, but modules that use extended codes don’t physically turn on or off.  If the module is dimmable and I turn it off the query shows “off” but if I send an “On” to a dimmable module the query shows the extended command for Dim full brightness (Code 49).  If I switch the same module “On” from ActiveHome Pro, the the Query shows “On” and the light physically works.
To overcome this problem temporarily I changed all dimmable light modules to appliance modules in Active Home and uploaded the changes.  Now when I send an “On” command it querys as “On” and the modules now turn on correctly.
The button click command in my program is simple.  I don’t send extended commands (Only On/Off) so it seems weird that extended commands are being sent.  I wouldn’t care, except for the fact the the modules don’t work with the extended commands.
    Private Sub ButModule1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButMod1.Click
        If C1 = 1 Then
            ActiveHomeObj.SendAction("sendplc", ModCode1.Text & " off")
        Else
            ActiveHomeObj.SendAction("sendplc", ModCode1.Text & " on")
        End If
    End Sub
Logged

Brian H

  • Community Organizer
  • Hero Member
  • ***
  • Helpful Post Rating: 301
  • Posts: 13094
Re: Problem with SDK turning on modules that use extended codes
« Reply #1 on: April 26, 2012, 06:28:38 PM »

Are your modules new enough to be Soft Start? Where they ramp On and Off in a few seconds.
Older X10 modules that are not soft start do not use extended commands.
The later versions of AHP have a Lamps Tab that has Soft Start modules and Old before Soft Start for older ones.

Since X10 modules are one way and do not transmit a status update when locally turned On and Off. queryplc gives you the last known state and could be incorrect if the module was locally changed.
« Last Edit: April 26, 2012, 06:59:10 PM by Brian H »
Logged

JimAvanti

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 4
Re: Problem with SDK turning on modules that use extended codes
« Reply #2 on: April 27, 2012, 09:40:35 AM »

They are most likely older non-soft start modules.  The thing that is weird though is when I send a "On" command from my program it sends extended codes to the dimmable lamp modules, but when I turn the same switch on unsing Active Home it sends the "On" command.  My program monitors all activity so I can see the difference between What Active Home sends and what my program sends.  I will play around with other module settings, but I would think that if I send "On" it shouldn't send extended codes no matter what module was selected.
Logged

Brian H

  • Community Organizer
  • Hero Member
  • ***
  • Helpful Post Rating: 301
  • Posts: 13094
Re: Problem with SDK turning on modules that use extended codes
« Reply #3 on: April 27, 2012, 10:25:31 AM »

I am sure someone with more SDK experience will chime in.
I know AHP itself has a choice in preferences to issue an On in place of a Bright 100%.
It does sound like the Soft Start Extended Bright 100% is being sent in place of the On.
The fact that if you define them as an appliance module where only On and Off are used corrected the problem. May also indicate the SDK is using extended commands and not a simple On Off and dimming by turning it On then dimming down from there. Used by old Lamp Modules.
Logged
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.