readme: how to simulate serial

This commit is contained in:
boyska 2023-08-18 17:17:57 +02:00
parent 665e95b83b
commit 6eb3da35eb

View file

@ -1,5 +1,4 @@
About
============
# About
Receive monitoring data from a [squeow](https://repo.esiliati.org/cesco/squeow) AM transmitter.
@ -10,8 +9,7 @@ webserver
webserver.py is such a webserver. It provides an authenticated API for receiving values (most likely by
read.py) and an unauthenticated API to get values.
Howto
------------
# Howto
### Dependencies
@ -29,8 +27,7 @@ apt install python3-fastapi python3-serial python3-requests
uvicorn webserver:app
```
Serial protocol
--------------------
# Serial protocol
### Goals
@ -84,8 +81,8 @@ Whatever follows is the actual message
This makes it possible for debug messages to be sent.
Monitoring
--------------
# Monitoring
None of the software provided will include monitoring functionalities. However, it will be easy to integrate
with an existing monitoring service:
@ -121,3 +118,31 @@ enough:
static_configs:
- targets: ['localhost:8000']
# Development
## Simulate a serial port
you might want to avoid developing with the squeow microcontroller actually connected to your computer, and
just simulate it.
if you want to do so, run:
```
socat -d -d pty,raw,echo=0 pty,raw,echo=0
```
Now, read the output; the first two lines would be sth like
```
2013/11/01 13:47:27 socat[2506] N PTY is /dev/pts/2
2013/11/01 13:47:27 socat[2506] N PTY is /dev/pts/3
```
This means that your `read.py` must use `--device /dev/pts/2`.
To simulate the reception of a message from the microcontroller, do this
```
echo -e '\x01DMP freq=1234567 temp1=78 temp2=50 alm_temp=0 ros=4095 alm_ros=1' > /dev/pts/3
```