News:

LATEST RELEASE:  FPP 8.0 - Download from here - https://github.com/FalconChristmas/fpp/releases/tag/8.0

+-+-

+-User

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+-Site Stats

Members
Total Members: 16535
Latest: docwisdom
New This Month: 23
New This Week: 8
New Today: 1
Stats
Total Posts: 133232
Total Topics: 16565
Most Online Today: 32
Most Online Ever: 7634
(January 21, 2020, 02:14:03 AM)
Users Online
Members: 1
Guests: 24
Total: 25

API over serial?

Started by jsamytaylor, July 21, 2022, 07:55:31 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jsamytaylor

Ist there a way to send API commands over a serial port on a Beaglebone Controller?

I would like to make a Userinterface with an M5Stack Core2 (ESP32 based Board with Display). My Goal is to make a Userinterface where I can select Playlist to start..stop and so on. To send the commands I would use a serial port. Would be nice if there is a way to send API commands over serial communication. Maybe it is necessary to write a plugin or script?

Thanks for any answers!

dkulp

At this point, it would require a plugin.   It wouldn't be very hard to write and could easily be done in python or c++ or something.   If the UI can generate the JSON for the command, it could send that via serial and the plugin/script could just forward it directly via curl.

That said, the ESP32 has wifi built in.  Why use serial instead of over the network using the REST API?
Daniel Kulp - https://kulplights.com

jsamytaylor

Hi Daniel

I appreciate your fast reply! I used the REST API over Network before which worked very good. In this case I have a Standalone controller without Network connection. I know I could use GPIO inputs, but that would require more wiring and the flexibility is not good as controlling FPP over the API.
My Userinterface could send a JSON String over the serial port. I am not very good in coding. So writing a plugin or script is not my capability. 
Could you help me out or do you know someone who could do it for me? I am also willing to pay for the effort.

Thanks

CaptainMurdoch

I think you should be able to do this using "socat" and emulating a HTTP client on your ESP32, but it has been a while since I have messed with it.

Try the following:

sudo apg-get install -y socat
socat /dev/ttyS0,b115200,raw,echo=0 TCP:127.0.0.1:80

Change /dev/ttyS0 the proper device for the serial port and the 115200 speed to the correct value.  socat should create a two-way pipe between your serial port and the web server running on port 80.  From there, you can send HTTP requests over serial.  You might need to add ",keepalive" to the end of the TCP string.  If it works, you can create a script to run it inside a while loop in case socat dies.

#!/bin/sh

while /bin/true
do
    socat /dev/ttyS0,b115200,raw,echo=0 TCP:127.0.0.1:80
done
-
Chris

Support FPP

+- Recent Topics

PWM for GPIO control by tbone321
September 19, 2024, 11:03:50 PM

Pi Zero 2 W Help by docwisdom
September 19, 2024, 07:43:27 PM

Pause (and manually resume) after each playlist item by Poporacer
September 19, 2024, 09:41:40 AM

K2-Pi0 Unable to Start FPPD by JonD
September 19, 2024, 03:14:49 AM

New K16s by tetleytealeaf
September 18, 2024, 10:04:29 PM

Can Falcon Player support WPA3? by JonD
September 18, 2024, 05:05:28 AM

Falcon PiCap v2 failed upon upgrade to FPP v8 by darylc
September 17, 2024, 10:00:13 PM

MIDI input from Apple Mainstage by jjung
September 17, 2024, 10:19:20 AM

So in Xlights what RGB in string settings do I use to get the colors correct by tbone321
September 17, 2024, 09:58:14 AM

FPP V8 Plugins Needing Testing by deanathpc
September 17, 2024, 08:54:45 AM

Powered by EzPortal
Powered by SMFPacks Menu Editor Mod