stephan192 / hoermann_door

Control Hörmann doors directly via MQTT
MIT License
109 stars 16 forks source link

Compatibility with Lineamatic gate motors? #18

Closed fodi666 closed 1 year ago

fodi666 commented 1 year ago

Hi, I've just stumbled upon this project. I have a Lineamatic 2 gate motor that I'd like to add to Home Assistant. Is this project compatible with this motor? I think it is a Series 3 motor, but I'm not sure. Can I use the "venting" option for the "small gate" option (partial open)? Does it also report open-close-opening-closing-partially open state? Thanks

stephan192 commented 1 year ago

If your drive has number 2 in its name it is typically a series 2 motor which is NOT compatible with this project. Carefully read all closed issues here (especially #3 und #7) and the thread in the HA forum

fodi666 commented 1 year ago

I've found a pdf somewhere about the compatibility of the HCP module where it said Series 3: image (unfortunately it's in Hungarian, but "3-as sorozat" means "series 3") The motor's manual also states the UAP1 or the UAP1-300 as a compatible addon board. Can it be used in this case then? HCP_compatibility_overview_HU.pdf

stephan192 commented 1 year ago

I can't say, because I don't have one. You have to try it yourself.

fodi666 commented 1 year ago

Thanks, I'll try. One more question: can the PIC and the ESP be programmed on board, or do they need to be programmed before soldering them? If they can be programmed on board I could order the board presoldered from China and it would make my job a lot easier. If not, then I'll have to leave at least the PIC and the ESP unsoldered.

stephan192 commented 1 year ago

They can both be programmed "on board". To program the PIC connect a supported microchip programming tool to SV1. To programm the esp connect a USB-UART converter to SV3 and enter "programming mode" like described in the README.md

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been stalled for 7 days with no activity.

kovlo commented 8 months ago

Thanks, I'll try. One more question: can the PIC and the ESP be programmed on board, or do they need to be programmed before soldering them? If they can be programmed on board I could order the board presoldered from China and it would make my job a lot easier. If not, then I'll have to leave at least the PIC and the ESP unsoldered.

@fodi666 , did you manage to try this on Lineamatic? I'd be interested in it as well. Were you able to order the board assembled and even preprogrammed? If yes, please share the source with me.

fodi666 commented 6 months ago

@kovlo no time so far, sorry

realdimik commented 5 months ago

