Allgemein

How to prevent redmine always logging out

In Redmine, by default you are always logged out after a very short period of time.

You can fix this by logging in as an administrator and opening Administration -> Settings -> Authentication and setting Autologin to 365 days. You can also choose a lower value if you want sessions to automatically expire sooner.

Posted by Uli Köhler in Allgemein

Python curses keycode to key mapping

The following mapping is helpful in order to determine the mapping of a keycode to the corresponding curses.KEY_... constant.

I extracted this mapping by using

import curses
print(curses.__dict__)

Curses key mapping

'A_ATTRIBUTES': 4294967040,
'A_NORMAL': 0,
'A_STANDOUT': 65536,
'A_UNDERLINE': 131072,
'A_REVERSE': 262144,
'A_BLINK': 524288,
'A_DIM': 1048576,
'A_BOLD': 2097152,
'A_ALTCHARSET': 4194304,
'A_INVIS': 8388608,
'A_PROTECT': 16777216,
'A_CHARTEXT': 255,
'A_COLOR': 65280,
'A_HORIZONTAL': 33554432,
'A_LEFT': 67108864,
'A_LOW': 134217728,
'A_RIGHT': 268435456,
'A_TOP': 536870912,
'A_VERTICAL': 1073741824,
'A_ITALIC': 2147483648,
'COLOR_BLACK': 0,
'COLOR_RED': 1,
'COLOR_GREEN': 2,
'COLOR_YELLOW': 3,
'COLOR_BLUE': 4,
'COLOR_MAGENTA': 5,
'COLOR_CYAN': 6,
'COLOR_WHITE': 7,
'BUTTON1_PRESSED': 2,
'BUTTON1_RELEASED': 1,
'BUTTON1_CLICKED': 4,
'BUTTON1_DOUBLE_CLICKED': 8,
'BUTTON1_TRIPLE_CLICKED': 16,
'BUTTON2_PRESSED': 64,
'BUTTON2_RELEASED': 32,
'BUTTON2_CLICKED': 128,
'BUTTON2_DOUBLE_CLICKED': 256,
'BUTTON2_TRIPLE_CLICKED': 512,
'BUTTON3_PRESSED': 2048,
'BUTTON3_RELEASED': 1024,
'BUTTON3_CLICKED': 4096,
'BUTTON3_DOUBLE_CLICKED': 8192,
'BUTTON3_TRIPLE_CLICKED': 16384,
'BUTTON4_PRESSED': 65536,
'BUTTON4_RELEASED': 32768,
'BUTTON4_CLICKED': 131072,
'BUTTON4_DOUBLE_CLICKED': 262144,
'BUTTON4_TRIPLE_CLICKED': 524288,
'BUTTON5_PRESSED': 2097152,
'BUTTON5_RELEASED': 1048576,
'BUTTON5_CLICKED': 4194304,
'BUTTON5_DOUBLE_CLICKED': 8388608,
'BUTTON5_TRIPLE_CLICKED': 16777216,
'BUTTON_SHIFT': 67108864,
'BUTTON_CTRL': 33554432,
'BUTTON_ALT': 134217728,
'ALL_MOUSE_EVENTS': 268435455,
'REPORT_MOUSE_POSITION': 268435456,
'KEY_BREAK': 257,
'KEY_DOWN': 258,
'KEY_UP': 259,
'KEY_LEFT': 260,
'KEY_RIGHT': 261,
'KEY_HOME': 262,
'KEY_BACKSPACE': 263,
'KEY_F0': 264,
'KEY_F1': 265,
'KEY_F2': 266,
'KEY_F3': 267,
'KEY_F4': 268,
'KEY_F5': 269,
'KEY_F6': 270,
'KEY_F7': 271,
'KEY_F8': 272,
'KEY_F9': 273,
'KEY_F10': 274,
'KEY_F11': 275,
'KEY_F12': 276,
'KEY_F13': 277,
'KEY_F14': 278,
'KEY_F15': 279,
'KEY_F16': 280,
'KEY_F17': 281,
'KEY_F18': 282,
'KEY_F19': 283,
'KEY_F20': 284,
'KEY_F21': 285,
'KEY_F22': 286,
'KEY_F23': 287,
'KEY_F24': 288,
'KEY_F25': 289,
'KEY_F26': 290,
'KEY_F27': 291,
'KEY_F28': 292,
'KEY_F29': 293,
'KEY_F30': 294,
'KEY_F31': 295,
'KEY_F32': 296,
'KEY_F33': 297,
'KEY_F34': 298,
'KEY_F35': 299,
'KEY_F36': 300,
'KEY_F37': 301,
'KEY_F38': 302,
'KEY_F39': 303,
'KEY_F40': 304,
'KEY_F41': 305,
'KEY_F42': 306,
'KEY_F43': 307,
'KEY_F44': 308,
'KEY_F45': 309,
'KEY_F46': 310,
'KEY_F47': 311,
'KEY_F48': 312,
'KEY_F49': 313,
'KEY_F50': 314,
'KEY_F51': 315,
'KEY_F52': 316,
'KEY_F53': 317,
'KEY_F54': 318,
'KEY_F55': 319,
'KEY_F56': 320,
'KEY_F57': 321,
'KEY_F58': 322,
'KEY_F59': 323,
'KEY_F60': 324,
'KEY_F61': 325,
'KEY_F62': 326,
'KEY_F63': 327,
'KEY_DL': 328,
'KEY_IL': 329,
'KEY_DC': 330,
'KEY_IC': 331,
'KEY_EIC': 332,
'KEY_CLEAR': 333,
'KEY_EOS': 334,
'KEY_EOL': 335,
'KEY_SF': 336,
'KEY_SR': 337,
'KEY_NPAGE': 338,
'KEY_PPAGE': 339,
'KEY_STAB': 340,
'KEY_CTAB': 341,
'KEY_CATAB': 342,
'KEY_ENTER': 343,
'KEY_SRESET': 344,
'KEY_RESET': 345,
'KEY_PRINT': 346,
'KEY_LL': 347,
'KEY_A1': 348,
'KEY_A3': 349,
'KEY_B2': 350,
'KEY_C1': 351,
'KEY_C3': 352,
'KEY_BTAB': 353,
'KEY_BEG': 354,
'KEY_CANCEL': 355,
'KEY_CLOSE': 356,
'KEY_COMMAND': 357,
'KEY_COPY': 358,
'KEY_CREATE': 359,
'KEY_END': 360,
'KEY_EXIT': 361,
'KEY_FIND': 362,
'KEY_HELP': 363,
'KEY_MARK': 364,
'KEY_MESSAGE': 365,
'KEY_MOVE': 366,
'KEY_NEXT': 367,
'KEY_OPEN': 368,
'KEY_OPTIONS': 369,
'KEY_PREVIOUS': 370,
'KEY_REDO': 371,
'KEY_REFERENCE': 372,
'KEY_REFRESH': 373,
'KEY_REPLACE': 374,
'KEY_RESTART': 375,
'KEY_RESUME': 376,
'KEY_SAVE': 377,
'KEY_SBEG': 378,
'KEY_SCANCEL': 379,
'KEY_SCOMMAND': 380,
'KEY_SCOPY': 381,
'KEY_SCREATE': 382,
'KEY_SDC': 383,
'KEY_SDL': 384,
'KEY_SELECT': 385,
'KEY_SEND': 386,
'KEY_SEOL': 387,
'KEY_SEXIT': 388,
'KEY_SFIND': 389,
'KEY_SHELP': 390,
'KEY_SHOME': 391,
'KEY_SIC': 392,
'KEY_SLEFT': 393,
'KEY_SMESSAGE': 394,
'KEY_SMOVE': 395,
'KEY_SNEXT': 396,
'KEY_SOPTIONS': 397,
'KEY_SPREVIOUS': 398,
'KEY_SPRINT': 399,
'KEY_SREDO': 400,
'KEY_SREPLACE': 401,
'KEY_SRIGHT': 402,
'KEY_SRSUME': 403,
'KEY_SSAVE': 404,
'KEY_SSUSPEND': 405,
'KEY_SUNDO': 406,
'KEY_SUSPEND': 407,
'KEY_UNDO': 408,
'KEY_MOUSE': 409,
'KEY_RESIZE': 410,
'KEY_MIN': 257,
'KEY_MAX': 511}

 

