RFLink Gateway via Synology with Domoticz

433Mhz opensource Receiver & Transmitter.

Moderators: leecollings, Stuntteam

User avatar
Stuntteam
Posts: 399
Joined: Wednesday 06 May 2015 16:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: RFLink Gateway via Synology with Domoticz

Post by Stuntteam »

Ok, Great!! that explains part of the problem..
But the solution is not very nice as it will not allow reprogramming the board when the wire is cut.
Nothing wrong with that if you are going to program it manually (you need to press the reset button at the right moment then) but there is still the wish to get firmware updating within Domoticz.. which for sure will not work with the wire cut..

So far it seems that the reset-en is linked to the DTR-signal line on the serial port.
Either the DTR signal or "500ma is provided to the USB port".
As it does not happen on the Pi and Windows machines there might be something with the driver..
or possibly a solution within Domoticz..
Investigating this some more..
Did anyone try using a USB hub?
-=# RFLink Gateway Development Team #=-
Introduction: http://www.nemcon.nl/blog2/
Generic RFLink Support forum: http://www.esp8266.nu/forum/viewforum.php?f=8
User avatar
jumbotroll
Posts: 793
Joined: Tuesday 13 January 2015 14:36
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Oslo,Norway
Contact:

Re: RFLink Gateway via Synology with Domoticz

Post by jumbotroll »

datzmazzie wrote:I guess this means that we have to click on the reset button if we need to update the arduino firmware :-)
Or just put a peace of iron between the plates... Would be better if there was a jumper for RESET-EM instead of a 'wire'.

I have the arduino connected with the USB 2.0 port. Will test the 3.0 port tomorrow.
Do you have USB 3.0 on Synology DS214 Play?

I have soldered a switch on my Arduino ;)

Great that it is a solution for synology users with RFLink, but I use RFXCom on my Synology, only testing RFLink when I compile new versions of domoticz.

Regards
Jumbotroll
If you like the work I do for synology and domoticz, I appreciate a donation.
https://paypal.me/Jumbotroll
Regards
Jumbotroll
http://www.jadahl.com
User avatar
datzmazzie
Posts: 26
Joined: Tuesday 28 July 2015 12:01
Target OS: NAS (Synology & others)
Domoticz version: 2.3430
Location: Zoetermeer, The Netherlands
Contact:

Re: RFLink Gateway via Synology with Domoticz

Post by datzmazzie »

Stuntteam wrote: Did anyone try using a USB hub?
no, I tried it with an external power suply (500mA & 2A) but that was also not working.

@jumbotron
The 2 USB ports on the back are 3.0 and the front USB is 2.0.
Raspberry Pi 3B, Arduino Mega, RFLink
My Blog
User avatar
jumbotroll
Posts: 793
Joined: Tuesday 13 January 2015 14:36
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Oslo,Norway
Contact:

Re: RFLink Gateway via Synology with Domoticz

Post by jumbotroll »

I have tried with USB Hub and a 2A power supply, but that was not a solution.
Have also compiled different version of cdc-acm drivers from different kernels, but still the same problem.

Regards
Jumbotroll
If you like the work I do for synology and domoticz, I appreciate a donation.
https://paypal.me/Jumbotroll
Regards
Jumbotroll
http://www.jadahl.com
User avatar
Stuntteam
Posts: 399
Joined: Wednesday 06 May 2015 16:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: RFLink Gateway via Synology with Domoticz

Post by Stuntteam »

I used Termite to control the DTR line and indeed, whenever the DTR line state changes the Arduino gets reset.
I dont like the hardware reset fix very much, there must be a software solution..
Look at the answer given here: http://stackoverflow.com/questions/1138 ... uino-and-c

I am not sure yet if the DTR handling needs to be fixed on Domoticz side (I guess there would be more problems on other systems in that case) or needs to be fixed inside the driver or if it can be corrected by something like:
stty -F /dev/ttyUSB0 -hupcl or
stty -F /dev/ttyACM0 -hupcl

It also seems to be possible to update the Atmega that acts as serial chip on the Arduino
http://www.tinkerin.gs/2011/03/arduino- ... e-fix.html
and
https://www.arduino.cc/en/Hacking/DFUProgramming8U2
-=# RFLink Gateway Development Team #=-
Introduction: http://www.nemcon.nl/blog2/
Generic RFLink Support forum: http://www.esp8266.nu/forum/viewforum.php?f=8
User avatar
datzmazzie
Posts: 26
Joined: Tuesday 28 July 2015 12:01
Target OS: NAS (Synology & others)
Domoticz version: 2.3430
Location: Zoetermeer, The Netherlands
Contact:

Re: RFLink Gateway via Synology with Domoticz

Post by datzmazzie »

It's also working with USB 3.0.
Later this week I will try to add an jumper to the RESET-EM and will go on with a software solution.
Raspberry Pi 3B, Arduino Mega, RFLink
My Blog
idonl
Posts: 13
Joined: Sunday 16 August 2015 20:05
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: RFLink Gateway via Synology with Domoticz

Post by idonl »