I have Lineamatic and yesterday I've connected a board to it. It correctly reports status of the gate, even "option relay", but It can't send any command :( I found that people had the same symptoms when they tried to use it with E4 ( https://community.home-assistant.io/t/hormann-garage-door-via-mqtt/279938/95 ). But I didn't change the pins, so it should be compatible with UAP 1, not with E4 series. I have currently no idea what to do next.

realdimik commented 4 months ago

I've reviewed the code of Stephan and debugged it with Lineamatic. I've got that master (Lineamatic by itself) doesn't not send slave status requests. After googling about the problem I found it in https://github.com/raintonr/hormann-hcp/issues/1 In that issue Stephan by himself gave an advise to Robin regarding the problem reason

Every message on the bus must start with a sync break (according to the LIN standard). A sync break are at least 13bits low, this is not the same as sending one or two zeros (each of them is only 8bits low). As the name says a sync break breaks the "normal" protocol frame to trigger an error = resync in every connected device.

I've reviewed JS code of Robin and found that he followed the advice and solved the problem by switching boudrate=9600 and databits=7 temporary for sending the syncbreak. https://github.com/raintonr/hormann-hcp/blob/master/hormann-hcp.js#L284

Robin also mentioned that in the answer to Stephan:

In fact, this can be achieved by setting the baud rate down to 9600, data bits to 7 then sending a zero, which in effect holds the transmit line high for long enough. Remembering to turn communications parameters back to normal before continuing.

I also found the same solution in one more repository https://github.com/steff393/hgdo/blob/master/src/uap.cpp#L209

But in the code of Stephan there is no such switching, just

/ Start with a Syncbreak / tx_counter = 0; TX1STAbits.SENDB = 1; TX1REG = 0x00;

https://github.com/stephan192/hoermann_door/blob/main/pic16/hoermann.c#L151

Unfortunately I have no experience with programming PIC controllers and serial communications. By reading the code and documentation I've got how to change bound rate (SP1BRG), but I have no idea how to change data bits. It is definitely possible image But I've not get it how to switch it.

It would be great if someone experienced (or @stephan192 by himself) can help me with that.

stephan192 commented 4 months ago

Hi @realdimik,

my software for the PIC issues a LIN conform syncbreak. The implementation of Robin for examle is just a workaround which seems to be working but is not what the standard requests.

For the PIC you found the right piece of code where the syncbreak is generated. It are just three lines of code. Please have a look at the datasheet (page 438 chapter 33.3.4) for more details.

/* Start with a Syncbreak */ tx_counter = 0; TX1STAbits.SENDB = 1; TX1REG = 0x00;

In conclusion: There is no need for baudrate change within my software!

If the Lineamatic doesn't sent slave status requests i currently don't see any chance to control the door via my board.

realdimik commented 4 months ago

Hi Stephan,

thank you for the reply. It is clear. My assumption was made based on that Robin got Lineamatic work, and I only needed to find the difference in approaches. But finally I found not a difference, but my misunderstanding of PIC registers that you've described.

I will try to research a bit more. I will try to simulate Lineamatic by PIC and connect it to Hormann ese-868-bs that I have, and log how slave scan reply looks like.

In case of not success, I have plan B: connect a toggle gate button in Lineamatic board to an ESP.

For logging currently I'm collecting all messages in long memory buffer and make a breakpoint when it full to grab it using watches in MPLab. Does more standard way for logging exist?

rgds, Dmitry

realdimik commented 4 months ago

I've simulated Lineamatic by PIC and got from ese-868-bs a slave scan reply similar to UAP1, but with addr=0x29 and type=0x10 (makes sense). I've also measured timing. ese-868-bs replies by 9ms, not 3ms. Then I sent the same slave scan reply using PIC to Lineamatic, but didn't get any slave status request with any timing from 3ms to 12ms :(

stephan192 commented 4 months ago

What do you mean by

I've simulated Lineamatic by PIC

The Lineamatic is the Master and the PIC or the ESE is the slave.

The "response delay" (3ms in my case) would be the next value i would start playing around, but you already did that. As far is a can remember is started with 0ms and my E3 didn't accept my slave can reply with 0ms delay.

My guess is that the Lineamatic doesn't accept/receive the slave scan reply by any reason. Normally the master keeps on sending the slave scan message until he receives a vaild reply. But, as far as i can remember, if it once has found a slave it never sends the slave scan again until the drive is reset.

I would do the following things as next steps:

  1. Connect an additional rs485 dongle to the bus and log the messages on a PC.
  2. Take an oszilloscope and measure the exact bus timings with the ESE.
realdimik commented 4 months ago

What do you mean by

I've rewrite the code in PIC to send the same packets with the same timing as master does (broadcast and bus scan only), connected PIC to ESE, and logged replies to catch a slave scan reply. And got it.

As far is a can remember is started with 0ms

I haven't checked less than 3ms. I will do it.

My guess is that the Lineamatic doesn't accept/receive the slave scan reply by any reason.

Mine is too.

But, as far as i can remember, if it once has found a slave it never sends the slave scan again until the drive is reset.

It could help me. 30 minutes ago I got a slave status request. I changed logger to get more info, but I didn't get it again even after switching Lineamatic power off and on. What do you mean by "drive is reset"?

stephan192 commented 4 months ago

What do you mean by "drive is reset"?

I mean performing a factory reset according to the drives manual. A power cycle is not enough.