Posted by Uli Köhler in Allgemein

How to setup ZeroTier One & ZTNCUI using docker-compose in just 2 minutes

First, create a directory for the ZeroTier One / ZTNCUI files to reside in, e.g.:

mkdir /opt/zerotier-mydomain

Now, create docker-compose.yml in that directory

version: '3.4'

services:
  ztncui:
    container_name: ztncui
    restart: always
    image: keynetworks/ztncui
    ports:
      - 9993:9993/udp
      - 3180:3180
      - 3443:3443
    volumes:
      - ./etc:/opt/key-networks/ztncui/etc
      - ./zt1:/var/lib/zerotier-one   

After that, create .env in said directory containing some info about your node:

NODE_ENV=production
HTTPS_PORT=3443
MYDOMAIN=zerotier.mydomain.com

Now we’ll use the script from Create a systemd service for your docker-compose project in 10 seconds in order to create a systemd service to automatically run the service:

curl -fsSL https://techoverflow.net/scripts/create-docker-compose-service.sh | sudo bash /dev/stdin

This script will also automatically start the service (i.e. docker-compose up). ZTNCUI (which comes packaged with ZeroTier One) will generate a temporary admin password automatically, which we can extract from the log using this simple command:

docker-compose exec ztncui cat /var/log/docker-ztncui.log | grep "Current Password" | tail -n 1

