Home About Meetings FOSS

July 14 2020 Python venv, Tasmotizer, Sonoff and INDI

Posted on July 16, 2020
( 2 minute read )

Unfortunately, there were problems with the audio in particular this time which meant that several people who joined us left the meeting. For those who remained

Darren demonstrated a simplified version of cat(1), written in Dlang. It had only one loop, two variables, and three function calls to the D standard library.

Bernard demonstrated using Python virtual environments. First, members were asked to create a folder and copy an image into it; then, from within the folder, entering the following comments generated a series of copies of the original image which had been manipulated in various different ways:

python3 -m venv tempenv

source tempenv/bin/activate

(tempenv) pip install Pillow

Collecting Pillow
Downloading https://files.pythonhosted.org/packages/30/bf/92385b4262178ca22b34f82e0e09c2922eb351fe39f3cc7b8ba9ea555b41/Pillow-7.2.0-cp36-cp36m-manylinux1_x86_64.whl (2.2MB)
100% |████████████████████████████████| 2.2MB 998kB/s
Installing collected packages: Pillow
Successfully installed Pillow-7.2.0

(tempenv) python3

Python 3.6.10 (default, Jan 16 2020, 09:12:04) [GCC] on linux Type "help", "copyright", "credits" or "license" for more information.

>>> from PIL import Image, ImageFilter, ImageEnhance, ImageOps

>>> original = Image.open("original.jpg")

>>> newimage = original.filter(ImageFilter.BLUR)

>>> newimage.save("copy1.jpg")

>>> original.filter(ImageFilter.CONTOUR).save("copy2.jpg")

>>> original.filter(ImageFilter.EMBOSS).save("copy3.jpg")

>>> ImageEnhance.Contrast(original).enhance(1.5).save("copy4.jpg")

>>> ImageEnhance.Sharpness(original).enhance(2.0).save("copy5.jpg")

>>> ImageOps.autocontrast(original, cutoff=10).save("copy6.jpg")

>>> ImageOps.autocontrast(original, cutoff=20).save("copy7.jpg")

>>> greypic = ImageOps.grayscale(original)>>> greypic.save("copy8.jpg")

>>> ImageOps.colorize(greypic, black=(30,150,20),white=(240,10,99)).save("copy9.jpg")

>>>

(tempenv)

Enter Ctrl-D

deactivate

The advantage of using virtual environments is that you can use Python features without in any way affecting how Python is already installed on the system.

Brian directed us to the Tasmotizer which can install Tasmota, the open source firmware for ESP8266 devices, onto a device such as a Sonoff. Tasmota offers local control with quick setup and updates, using MQTT, Web UI, HTTP or serial. Brian demonstrated the WebUI, which gives you access to all the Tasmota configuration options.

Bernard introduced the Instrument Neutral Distributed Interface (INDI) developed to control, in particular, astronomical devices using the INDI library.