I am also curious about a possible (software) solution. I am planning on ordering my RFLink gateway soon, the Arduino mega is already on its way.
My Domoticz is running on my Synology 214+, would be great to be able to use RFLink on it.

As problems seem to be in a USB driver? could synology support help in this case?
User avatar
thommy86
Posts: 3
Joined: Sunday 20 September 2015 16:01
Target OS: NAS (Synology & others)
Domoticz version:
Location: NL - Brabant
Contact:

Re: RFLink Gateway via Synology with Domoticz

Post by thommy86 »

Hoping for a clean solution! Testing on a Xpenology machine with the latest drivers!

2015-09-21 19:56:10.449 Hardware Monitor: Fetching data (System sensors)
2015-09-21 19:56:17.913 RFLink: Controller Initialized!...
2015-09-21 19:56:40.255 RFLink: Controller Initialized!..
* Raspberry Pi * RFLink * Philips Hue * Toon * USB Cam (motion) * Eurodomest switches * Doorbell *
idonl
Posts: 13
Joined: Sunday 16 August 2015 20:05
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: RFLink Gateway via Synology with Domoticz

Post by idonl »

Is it possible to show some pictures of the button/jumper solution, just to get an idea how you've done it.

I am at a crossroad, either investing in RFLink or RFXCOM to be connected to my synology. I don't mind cutting the RESET-EN, but I don't really understand what consequences this has.
Will I be able to only update the arduino manually, through USB instead through domoticz? or are there other downsides?

And where do I find the RESET-EN in this picture?
https://hifiduino.files.wordpress.com/2 ... _front.jpg
User avatar
jumbotroll
Posts: 793
Joined: Tuesday 13 January 2015 14:36
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Oslo,Norway
Contact:

Re: RFLink Gateway via Synology with Domoticz

Post by jumbotroll »

idonl wrote:Is it possible to show some pictures of the button/jumper solution, just to get an idea how you've done it.

I am at a crossroad, either investing in RFLink or RFXCOM to be connected to my synology. I don't mind cutting the RESET-EN, but I don't really understand what consequences this has.
Will I be able to only update the arduino manually, through USB instead through domoticz? or are there other downsides?

And where do I find the RESET-EN in this picture?
https://hifiduino.files.wordpress.com/2 ... _front.jpg
Cut the print after programming the arduino.
If you want to update software later, you only need to shortcut/solder RESET-EN.
Last edited by jumbotroll on Thursday 24 September 2015 11:06, edited 1 time in total.
If you like the work I do for synology and domoticz, I appreciate a donation.
https://paypal.me/Jumbotroll
Regards
Jumbotroll
http://www.jadahl.com
idonl
Posts: 13
Joined: Sunday 16 August 2015 20:05
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: RFLink Gateway via Synology with Domoticz

Post by idonl »

Thanks jumbotroll, its clear now. Now I also understand that it would have been easier if there would have been a jumper connection there :x

btw will this also work, adding a capacitor instead of breaking the line?
http://electronics.stackexchange.com/qu ... l-terminal

mm, here are more solutions
http://playground.arduino.cc/Main/Disab ... Connection
User avatar
jumbotroll
Posts: 793
Joined: Tuesday 13 January 2015 14:36
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Oslo,Norway
Contact:

Re: RFLink Gateway via Synology with Domoticz

Post by jumbotroll »

idonl wrote:Thanks jumbotroll, its clear now. Now I also understand that it would have been easier if there would have been a jumper connection there :x

btw will this also work, adding a capacitor instead of breaking the line?
http://electronics.stackexchange.com/qu ... l-terminal

mm, here are more solutions
http://playground.arduino.cc/Main/Disab ... Connection
That I don't have tested, but it should work :)

Regards
Jumbotroll
If you like the work I do for synology and domoticz, I appreciate a donation.
https://paypal.me/Jumbotroll
Regards
Jumbotroll
http://www.jadahl.com
User avatar
Stuntteam
Posts: 399
Joined: Wednesday 06 May 2015 16:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: RFLink Gateway via Synology with Domoticz

Post by Stuntteam »

I dont have an environment to test this yet.. but I would prefer a software solution rather than doing the cut of the reset line.
So a perl script would have to do:

Code: Select all

#!/usr/bin/perl 
use strict; 
use Device::SerialPort; 
my $port = Device::SerialPort->new("/dev/ttyUSB0");  // < use correct usb/serial port name here
$port->databits(8); 
$port->baudrate(57600);
$port->parity("none"); 
$port->stopbits(1); 
$port->dtr_active(0); 
Possibly we can also do a mod within the Domoticz / rflink serial port setup..
From your links:
On Linux you typically call tcsetattr
Before you call it you set

termios mode;
::memset(&mode,0,sizeof( mode));
tcgetattr(m_fd,& mode);
... other settings here
mode.c_cflag &= ~HUPCL; // disable hang-up-on-close to avoid reset
tcsetattr(m_fd,TCSANOW,&mode)

On Windows

