Synchronizing file uploads between browser windows

For PiCockpit, I am currently developing the Digital Nose app. This app requires an upload for the BSEC configuration file – which is binary data. Once the user uploads the file, it gets published via MQTT, and picockpit-client can use it to configure the BSEC AI algorithm to do gas detection. Here is a little…

Weiterlesen

Vuetify :: Open detail row programmatically

For the upcoming PiCockpit v2.0 release, I am preparing a GPIO application. The GPIO entries are table rows – and to configure them, we want to be able to access the detail row by clicking on the configure button: clicking either the chevron or the configure button will lead to the detail row opening: Here…

Weiterlesen

enabling and disabling a systemd service in Python using DBus

The upcoming picockpit-client reacts to deletion events from the frontend by disabling it’s service (the application will stay installed, however). Similarly, when you decide to run picockpit-client connect again, the service will be re-enabled and started automatically for you. This is possible using the Python DBus interface. the DBus is a bus system for interacting…

Weiterlesen

How to set unique object ids in embedded documents across a MongoDB collection

MongoDB’s updateMany can be used to update all documents which are matched. Problem If, however, you want to set unique new ObjectIDs in your update, you would find that MongoDB sets the same ObjectID for every entry: db.getCollection(‘mypis_collectedpis’).updateMany({}, {$set:      {apps: {         “com.picockpit/core”: {             meta: {                 version: “2.0”,                 name: “PiCockpit Core”,                 image: “”,                 description: “PiCockpit.com…

Weiterlesen

Dealing with NIL in JSON::Any in Crystal Lang

One of the challenges when developing with Crystal is that it is not as forgiving about data types as, say, Python or Ruby. nil will keep you occupied. The following error message: cast from Nil to String failed, at /usr/share/crystal/src/json/any.cr:220:5:220 can be solved by: # cast to string, THEN check if it is nil if…

Weiterlesen

Chromium exit code -5

While running Chromium with chromium-browser –display=:0 https://www.picockpit.com will allow you to start Chromium from an SSH connection (and it will output to the main display in the X Server), this will fail when you try to run it with subprocess.Popen in Python: “command”: [“chromium-browser”, “–display=:0”, “https://picockpit.com”] (this is part of the JSON format I have…

Weiterlesen

secure command execution with Python: subprocess.Popen

Security is important for me while developing the picockpit-client. The following applies to Linux systems (but probably is applicable to all Unix like systems, including macOS) Python allows to run external commands using the subprocess module. import subprocess In the upcoming version of PiCockpit, users will be able to create their own buttons (simply editing…

Weiterlesen