Example output:

2022/08/19 14:32:37 Current Password: esh0Eengai

Be sure to open the ports 9993/udp, 3180 and (unless you are using a reverse proxy) 3443 in your firewall, for example:

sudo ufw allow 9993/udp
sudo ufw allow 3180
sudo ufw allow 3443

Now we can open https://[IP]:3443 to open the webinterface (ignore the certificate validation error). You can also setup a reverse proxy at this stage, which we’ll cover in future posts.

You should see a page like this one:

Click Login at the top right:

Enter admin as username and the password we extracted above (esh0Eengai in this example).

You will be asked to change your password, and after that you can create ZeroTier networks.

Posted by Uli Köhler in Allgemein, Networking, ZeroTier

Where to find ESP32S2 bare chip reference schematic?

If you are not using the ESP32S2 as a module but as a chip, you need a reference schematic to check if you have errors in a schematic.

A good place to start is by checking out the schematic of the ESP32S2-MINI, which you can find on page 19 & 20 of the module datasheet.

Posted by Uli Köhler in Allgemein

How to import mbox file in Thunderbird

  1. Install ImportExportTools NG
  2. Right click on Local folders and in the context menu, in the ImportExportTools NG menu, click on Import mbox file
Posted by Uli Köhler in Allgemein

How to add filename extension to every file in directory

This shell script will rename every file in a directory recursively and add a .docx extension to its filename (even if there is already an extension), preventing overwriting existing files of the same name via mv --backup=numbered:

find . -type f -exec mv -v --backup=numbered "{}" "{}.docx" \;

 

Posted by Uli Köhler in Allgemein

How to configure SMTP server on MikroTik RouterOS

Use the following command in order to configure SMTP settings for a MikroTik router:

/tool e-mail set address=smtp.mydomain.com from="MikroTik <[email protected]>" tls=starttls [email protected] password=uFoome0Noh

Alternatively, you can configure these settings directly on the web interface at WebFig => Tools => EMail.

Posted by Uli Köhler in Allgemein

SSH to LXC container with Pubkey

ssh [user]@[my-container-address]

Problem

[user]@[my-container-address] Permission denied (publickey). 

Solution

Change the sshd_config

vim /etc/ssh/sshd_config 

from this

# PubkeyAuthentication no

to this

PubkeyAuthentication yes

.
Do not forget to add your pubkey to your authorized keys.

mkdir /home/[myuser]/.ssh & vim /home/[myuser]/.ssh/authorized_keys
Posted by Joshua Simon in Allgemein

LXC container share host network

Goal

You want to share the host network with all your lxc containers.

Check network settings of your containers by typing:

lxc network list

If it displays something like that:

+---------+----------+---------+-------------+---------+
|  NAME   |   TYPE   | MANAGED | DESCRIPTION | USED BY |
+---------+----------+---------+-------------+---------+
| docker0 | bridge   | NO      |             | 0       |
+---------+----------+---------+-------------+---------+
| eth0    | physical | NO      |             | 0       |
+---------+----------+---------+-------------+---------+

Solution

Set up your container with the default settings of LXD, creating a network for all containers attached to the newly created lxdbr0 adapter on the host system with

lxd init

and accept the defaults:

Would you like to create a new local network bridge? (yes/no) [default=yes]:
What should the new bridge be called? [default=lxdbr0]:                                                             

and have your containers already connected to the lxdbr0 bridge on your host.
You might now see something like this.

