pimatic-homeduino icon indicating copy to clipboard operation
pimatic-homeduino copied to clipboard

Connect via socket

Open Phunkafizer opened this issue 5 years ago • 6 comments

Is there be a possibility to connect via socket instead of serial port?

E. g.

{
  "plugin": "homeduino",
  "driver": "socket",
  "driverOptions": {
    "host": "pi2.local",
    "port": 1752
  }
}

Phunkafizer avatar Jan 28 '20 13:01 Phunkafizer

Generally this is not supported at the moment, but it would be just a matter of implementing another driver in homeduinojs (see link below). The question is, however, what should what kind of implementation should be running on the receiver side (the board with transmitter and receiver). What are you trying to achieve?

https://github.com/pimatic/homeduinojs/tree/master/lib/driver

mwittig avatar Jan 28 '20 17:01 mwittig

One purpose is to have the possibility to install the hardware at a remote place (e. g. a second rasperry) and connect to it via network. Another purpose is writing an homeduino emulator which would be connected via network and send/receive via different Hardware, e. g. https://www.seegel-systeme.de/produkt/raspyrfm-ii/Am 28.01.2020 18:43 schrieb M Wittig [email protected]:Generally this is not supported at the moment, but it would be just a matter of implementing another driver in homeduinojs (see link below). The question is, however, what should what kind of implementation should be running on the receiver side (the board with transmitter and receiver). What are you trying to achieve? https://github.com/pimatic/homeduinojs/tree/master/lib/driver

—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.

Phunkafizer avatar Jan 28 '20 22:01 Phunkafizer

Makes sense to me. One of approach of doing this is to have a standalone application around homeduinojs. As part of this a UDP (or TCP) SerialPort bridge could be easily implemented to transmit serial port data via IP. For example, see udp-serialport which, however, is outdated as it has been built for a deprecated version of node-serialport.

Another approach is to build a RF Gateway which uses some higher layer protocol (e.g. Pimatic REST-API or MQTT) to send/receive command and status messages which map to pimatic devices. Some interesting work has been done in the past around the idea to implement a RF gateway on ESP8266. These projects are no longer maintained but if you are a developer it is worth having a look.

  • https://github.com/pimatic/homeduino-esp8266-node (proof of concept)
  • https://github.com/koffienl/ESPimaticRF/wiki / https://github.com/koffienl/ESPimaticRF (fairly advanced implementation, it should still be possible to get it up and running)

mwittig avatar Jan 29 '20 11:01 mwittig

Thank you for the links! The 1st project seems to work with http calls and only in receive-direction. The second project looks interessting, but it seems pimatic does not support UDP directly and needs a ESP8266 as an interface between UDP and serial. Is there a way to bring in the "UDP level" directly in pilight (or it's homeduino plugin)? This way a lot of overhead (MQTT, HTTP, ESP8266 interface) could be left out.

Phunkafizer avatar Feb 01 '20 00:02 Phunkafizer

Maybe a set of HC-12 serial transceivers may help you. One connects to the rx/tx of the arduino and the other to the USB port of the Raspberry Pi. For the homeduino plugin it looks as locally connected serial device.

louisvangeldrop avatar Mar 04 '20 17:03 louisvangeldrop

Another solution is to use pigpio-client. It supports remote access to the pigpiod-daemon running at a remote Raspberry-pi. A raspberrypi-zero W e.g. can handle the interrupts when using the glitchfilter.

louisvangeldrop avatar Mar 28 '20 18:03 louisvangeldrop