Programming the PMIX35 in good-old C...

Forum about Xanura, Eaton Holec and Marmitek and other brand X10 and A10 devices.
Post Reply
thewall
Starting Member
Starting Member
Posts: 36
Joined: Tue Jul 01, 2008 5:39 pm
Location: Netherlands
Contact:

Programming the PMIX35 in good-old C...

Post by thewall »

Hi there,
I'm still struggling with the right type of software to run my Xanura X10/A10 devices. Looked at HomeSeer, tried Misterhouse and Domotiga, but the last two where unsuccessful probably due to my lack of Linux environments. HomeSeer looks impressive but I reckon it is too featured ans too heavy workload for my purposes.

On the other hand what I require is not that fancy, and I'm figuring that if I know how to access the PMIX35 from a simple C(++) program, I would be out of the woods.
Any ideas how I control the PMIX35?

Thanks!
Bwired
Administrator
Administrator
Posts: 4704
Joined: Sat Mar 25, 2006 1:07 am
Location: Netherlands
Contact:

Programming the PMIX35 in good-old C...

Post by Bwired »

Yes its possible, check this topic, there is also link to the protocol document.
Its a very easy proctocol because it's readable text you receive, there are some pitfalls though.
http://www.domoticaforum.eu/viewtopic.php?f=8&t=776
Lempens
Member
Member
Posts: 265
Joined: Wed Dec 12, 2007 1:24 am
Location: Netherlands

Programming the PMIX35 in good-old C...

Post by Lempens »

I have made something in VB.net.
It can reset the USB connection if the PMIX35 hangs, it can detect on wich serial port the PMIX is connected, it can send command's en receive commando's.

The only thing is that I need to do, is filter some of the received commando's
thewall
Starting Member
Starting Member
Posts: 36
Joined: Tue Jul 01, 2008 5:39 pm
Location: Netherlands
Contact:

Programming the PMIX35 in good-old C...

Post by thewall »

Thanks Pieter. Lempens. I will look into the docs.
@ Lempens, can you then send a command to, let's say, DIM A8 to 90% or likewise? If so, I'm interested to have a look at your code, but since I'm on linux and my programming skills (if any :-) ) are at C I have to adapt, but don mind that....
What I'm wondering is how to address the PMIX from the C-code.
thewall
Starting Member
Starting Member
Posts: 36
Joined: Tue Jul 01, 2008 5:39 pm
Location: Netherlands
Contact:

Programming the PMIX35 in good-old C...

Post by thewall »

I have made something in VB.net.
It can reset the USB connection if the PMIX35 hangs, it can detect on wich serial port the PMIX is connected, it can send command's en receive commando's.

The only thing is that I need to do, is filter some of the received commando's
Hi Lempens,
Perhaps my request didn't catch your attention.
I'm trying to send some info to the PMIX35. In linux and C, that is. I'm playing around with the plain old echo-command and the info I get from the PMIX35 manual. I sent:

$>9000LW A02A02 AOFFAOFFB2#

to the device. The B2 is the checksum of the entire string.

I would expect the Data-led flickering or even the A02 lights to be switched off. But no.
Any clues where I go wrong?
How did you slved it in your app?

Thanks,__Frank
Bwired
Administrator
Administrator
Posts: 4704
Joined: Sat Mar 25, 2006 1:07 am
Location: Netherlands
Contact:

Programming the PMIX35 in good-old C...

Post by Bwired »

I use the CTX35 buts its the same commandset I guess
try $>28001A02A02 AOFFAOFFFB#
this should turn A02 OFF

<hr noshade size="1"><font size="1">Pieter Knuvers
http://www.bwired.nl <i>Online House in the netherlands. Domotica, Home Automation.</i></font id="size1">
Lempens
Member
Member
Posts: 265
Joined: Wed Dec 12, 2007 1:24 am
Location: Netherlands

Programming the PMIX35 in good-old C...

Post by Lempens »

@Thewall

There is something wrong with calculating your Checksum

Turn Lamp A2 On
"$>9000LW A02A02 AONAON10#"

Turn Lamp A2 Off
"$>9000LW A02A02 AOFFAOFF8C#"

Dimmen
"$>9000LWA[1]09003125#"
thewall
Starting Member
Starting Member
Posts: 36
Joined: Tue Jul 01, 2008 5:39 pm
Location: Netherlands
Contact:

Programming the PMIX35 in good-old C...

Post by thewall »

Indeed! I missed the spaces! Thanks, it works!
Best regards,__Frank
thewall
Starting Member
Starting Member
Posts: 36
Joined: Tue Jul 01, 2008 5:39 pm
Location: Netherlands
Contact:

Re: Programming the PMIX35 in good-old C...

Post by thewall »

Lempens wrote:@Thewall

There is something wrong with calculating your Checksum

Turn Lamp A2 On
"$>9000LW A02A02 AONAON10#"

Turn Lamp A2 Off
"$>9000LW A02A02 AOFFAOFF8C#"

Dimmen
"$>9000LWA[1]09003125#"
@Lempens,
Still struggling with the PMIX. I understand the ON and OFF commands, but I'm lost on the DIM and BGT part. I reckon you need the Extended command for dimming and brighten lamps. But how is the command build up?
I see and understand the first bit of the commandstring: "$>9000LW I don't see a space after the "W". Is that a typo or meant to be?
The [1] I understand as well. According to the documentation, the next 2 charachters in your string (09) represent the address. Then the next 4 chars should be the hex code, 0031, in your string. What does the 0031 represents? The amount of dimming? Or something else?

To put my question short: what command should I use to bright A04 to 50%. Some help is appreciated!
Thanks
Lempens
Member
Member
Posts: 265
Joined: Wed Dec 12, 2007 1:24 am
Location: Netherlands

Re: Programming the PMIX35 in good-old C...

Post by Lempens »

the 00 is het HEX number of the dim % 31 needs to folow.

$>9000LWA[1]092E313C# Wil dim to 46 %
thewall
Starting Member
Starting Member
Posts: 36
Joined: Tue Jul 01, 2008 5:39 pm
Location: Netherlands
Contact:

Re: Programming the PMIX35 in good-old C...

Post by thewall »

Hi Lempens,

Thanks! I didn have the time to play around with it yet.

A question that occurs next is how do you/does one knows what the hex command of DIM is? Or BGT or all the other commands. I looked on several places but I can't find it.

Any suggestions?

Regards,__Frank
Lempens
Member
Member
Posts: 265
Joined: Wed Dec 12, 2007 1:24 am
Location: Netherlands

Re: Programming the PMIX35 in good-old C...

Post by Lempens »

You can use Conversion.Hex(), to convert a decimal to HEX. You can use numbers from 0 to 63 where 0 = 0% 63= 100 %
You don't have to convert the text DIM or BGT to a HEX value. You only have to calculate a checksum over the whole string.

Code: Select all

    Public Function GenerateChecksum(ByVal data As String)
        Dim Som As Long
        Dim counter As Integer = 0
        Dim Workingdata As String
        Dim DataAsc As Integer
        Try
            Do While counter < data.Length
                Workingdata = data.Substring(counter, 1).ToString()
                DataAsc = Strings.Asc(Workingdata)
                counter += 1
                Som += DataAsc
            Loop
            data = Conversion.Hex(Som)
            If data.Length = 3 Then
                Console.WriteLine(data.Substring(1))
                Return data.Substring(1)
            Else
                Console.WriteLine(data)
                Return data
            End If
        Catch ex As Exception
            Return "Error"
        End Try
        Return "Error"
    End Function
thewall
Starting Member
Starting Member
Posts: 36
Joined: Tue Jul 01, 2008 5:39 pm
Location: Netherlands
Contact:

Re: Programming the PMIX35 in good-old C...

Post by thewall »

OK, thanks. The routine for calculating the checksum is done, in my case, under C/Linux. That part I do understand.

But still I keep strugling with the dim/bgt command. Sorry for being a pain, but I just don't see the logic in it. I think I miss some vital info on the command structure of the PMIX

for ON/OFF it is quite clear for the commands are in the string.

Which part of the following string represents the DIM command?

$>9000LWA[1]092E313C#
|| |_> 3C is the checksum
||_> 31 represents the hex val of 46 meaning 46% dim
||||||||___> 092E what does this represents? The docs states: Extended code hexadecimal. Is this the DIM command?

If you are fed up with me, let me know... :oops:
Post Reply

Return to “X10, A10 Xanura Marmitek Forum”