+---------+----------+---------+-------------+---------+
|  NAME   |   TYPE   | MANAGED | DESCRIPTION | USED BY |
+---------+----------+---------+-------------+---------+
| docker0 | bridge   | NO      |             | 0       |
+---------+----------+---------+-------------+---------+
| eth0    | physical | NO      |             | 0       |
+---------+----------+---------+-------------+---------+
| lxdbr0  | bridge   | YES     |             | 5       |
+---------+----------+---------+-------------+---------+

Now try it

lxc exec [mycontainer] /bin/bash                                               
curl https://techoverflow.net
Posted by Joshua Simon in Allgemein

OctoPrint: Pause/Resume G-Code to move nozzle away

This pause / resume G-Code for OctoPrint (will likely also work with other platforms, but we only tested using OctoPrint) will move the nozzle 100mm away from the part being printed during the pause and (after clicking resume) will move to the original position i.e. it will continue the print normally.

This is useful to prevent heat damage to the part and also allow you to clean the nozzle during pause

Pause G-Code:

G91 ; Set relative positioning mode
G0Z100 ; Move Z up 100mm to assist nozzle cleaning
G90 ; Set absolute positioning mode

Resume G-Code:

G91 ; Set relative positioning mode
G0Z-100 ; Move Z down 100mm to return to print position
G90 ; Set absolute positioning mode
Posted by Uli Köhler in Allgemein

Excel: How to replace formula cell by its value

TL;DR: Press F2, then F9 to replace a cell by its value.

Click on the formula cell (click once, no need to click twice):

Now press the F2 key to edit the cell:

Now press the F9 key to replace the cell by its value:

Posted by Uli Köhler in Allgemein

How to fix MANIFEST.in graft having no effect on Windows

Problem:

In your MANIFEST.in, you have a line like

graft src/

but when you run

python setup.py sdist

some file in src is not included in the archive

Solution:

This is due to the slash at the end of src/! The slash works fine on Linux, but on Windows, backslashes are used to separate directory names. You can just remove the slash after src, it doesn’t serve any purpose on Windows or Linux:

graft src

After that, retry and you should see your file being included in the sdist archive.

Posted by Uli Köhler in Allgemein

Insurgency: Which RCON client should you use?

For most users, the in-game console is the best RCON client to use since you don’t need to install separate software and it has auto-complete features. See Insurgency: How to connect to RCON using the in-game console for a guide how to connect to RCON using said console.

Posted by Uli Köhler in Allgemein

Insurgency: How to connect to RCON using the in-game console

First, open the console using the configured hotkey (default: The key directly left of the 1 key). If that doesn’t work, remap the key in the settings.

Then enter

rcon_password "mypassword"

to set the password to connect to the RCON server.

Now you can use admin commands in the format

rcon <command>

 

Posted by Uli Köhler in Allgemein

Insurgency: How to configure RCON password on the server

In server.cfg, add or edit the following line to set the RCON password

rcon_password "mypassword"

and then restart the server.

Posted by Uli Köhler in Allgemein

Which port does Insurgency’s RCON server listens on?

Insurgency’s rcon server listens on port 27015.

Posted by Uli Köhler in Allgemein

How to fix PlatformIO pio remote agent start: fatal error: ffi.h: No such file or directory

Problem:

Go to solution

When running pio remote agent start, during the package installation process, you see an error log like

ERROR: Command errored out with exit status 1:
 command: /home/pi/.platformio/penv/bin/python /tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-z_7hwbt9/overlay --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.org/simple --extra-index-url https://www.piwheels.org/simple -- 'setuptools>=40.6.0' wheel 'cffi>=1.12; platform_python_implementation != '"'"'PyPy'"'"'' 'setuptools-rust>=0.11.4'
     cwd: None
