pimatic / pimatic-homeduino

Pimatic plugin for using 433mhz devices and sensors with a connected Arduino with homeduino sketch
https://pimatic.org/
GNU General Public License v2.0
37 stars 29 forks source link

Connect via socket #95

Open Phunkafizer opened 4 years ago

Phunkafizer commented 4 years ago

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
  }
}
mwittig commented 4 years ago

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

Phunkafizer commented 4 years ago

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 notifications@github.com: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.

mwittig commented 4 years ago

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.

Phunkafizer commented 4 years ago

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.

louisvangeldrop commented 4 years ago

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 commented 4 years ago

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.