more G-Labs products

Author Topic: X10 CM15Pro not working properly  (Read 18698 times)

January 15, 2015, 03:27:05 PM
Reply #30

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Hi bkenobi,

can you provide X10 output when missing the first command?
I just committed the new code to github. This includes major code refactoring to make the XTenLibrary more accessible to contributors (well none till now =)).
And also includes new X10 RF commands decoding capability.
So modules status will be now updated when receving RF commands.
Beside testing RF please repeat the previous tests also.
Can you compile from source? After compiling you will just need to replace XTenLib.dll and MIG.dll in hg folder.
If it's a problem compiling from source I will attach files here. Thanks for helping with this.

Cheers,
g.

January 15, 2015, 07:57:04 PM
Reply #31

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I was able to compile some code a few weeks back, but the modifications I made caused issues.  I think the compile was successful.  The real issue is that I have to dl the entire code pack each change, right?  On my connection that takes a while.

I'll update and rerun the tests but probably not until tomorrow evening.  The missed first command doesn't show anything interesting in the mono output, but I'll post the whole log from startup to first command for your review.

January 15, 2015, 08:04:07 PM
Reply #32

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I was just pointed to a document that describes the official specification on when modules become "addressed" and "unaddressed".  The specific text of interest is:

Quote
ADDRESS/FUNCTION
If D16 is a "1" the code is a function (command). Otherwise D1-D8 is
an 'address'. Once addressed, a module responds to any command code.
It becomes 'unaddressed' by the first 'address' message after a
command, or by 'All Units Off'.


The full document is:
http://davehouston.org/X10%20xtdcode.pdf

January 16, 2015, 03:44:54 AM
Reply #33

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I ran the attached test using the XTenLib you uploaded before.  I started HG, waited until all programs were started, and then attempted the following:
Code: [Select]
A2
A3
A4
A ON
As can be seen in the log, A2 was ignored.  I see that you have a note that this is fixed in the submitted github commit, so perhaps this is already corrected.

I am currently downloading the HG package so I can compile and try the new version.  It is possible for me to compile the XTenLib for sure, but I'm not sure about the rest of the package.  The real issue is that it takes a while to download the 15+MB package for just a few lines of change (slow on my connection for some reason).  If it's not too much trouble, it's certainly much easier for me to get the files here and copy them to the raspi than it is to compile locally.
« Last Edit: January 16, 2015, 03:47:45 AM by bkenobi »

January 16, 2015, 04:35:30 AM
Reply #34

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I compiled the code and copied XTenLib.dll and MIG.dll into the /usr/local/bin/homegenie directory. 

The files are:
mono (full test).log - the full test with full mono output
Test results3.txt - the same test results format as before

I noticed that there is an error that has been introduced in this version.  I could have created it when compiling bit wanted you to see it to be sure.

Code: [Select]
2015-01-15T19:18:36.1366590-08:00 HomeAutomation.HomeGenie.Automation 34 Automation Program Weather Underground Updated.
2015-01-15T19:18:37.7199650-08:00 HomeAutomation.HomeGenie.Automation NetHelper 501 Syntax error in arguments
Exception.StackTrace   at System.Net.Mail.SmtpClient.CheckStatus (SmtpResponse status, Int32 i) [0x00000] in <filename unknown>:0
  at System.Net.Mail.SmtpClient.Authenticate (System.String user, System.String password) [0x00000] in <filename unknown>:0
  at System.Net.Mail.SmtpClient.Authenticate () [0x00000] in <filename unknown>:0
  at System.Net.Mail.SmtpClient.SendCore (System.Net.Mail.MailMessage message) [0x00000] in <filename unknown>:0
  at System.Net.Mail.SmtpClient.SendInternal (System.Net.Mail.MailMessage message) [0x00000] in <filename unknown>:0
  at System.Net.Mail.SmtpClient.Send (System.Net.Mail.MailMessage message) [0x00000] in <filename unknown>:0

January 16, 2015, 11:14:57 AM
Reply #35

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Hi ben,

the SMTP syntax error is a message from the remote server that for some reason did not uderstand some message from the client.
Either .Net SMTP client is using some deprecated command that might not work with all smtp servers:
http://www.wenda.io/questions/1143659/c-sharp-smtp-auth-send-problem-syntax-error-in-parameter-or-arguments.html
or wrong characters are used in some parameter:
https://social.msdn.microsoft.com/Forums/windows/en-US/7644d037-bb69-41fb-addc-6c23488b6e13/systemnetmailsmtpclientsend-cannot-send-mail-in-windows-server-2003?forum=winforms

