Hello, how can I achieve to connect an USB port (Serial device) to Appwrite, to use it on functions?
Hi there, thank you for your question, allow me a moment to look into it, can you once confirm which SDK are you using?
I will be using Python SDK. Thanks to you
Can you elaborate a bit on how you plan on using Appwrite with a USB device and/or share about your usecase so we can help you better?
Sure.
I'm going to capture some data from gas sensors using a RS485-USB adapter. Right now I'm testing in windows, but the machine that I'm going to use is gonna have Linux.
import minimalmodbus
import serial
def create_sensors(usb_port, num_sensors):
sensor_array = []
for i in range(num_sensors):
sensor = minimalmodbus.Instrument(usb_port, (i + 1))
sensor.serial.baudrate = 9600
sensor.serial.bytesize = 8
sensor.serial.parity = serial.PARITY_NONE
sensor.serial.stopbits = 1
sensor.serial.timeout = 0.05
sensor.mode = minimalmodbus.MODE_RTU
sensor.clear_buffers_before_each_transaction = True
sensor_array.append(sensor)
return sensor_array
This is a part of the code. An those are the libraries
I mean, I can use basic linux configuration to execute scripts directly from OS, but, I want to use Appwrite for everything, so I can figure out all its potential.
I hope I can do this
Unfortunately, this is currently not possible since the functions runtimes do not have access to the host's USB ports.
However never say never and we would love to discuss this over a Github issue, can you please open one issue as feature request here: https://github.com/appwrite/appwrite/issues
The workaround would be to use any esp-8266 enabled device like a node-mcu and transmit the sensor data to the appwrite database. This data can then be accessed inside the function. Please refer to this:
https://appwrite.io/docs/server/databases?sdk=python-default#databasesCreateDocument to sensor data
Oh, that is really sad. ESP is a nice idea, but I have to get the interface first.
Can functions runtimes access to some folder inside host's?
Function runtimes run completely isolated from the host. This is to prevent any kind of malicious code of one user, affecting other users using the same appwrite server and also to prevent malicious code from taking down the entire server.
Can I do something to change that? Any workaround?
Hey, talking of workarounds, I think CreateDocument would be the best but let me just confirm with my team if there is a better way
i think you need to create another docker container that has access enabled for serial and inside the function try to put the function container with the other serial enabled container in one instance btw search for multi-stage builds i believe it can be all done through the same function, let me know if you get there
Recommended threads
- One org lost all data out of 13 org's af...
> https://<domain>/v1/storage/buckets?queries%5B0%5D=%7B%22method%22%3A%22limit%22%2C%22values%22%3A%5B6%5D%7D&queries%5B1%5D=%7B%22method%22%3A%22offset%22%2C%...
- database documents relationships
after migrating from 1.7.4 to 1.8, database get document and list documents is getting results but with no relationship values, the relationship attribute will...
- deployment on every remote branch leads ...
Hi there, on my local appwrite instance it rebuilds my site on every deployment i make to github on every branch, even the main branch is set in the site settin...