Complete output (284 lines):
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple, https://www.piwheels.org/simple
Collecting setuptools>=40.6.0
  Using cached setuptools-59.3.0.tar.gz (2.3 MB)
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Collecting wheel
  Using cached wheel-0.37.0.tar.gz (65 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting cffi>=1.12
  Using cached cffi-1.15.0.tar.gz (484 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting setuptools-rust>=0.11.4
  Using cached setuptools-rust-1.0.0.tar.gz (279 kB)
  Installing build dependencies: started
  Installing build dependencies: still running...
  Installing build dependencies: still running...
  Installing build dependencies: still running...
  Installing build dependencies: still running...
  Installing build dependencies: still running...
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Collecting pycparser
  Using cached pycparser-2.21.tar.gz (170 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting tomli>=1.2.1
  Using cached tomli-1.2.2.tar.gz (15 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'error'
  ERROR: Command errored out with exit status 2:
   command: /home/pi/.platformio/penv/bin/python /tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-e79tjyp1/overlay --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.org/simple --extra-index-url https://www.piwheels.org/simple --extra-index-url https://www.piwheels.org/simple -- 'flit_core>=3.2.0,<4'
       cwd: None
  Complete output (60 lines):
  Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple, https://www.piwheels.org/simple, https://www.piwheels.org/simple
  Collecting flit_core<4,>=3.2.0
    Using cached flit_core-3.5.1.tar.gz (27 kB)
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
    Preparing metadata (pyproject.toml): started
    Preparing metadata (pyproject.toml): finished with status 'done'
  Collecting tomli
    Using cached tomli-1.2.2.tar.gz (15 kB)
  ERROR: Exception:
  Traceback (most recent call last):
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/cli/base_command.py", line 164, in exc_logging_wrapper
      status = run_func(*args)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/cli/req_command.py", line 205, in wrapper
      return func(self, options, args)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/commands/install.py", line 338, in run
      requirement_set = resolver.resolve(
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/resolution/resolvelib/resolver.py", line 92, in resolve
      result = self._result = resolver.resolve(
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_vendor/resolvelib/resolvers.py", line 482, in resolve
      state = resolution.resolve(requirements, max_rounds=max_rounds)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_vendor/resolvelib/resolvers.py", line 374, in resolve
      failure_causes = self._attempt_to_pin_criterion(name)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_vendor/resolvelib/resolvers.py", line 214, in _attempt_to_pin_criterion
      criteria = self._get_updated_criteria(candidate)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_vendor/resolvelib/resolvers.py", line 205, in _get_updated_criteria
      self._add_to_criteria(criteria, requirement, parent=candidate)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_vendor/resolvelib/resolvers.py", line 173, in _add_to_criteria
      if not criterion.candidates:
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_vendor/resolvelib/structs.py", line 151, in __bool__
      return bool(self._sequence)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/resolution/resolvelib/found_candidates.py", line 155, in __bool__
      return any(self)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/resolution/resolvelib/found_candidates.py", line 143, in <genexpr>
      return (c for c in iterator if id(c) not in self._incompatible_ids)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/resolution/resolvelib/found_candidates.py", line 47, in _iter_built
      candidate = func()
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/resolution/resolvelib/factory.py", line 201, in _make_candidate_from_link
      self._link_candidate_cache[link] = LinkCandidate(
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/resolution/resolvelib/candidates.py", line 281, in __init__
      super().__init__(
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/resolution/resolvelib/candidates.py", line 156, in __init__
      self.dist = self._prepare()
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/resolution/resolvelib/candidates.py", line 225, in _prepare
      dist = self._prepare_distribution()
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/resolution/resolvelib/candidates.py", line 292, in _prepare_distribution
      return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/operations/prepare.py", line 482, in prepare_linked_requirement
      return self._prepare_linked_requirement(req, parallel_builds)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/operations/prepare.py", line 546, in _prepare_linked_requirement
      dist = _get_prepared_distribution(
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/operations/prepare.py", line 57, in _get_prepared_distribution
      with req_tracker.track(req):
    File "/usr/lib/python3.9/contextlib.py", line 117, in __enter__
      return next(self.gen)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/req/req_tracker.py", line 122, in track
      self.add(req)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/req/req_tracker.py", line 92, in add
      raise LookupError(message)
  LookupError: https://files.pythonhosted.org/packages/aa/5b/62165da80cbc6e1779f342234c7ddc6c6bc9e64cef149046a9c0456f912b/tomli-1.2.2.tar.gz#sha256=c6ce0015eb38820eaf32b5db832dbc26deb3dd427bd5f6556cf0acac2c214fee (from https://pypi.org/simple/tomli/) (requires-python:>=3.6) is already being built: tomli>=1.2.1 from https://files.pythonhosted.org/packages/aa/5b/62165da80cbc6e1779f342234c7ddc6c6bc9e64cef149046a9c0456f912b/tomli-1.2.2.tar.gz#sha256=c6ce0015eb38820eaf32b5db832dbc26deb3dd427bd5f6556cf0acac2c214fee (from setuptools-rust>=0.11.4)
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/aa/5b/62165da80cbc6e1779f342234c7ddc6c6bc9e64cef149046a9c0456f912b/tomli-1.2.2.tar.gz#sha256=c6ce0015eb38820eaf32b5db832dbc26deb3dd427bd5f6556cf0acac2c214fee (from https://pypi.org/simple/tomli/) (requires-python:>=3.6). Command errored out with exit status 2: /home/pi/.platformio/penv/bin/python /tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-e79tjyp1/overlay --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.org/simple --extra-index-url https://www.piwheels.org/simple --extra-index-url https://www.piwheels.org/simple -- 'flit_core>=3.2.0,<4' Check the logs for full command output.
  Using cached tomli-1.2.1.tar.gz (14 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'error'
  ERROR: Command errored out with exit status 2:
   command: /home/pi/.platformio/penv/bin/python /tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-zwmgu3x5/overlay --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.org/simple --extra-index-url https://www.piwheels.org/simple --extra-index-url https://www.piwheels.org/simple -- 'flit_core>=3.2.0,<4'
       cwd: None
  Complete output (60 lines):
  Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple, https://www.piwheels.org/simple, https://www.piwheels.org/simple
  Collecting flit_core<4,>=3.2.0
    Using cached flit_core-3.5.1.tar.gz (27 kB)
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
    Preparing metadata (pyproject.toml): started
    Preparing metadata (pyproject.toml): finished with status 'done'
  Collecting tomli
    Using cached tomli-1.2.2.tar.gz (15 kB)
  ERROR: Exception:
  Traceback (most recent call last):
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/cli/base_command.py", line 164, in exc_logging_wrapper
      status = run_func(*args)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/cli/req_command.py", line 205, in wrapper
      return func(self, options, args)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/commands/install.py", line 338, in run
      requirement_set = resolver.resolve(
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/resolution/resolvelib/resolver.py", line 92, in resolve
      result = self._result = resolver.resolve(
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_vendor/resolvelib/resolvers.py", line 482, in resolve
      state = resolution.resolve(requirements, max_rounds=max_rounds)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_vendor/resolvelib/resolvers.py", line 374, in resolve
      failure_causes = self._attempt_to_pin_criterion(name)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_vendor/resolvelib/resolvers.py", line 214, in _attempt_to_pin_criterion
      criteria = self._get_updated_criteria(candidate)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_vendor/resolvelib/resolvers.py", line 205, in _get_updated_criteria
      self._add_to_criteria(criteria, requirement, parent=candidate)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_vendor/resolvelib/resolvers.py", line 173, in _add_to_criteria
      if not criterion.candidates:
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_vendor/resolvelib/structs.py", line 151, in __bool__
      return bool(self._sequence)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/resolution/resolvelib/found_candidates.py", line 155, in __bool__
      return any(self)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/resolution/resolvelib/found_candidates.py", line 143, in <genexpr>
      return (c for c in iterator if id(c) not in self._incompatible_ids)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/resolution/resolvelib/found_candidates.py", line 47, in _iter_built
      candidate = func()
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/resolution/resolvelib/factory.py", line 201, in _make_candidate_from_link
      self._link_candidate_cache[link] = LinkCandidate(
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/resolution/resolvelib/candidates.py", line 281, in __init__
      super().__init__(
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/resolution/resolvelib/candidates.py", line 156, in __init__
      self.dist = self._prepare()
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/resolution/resolvelib/candidates.py", line 225, in _prepare
      dist = self._prepare_distribution()
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/resolution/resolvelib/candidates.py", line 292, in _prepare_distribution
      return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/operations/prepare.py", line 482, in prepare_linked_requirement
      return self._prepare_linked_requirement(req, parallel_builds)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/operations/prepare.py", line 546, in _prepare_linked_requirement
      dist = _get_prepared_distribution(
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/operations/prepare.py", line 57, in _get_prepared_distribution
      with req_tracker.track(req):
    File "/usr/lib/python3.9/contextlib.py", line 117, in __enter__
      return next(self.gen)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/req/req_tracker.py", line 122, in track
      self.add(req)
    File "/tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip/_internal/req/req_tracker.py", line 92, in add
      raise LookupError(message)
  LookupError: https://files.pythonhosted.org/packages/aa/5b/62165da80cbc6e1779f342234c7ddc6c6bc9e64cef149046a9c0456f912b/tomli-1.2.2.tar.gz#sha256=c6ce0015eb38820eaf32b5db832dbc26deb3dd427bd5f6556cf0acac2c214fee (from https://pypi.org/simple/tomli/) (requires-python:>=3.6) is already being built: tomli>=1.2.1 from https://files.pythonhosted.org/packages/aa/5b/62165da80cbc6e1779f342234c7ddc6c6bc9e64cef149046a9c0456f912b/tomli-1.2.2.tar.gz#sha256=c6ce0015eb38820eaf32b5db832dbc26deb3dd427bd5f6556cf0acac2c214fee (from setuptools-rust>=0.11.4)
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/75/50/973397c5ba854445bcc396b593b5db1958da6ab8d665b27397daa1497018/tomli-1.2.1.tar.gz#sha256=a5b75cb6f3968abb47af1b40c1819dc519ea82bcc065776a866e8d74c5ca9442 (from https://pypi.org/simple/tomli/) (requires-python:>=3.6). Command errored out with exit status 2: /home/pi/.platformio/penv/bin/python /tmp/pip-standalone-pip-sgkbdzl6/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-zwmgu3x5/overlay --no-warn-script-location --no-binary :all: --only-binary :none: -i https://pypi.org/simple --extra-index-url https://www.piwheels.org/simple --extra-index-url https://www.piwheels.org/simple -- 'flit_core>=3.2.0,<4' Check the logs for full command output.
Collecting setuptools-rust>=0.11.4
  Using cached setuptools-rust-0.12.1.tar.gz (282 kB)
  Installing build dependencies: started
  Installing build dependencies: still running...
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Collecting semantic-version>=2.6.0
  Using cached semantic_version-2.8.5.tar.gz (50 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Collecting toml>=0.9.0
  Using cached toml-0.10.2.tar.gz (22 kB)
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'done'
Skipping wheel build for wheel, due to binaries being disabled for it.
Skipping wheel build for cffi, due to binaries being disabled for it.
Skipping wheel build for semantic-version, due to binaries being disabled for it.
Skipping wheel build for toml, due to binaries being disabled for it.
Skipping wheel build for pycparser, due to binaries being disabled for it.
Building wheels for collected packages: setuptools-rust, setuptools
  Building wheel for setuptools-rust (pyproject.toml): started
  Building wheel for setuptools-rust (pyproject.toml): finished with status 'done'
  Created wheel for setuptools-rust: filename=setuptools_rust-0.12.1-py3-none-any.whl size=22068 sha256=592ee8d73230f07f4d3a4dcdcac471d9774d5fdf6cb510dfd4e1c5c85defe013
  Stored in directory: /home/pi/.cache/pip/wheels/0d/74/4c/815dea1b32e070a03f3bdebc2ac66dec872e2f4f98873de7f1
  Building wheel for setuptools (pyproject.toml): started
  Building wheel for setuptools (pyproject.toml): finished with status 'done'
  Created wheel for setuptools: filename=setuptools-59.3.0-py3-none-any.whl size=952222 sha256=71c50c4701d693604255b3207d628d6be5b2a1c11735779cc532b8b4fad526b0
  Stored in directory: /home/pi/.cache/pip/wheels/b3/8b/0d/a37778f8f97ff4a4f7d1464a2f71fe824647a93b6407036e4f
Successfully built setuptools-rust setuptools
Installing collected packages: toml, setuptools, semantic-version, pycparser, wheel, setuptools-rust, cffi
    Running setup.py install for toml: started
    Running setup.py install for toml: finished with status 'done'
    Running setup.py install for semantic-version: started
    Running setup.py install for semantic-version: finished with status 'done'
    Running setup.py install for pycparser: started
    Running setup.py install for pycparser: finished with status 'done'
    Running setup.py install for wheel: started
    Running setup.py install for wheel: finished with status 'done'
    Running setup.py install for cffi: started
    Running setup.py install for cffi: finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: /home/pi/.platformio/penv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-d0sgr43l/cffi_1f03051e252344d59bd5ebdf4f5e0f48/setup.py'"'"'; __file__='"'"'/tmp/pip-install-d0sgr43l/cffi_1f03051e252344d59bd5ebdf4f5e0f48/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-hy0iyr4f/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-z_7hwbt9/overlay --compile --install-headers /tmp/pip-build-env-z_7hwbt9/overlay/include/site/python3.9/cffi
         cwd: /tmp/pip-install-d0sgr43l/cffi_1f03051e252344d59bd5ebdf4f5e0f48/
    Complete output (58 lines):
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    running install
    /home/pi/.platformio/penv/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    running build
    running build_py
    creating build
    creating build/lib.linux-armv7l-3.9
    creating build/lib.linux-armv7l-3.9/cffi
    copying cffi/commontypes.py -> build/lib.linux-armv7l-3.9/cffi
    copying cffi/cparser.py -> build/lib.linux-armv7l-3.9/cffi
    copying cffi/setuptools_ext.py -> build/lib.linux-armv7l-3.9/cffi
    copying cffi/pkgconfig.py -> build/lib.linux-armv7l-3.9/cffi
    copying cffi/__init__.py -> build/lib.linux-armv7l-3.9/cffi
    copying cffi/model.py -> build/lib.linux-armv7l-3.9/cffi
    copying cffi/verifier.py -> build/lib.linux-armv7l-3.9/cffi
    copying cffi/recompiler.py -> build/lib.linux-armv7l-3.9/cffi
    copying cffi/ffiplatform.py -> build/lib.linux-armv7l-3.9/cffi
    copying cffi/error.py -> build/lib.linux-armv7l-3.9/cffi
    copying cffi/vengine_cpy.py -> build/lib.linux-armv7l-3.9/cffi
    copying cffi/backend_ctypes.py -> build/lib.linux-armv7l-3.9/cffi
    copying cffi/vengine_gen.py -> build/lib.linux-armv7l-3.9/cffi
    copying cffi/lock.py -> build/lib.linux-armv7l-3.9/cffi
    copying cffi/cffi_opcode.py -> build/lib.linux-armv7l-3.9/cffi
    copying cffi/api.py -> build/lib.linux-armv7l-3.9/cffi
    copying cffi/_cffi_include.h -> build/lib.linux-armv7l-3.9/cffi
    copying cffi/parse_c_type.h -> build/lib.linux-armv7l-3.9/cffi
    copying cffi/_embedding.h -> build/lib.linux-armv7l-3.9/cffi
    copying cffi/_cffi_errors.h -> build/lib.linux-armv7l-3.9/cffi
    running build_ext
    building '_cffi_backend' extension
    creating build/temp.linux-armv7l-3.9
    creating build/temp.linux-armv7l-3.9/c
    arm-linux-gnueabihf-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -ffile-prefix-map=/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/home/pi/.platformio/penv/include -I/usr/include/python3.9 -c c/_cffi_backend.c -o build/temp.linux-armv7l-3.9/c/_cffi_backend.o
    c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
       15 | #include <ffi.h>
          |          ^~~~~~~
    compilation terminated.
    error: command '/usr/bin/arm-linux-gnueabihf-gcc' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/pi/.platformio/penv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-d0sgr43l/cffi_1f03051e252344d59bd5ebdf4f5e0f48/setup.py'"'"'; __file__='"'"'/tmp/pip-install-d0sgr43l/cffi_1f03051e252344d59bd5ebdf4f5e0f48/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-hy0iyr4f/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-z_7hwbt9/overlay --compile --install-headers /tmp/pip-build-env-z_7hwbt9/overlay/include/site/python3.9/cffi Check the logs for full command output.
----------------------------------------

Solution:

Install libffi-dev in order for the dependencies to install properly:

sudo apt -y install libffi-dev

 

Posted by Uli Köhler in Allgemein

How I fixed Tasmota 9.2.0 Nous A1 not auto-discovering in Home-Assistant

My Nous A1 flashed to Tasmota using tuya-convert worked fine using the webinterface and logged in successfully to the mosquitto MQTT server. However, Home-Assistant did not automatically discover it.

First, I logged into the Tasmota device console using the webinterface, enabled autodiscovery using

SetOption19 1

This alone did not help.

Then I upgraded Tasmota to 10.0.0 using the web update method via the webinterface. This took about 45 seconds and after that, the Nous A1 was automatically discovered by Home-Assistant. Hence, I recommend upgrading Tasmota to the most recent version before checking for any other issue. Note that checking the mosquitto logfile and the Tasmota console was also helpful because it showed that the device was successfully logging into MQTT and sending messages.

Posted by Uli Köhler in Allgemein

Which pins can you use for UART on the ESP32?

One the ESP32 can use any pin for UART. While using certain special pins has extremely small performance benefits, those don’t really matter in practice.

// Use GPIO2 and GPIO4 for Serial2
Serial2.begin(115200, SERIAL_8N1,
              2 /* RX pin */,
              4 /* TX pin */);

 

Posted by Uli Köhler in Allgemein