g.

January 16, 2015, 03:34:09 PM
Reply #36

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
The error appeared after program 34 and before program 1006:
Code: [Select]
2015-01-15T19:18:36.1366590-08:00 HomeAutomation.HomeGenie.Automation 34 Automation Program Weather Underground Updated.
2015-01-15T19:18:37.7199650-08:00 HomeAutomation.HomeGenie.Automation NetHelper 501 Syntax error in arguments
Exception.StackTrace   at System.Net.Mail.SmtpClient.CheckStatus (SmtpResponse status, Int32 i) [0x00000] in <filename unknown>:0
  at System.Net.Mail.SmtpClient.Authenticate (System.String user, System.String password) [0x00000] in <filename unknown>:0
  at System.Net.Mail.SmtpClient.Authenticate () [0x00000] in <filename unknown>:0
  at System.Net.Mail.SmtpClient.SendCore (System.Net.Mail.MailMessage message) [0x00000] in <filename unknown>:0
  at System.Net.Mail.SmtpClient.SendInternal (System.Net.Mail.MailMessage message) [0x00000] in <filename unknown>:0
  at System.Net.Mail.SmtpClient.Send (System.Net.Mail.MailMessage message) [0x00000] in <filename unknown>:0
2015-01-15T19:18:37.7232140-08:00 HomeAutomation.HomeGenie.Automation 1006 Automation Program Ip Information Mail send
I assumed it was an error from program 34 (Weather Underground) which is built in, but if the error were from the next program 1006 (CheckIP), that would make more sense.  That code is very simple, but it does send an email when the system starts up or after seeing the IP change for some reason.  I haven't changed that code in quite some time and all it does is a simple text email:
Code: [Select]
string recipients = Program.InputField("checkip.recipients").Value;
...
              var subject = "Homegenie ip address is changed";
              var messagetext = "The external ip address is changed from '" +
                                  Program.Parameter(IP).Value +
                                  "' to '" + ipdata + "'.";
           
              try
              {
                  Net.SendMessage( recipients, subject, messagetext );

The other thing I noticed about the update is that the RF commands are now being decoded which is good.  But, HG reacts to the RF command and then when the CM15A converts that to PLC and sends it out, HG reacts a second time.  This results in 2 commands for every one press.  When using RF, sending a single command is already difficult, so this could make dimming to specific levels in HG and in reality difficult.  If a dimmer is at 100% and you press the RF 2x, the light will toggle down 2x but HG will set the light to having been toggled 4x.  Perhaps it would be better if there was a way to not have HG interpret the PLC if RF just did the same thing?  Not sure what the spec would suggest but this may not be an issue for X10 itself since only a dual band module would see both and the only dual band devices are transceivers (non-dimmable) and controllers (don't have a module attached).
Code: [Select]
[19:54:11.126291] X10 > 5D 20 60 9F 00 FF
[19:54:11.129449] X10 > RFCOM: 5D 20 60 9F 00 FF
2015-01-15T19:54:11.1329210-08:00 HomeAutomation.X10 RF X10 RF Receiver Receiver.RawData 5D 20 60 9F 00 FF
2015-01-15T19:54:11.1364920-08:00 HomeAutomation.X10 A1 - Status.Level 1
[19:54:11.330564] X10 > 5D 20 60 9F 00 FF
[19:54:11.334171] X10 > RFCOM: 5D 20 60 9F 00 FF
2015-01-15T19:54:11.3380650-08:00 HomeAutomation.X10 A1 - Status.Level 1
[19:54:11.554628] X10 > 5A 02 00 66
[19:54:11.558057] X10 > PLCRX: 5A 02 00 66
[19:54:11.560873] X10 > FNMAP: 00
[19:54:11.563810] X10 >  DATA: 66
[19:54:11.567226] X10 >       0) Address = A1
[19:54:11.957579] X10 > 5A 02 01 62
[19:54:11.960951] X10 > PLCRX: 5A 02 01 62
[19:54:11.963930] X10 > FNMAP: 01
[19:54:11.966737] X10 >  DATA: 62
[19:54:11.970126] X10 >       0) House code = A
[19:54:11.973211] X10 >       0)    Command = ON
2015-01-15T19:54:11.9770180-08:00 HomeAutomation.X10 A1 - Status.Level 1
[19:54:11.982247] X10 > 55
[19:54:12.422649] X10 > 5A 02 00 66
[19:54:12.426087] X10 > PLCRX: 5A 02 00 66
[19:54:12.429004] X10 > FNMAP: 00
[19:54:12.431780] X10 >  DATA: 66
[19:54:12.435090] X10 >       0) Address = A1
2015-01-15T19:54:12.5779340-08:00 HomeAutomation.X10 RF X10 RF Receiver Receiver.RawData
[19:54:12.824679] X10 > 5A 02 01 62
[19:54:12.828137] X10 > PLCRX: 5A 02 01 62
[19:54:12.831025] X10 > FNMAP: 01
[19:54:12.833960] X10 >  DATA: 62
[19:54:12.837274] X10 >       0) House code = A
[19:54:12.840199] X10 >       0)    Command = ON
2015-01-15T19:54:12.8442950-08:00 HomeAutomation.X10 A1 - Status.Level 1
[19:54:12.849626] X10 > 55
[19:54:13.328334] X10 < 04 66
[19:54:13.745770] X10 > 55
[19:54:13.749211] X10 > COMMAND SUCCESSFUL
[19:54:13.753485] X10 < 06 63
[19:54:14.185786] X10 > 55
[19:54:14.189288] X10 > COMMAND SUCCESSFUL
2015-01-15T19:54:14.1943030-08:00 HomeAutomation.X10 A1 - Status.Level 0
[19:54:14.198205] X10 < 04 66
[19:54:14.617853] X10 > 55
[19:54:14.621531] X10 > COMMAND SUCCESSFUL
[19:54:14.625364] X10 < 06 63
[19:54:15.049918] X10 > 55
[19:54:15.053470] X10 > COMMAND SUCCESSFUL
2015-01-15T19:54:15.0585590-08:00 HomeAutomation.X10 A1 - Status.Level 0
[19:54:15.062577] X10 < 04 66
[19:54:15.481941] X10 > 55
[19:54:15.485524] X10 > COMMAND SUCCESSFUL
[19:54:15.489503] X10 < 06 63
[19:54:15.913987] X10 > 55
[19:54:15.917541] X10 > COMMAND SUCCESSFUL
2015-01-15T19:54:15.9222380-08:00 HomeAutomation.X10 A1 - Status.Level 0
[19:54:15.926435] X10 < 04 66
[19:54:16.346043] X10 > 55
[19:54:16.349621] X10 > COMMAND SUCCESSFUL
[19:54:16.353736] X10 < 06 63
[19:54:16.786099] X10 > 55
[19:54:16.789581] X10 > COMMAND SUCCESSFUL
2015-01-15T19:54:16.7944920-08:00 HomeAutomation.X10 A1 - Status.Level 0

January 16, 2015, 03:46:52 PM
Reply #37

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Hi bkenobi,

just wondering why my CM15 does not echoes RF commands with a PLC message.
Is that coming from another controller in your setup or is it something in my CM15?

Cheers,
g.

January 16, 2015, 05:13:04 PM
Reply #38

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I only have one CM15A installed and it's the one connected to the Raspi.  Do you have transcoding turned on or off in the CM15A?  If it's off, then it won't echo.  I suppose I could disable it to verify that's the difference.

January 16, 2015, 05:27:33 PM
Reply #39

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Transceive should be set to "Auto" on my cm15pro. HG does automatically configure the interface like this, or at least it is supposed to do so =)

g.

January 16, 2015, 06:20:05 PM
Reply #40

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
Was just a guess.  I remember that AHP had a setting for which HC to transcode.  If it wasn't selected, that HC would be ignored when incoming RF was transmitted.  Perhaps that's a different capability though.

All I know for sure is what the mono output showed.

  • 2 RF incoming commands (X10 > RFCOM: 5D 20 60 9F 00 FF)
  • 2 PLC incoming commands (X10 > PLCRX: 5A 02 00 66)
  • 4 HG set A1 ON
  • 4 HG set A1 OFF (due to script responding to ON commands)

Oh, this actually brings up one thing that I believe I mentioned before.  When using AHP, if using a RF push button controller (e.g., HR12A), quickly pressing and releasing a button will send 2 commands.  Both tell the system that the command is for the HC/UC with an action (e.g., A1 ON).  But, they also include some additional data for a button state.  So, the commands actually appear as:
Code: [Select]
A1 ON Button Down
A1 ON Button Up
This might be why HG sees 2 RF ON commands from the sequence I posted yesterday.  Maybe you could try to add the button position to the HG implementation?

January 16, 2015, 09:36:05 PM
Reply #41

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Well perhaps something is wrong with my CM15 transceiving  :), so I disabled the CM15 RF decoding in HG. Anyway that code can be used for W800RF32 driver.
I am not sure to understand what can be done in HG regarding this push button? What is this button position?

Cheers,
g.

January 16, 2015, 09:44:33 PM
Reply #42

pim555

  • ****
  • Information
  • Sr. Member
  • Posts: 143
Tried replacing the XTenLib.dll and .mdb files but after moving back to the original files, I start seeing below error messages in the log. One point to notice is that I accidently moved the .dll/.dll.mdb files away before stopping HG. Any idea how to fix this?

[20:30:30.073180] X10 < 04 6F
[20:30:30.086782] X10 ! The object was used after being disposed.
[20:30:30.098106] X10 !   at System.Runtime.InteropServices.SafeHandle.DangerousGetHandle () [0x00000] in <filename unknown>:0
  at LibUsbDotNet.LudnMonoLibUsb.Internal.MonoUsbTransferContext.Fill (IntPtr buffer, Int32 offset, Int32 count, Int32 timeout) [0x00000] in <filename unknown>:0
  at LibUsbDotNet.Main.UsbTransfer.Fill (System.Object buffer, Int32 offset, Int32 count, Int32 timeout) [0x00000] in <filename unknown>:0
  at LibUsbDotNet.Main.UsbEndpointBase.SubmitAsyncTransfer (System.Object buffer, Int32 offset, Int32 length, Int32 timeout, LibUsbDotNet.Main.UsbTransfer& transferContext) [0x00000] in <filename unknown>:0
  at XTenLib.Drivers.CM15.WriteData (System.Byte[] bytesToSend) [0x00000] in <filename unknown>:0
  at XTenLib.XTenManager.SendMessage (System.Byte[] message) [0x00000] in <filename unknown>:0

January 16, 2015, 10:57:29 PM
Reply #43

pim555

  • ****
  • Information
  • Sr. Member
  • Posts: 143
Pls disregard my previous post, I had udev rules set up to start a Mochad daemon that was giving conflicts.

I think I know why I am seeing address commands repeated on my network. I have and Eaton FKX40 phase coupler that also has a repeater function. See in the manual
http://www.whomedigital.com.au/productfile239

On the marmitek website it says that every x10 command is always transmitted 2x in a row. The FKX40 detects the first command and immediately repeats such that it coincides with the second (in Dutch below)

De CAT4000 / FKX40 zorgt voor geen vertraging van het X-10 signaal. Elk X-10 commando wordt altijd 2 x achter elkaar verstuurd. De CAT4000 / FKX40 zal bij ontvangst van het eerste commando dit commando gelijk herhalen, zodat het gelijk valt met het 2de commando van de bron.

Could this maybe be the reason that I see the PLCRX in my logs when executing commands from HG UI? And furthermore, does HG really send commands twice in a row?

Btw, I noticed that in the .dll files posted in this threat my first issue, ie the first command after reboot not executing has been fixed. Thanks for that.

January 17, 2015, 01:03:50 AM
Reply #44

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
Quote
I have and Eaton FKX40 phase coupler that also has a repeater function.
...
Could this maybe be the reason that I see the PLCRX in my logs when executing commands from HG UI? And furthermore, does HG really send commands twice in a row?


Short answer: no.  The structure of an X10 command always sends 2 copies of the same sequence when transmitting.  If the second doesn't match, the command is considered invalid.  This is not considered 2 commands, it is the definition of how a single X10 command is structured.  If you want more information about X10 protocol:

http://digilander.libero.it/cvolpato/elettronica/X-10_Transmission_Theory.htm
« Last Edit: January 17, 2015, 05:53:21 AM by bkenobi »