DCB dcb;
GetCommState(m_hCom, &dcb);
... other settings here
dcb.fDtrControl = DTR_CONTROL_DISABLE; // disable DTR to avoid reset
SetCommState(m_hCom, &dcb);
Then do NOT call EscapeCommFunction(...) or anything like that to set DTR later
Maybe jumbotroll could build a test version with a small change in the unix.cpp
where in Serial::SerialImpl::reconfigurePort ()

the following line is added (on line 186 or so)
options.c_iflag &= (tcflag_t) ~HUPCL;

of course only as a test (It would break serial devices that require DTR) to see if that solves the reset issue..
If so, we can make code changes and apply this just for RFLink..(and possible other arduino projects)
-=# RFLink Gateway Development Team #=-
Introduction: http://www.nemcon.nl/blog2/
Generic RFLink Support forum: http://www.esp8266.nu/forum/viewforum.php?f=8
User avatar
jumbotroll
Posts: 793
Joined: Tuesday 13 January 2015 14:36
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Oslo,Norway
Contact:

Re: RFLink Gateway via Synology with Domoticz

Post by jumbotroll »

@stuntteam
I am not a coder, but do you want me to add this line like this?

options.c_oflag &= (tcflag_t) ~(OPOST);
options.c_iflag &= (tcflag_t) ~(INLCR | IGNCR | ICRNL | IGNBRK);
options.c_iflag &= (tcflag_t) ~HUPCL;
If you like the work I do for synology and domoticz, I appreciate a donation.
https://paypal.me/Jumbotroll
Regards
Jumbotroll
http://www.jadahl.com
User avatar
jumbotroll
Posts: 793
Joined: Tuesday 13 January 2015 14:36
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Oslo,Norway
Contact:

Re: RFLink Gateway via Synology with Domoticz

Post by jumbotroll »

Hi. I have tested to add options.c_iflag &= (tcflag_t) ~HUPCL; in /hardware/serial/impl/unix.cpp
Compiled to arch-x86 and tested on my synology DS712+.
I don't think this was the solution :(
RFLink keep Initializing.
If you like the work I do for synology and domoticz, I appreciate a donation.
https://paypal.me/Jumbotroll
Regards
Jumbotroll
http://www.jadahl.com
idonl
Posts: 13
Joined: Sunday 16 August 2015 20:05
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: RFLink Gateway via Synology with Domoticz

Post by idonl »

Cant test this yet, still waiting for my mega to arive.
https://www.arduino.cc/en/Main/ArduinoBoardMega2560
The Arduino/Genuino Mega 2560 board contains a trace that can be cut to disable the auto-reset. The pads on either side of the trace can be soldered together to re-enable it. It's labeled "RESET-EN". You may also be able to disable the auto-reset by connecting a 110 ohm resistor from 5V to the reset line
Can anybody verify this?
User avatar
Stuntteam
Posts: 399
Joined: Wednesday 06 May 2015 16:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: RFLink Gateway via Synology with Domoticz

Post by Stuntteam »

Yeah..that works.. but you might find the capacitor between reset and ground more interesting..
just stick the capaciter on the connector and pull it off when you want to reprogram..no need to cut tracks
-=# RFLink Gateway Development Team #=-
Introduction: http://www.nemcon.nl/blog2/
Generic RFLink Support forum: http://www.esp8266.nu/forum/viewforum.php?f=8
idonl
Posts: 13
Joined: Sunday 16 August 2015 20:05
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: RFLink Gateway via Synology with Domoticz

Post by idonl »

Yes you are right, 2 solutions, 1) capacitor or 2) resistor.

btw, just discovered that my cheap-ass Arduino clone doesnt have a RESET_EN on it, hopefully one of the 2 solutions is going to work

http://g03.a.alicdn.com/kf/HTB1QGUzIXXX ... ino-No.jpg
User avatar
jumbotroll
Posts: 793
Joined: Tuesday 13 January 2015 14:36
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Oslo,Norway
Contact:

Re: RFLink Gateway via Synology with Domoticz

Post by jumbotroll »

I bought some Arduino Mega from china . These use another driver ch341 , which I 've added to Synology in my latest packages .
This works without reset problems .
Check my website for pictures .

http://www.jadahl.com/rflink.html

This is dmesg output with this Arduino:
[83355.050122] Got empty serial number. Generate serial number from product.
[83355.060236] ch341 4-2:1.0: ch341-uart converter detected
[83355.078207] usb 4-2: ch341-uart converter now attached to ttyUSB1

This is the card I bougth:
http://www.aliexpress.com/item/Free-shi ... 50200.html

Regards
Jumbotroll
If you like the work I do for synology and domoticz, I appreciate a donation.
https://paypal.me/Jumbotroll
Regards
Jumbotroll
http://www.jadahl.com
User avatar
Stuntteam
Posts: 399
Joined: Wednesday 06 May 2015 16:39
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: RFLink Gateway via Synology with Domoticz

Post by Stuntteam »

GREAT news!!!
-=# RFLink Gateway Development Team #=-
Introduction: http://www.nemcon.nl/blog2/
Generic RFLink Support forum: http://www.esp8266.nu/forum/viewforum.php?f=8
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest