How to fix ModuleNotFoundError: No module named ‘conans’

Problem:

When running conanfile.py or other Python scripts, you see an error message like

Traceback (most recent call last):
  File "/home/myuser/myproject/conanfile.py", line 1, in <module>
    from conans import ConanFile, CMake
ModuleNotFoundError: No module named 'conans'

Solution:

Install conan using one of the recommended methods such as the recommended install via pip

sudo pip3 install conan
Posted by Uli Köhler in C/C++, Python

How to fix Failed to restart samba.service: Unit samba.service not found on Debian & Ubuntu

Problem:

When trying to restart the Samba service on Ubuntu or Debian using

sudo systemctl restart samba

you see this error message:

Failed to restart samba.service: Unit samba.service not found.

Solution:

The samba service is called smbd, not samba. Restart it using

sudo systemctl restart smbd
Posted by Uli Köhler in Linux

How to add public writeable Samba share via smb.conf

[my_files]
   comment = My files
   path = /home/myuser/myfiles
   writeable = yes
   browseable = yes
   public = yes
   create mask = 0644
   directory mask = 0755
   force user = myuser

 

Posted by Uli Köhler in Linux

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

Traefik API config example using Wildcard certificates and HTTP username/password (basic auth)

Based on our previous post Simple Traefik docker-compose setup with Lets Encrypt Cloudflare DNS-01 & TLS-ALPN-01 & HTTP-01 challenges this is the TOML config I use to allow access to the Traefik dashboard using HTTPS and my Let’s encrypt wildcard certificate. In this example, it will be reachable under traefik.mydomain.com. Place the config in /opt/traefik/conf/api.toml assuming you have setup Traefik based on our example.

[http.routers.traefik-api]
rule = "Host(`traefik.mydomain.com`)"
service = "api@internal"
middlewares = ["auth"]
[http.routers.traefik-api.tls]
certresolver = "cloudflare"
[[http.routers.traefik-api.tls.domains]]
main = "mydomain.com"
sans = ["*.mydomain.com"]

[http.middlewares.auth.basicAuth]
users = [
  "admin:$apr1$ocvmQb0w$Bwlbz3V2VVRZlcu46X0zK0",
]

Create a new password string using htpasswd:

htpasswd -n admin

When prompted, enter the password and then copy the password such as admin:$apr1$ocvmQb0w$Bwlbz3V2VVRZlcu46X0zK0 to the [http.middlewares.auth.basicAuth] section:

[http.middlewares.auth.basicAuth]
users = [
  "COPY IT HERE"
]

It should look like our full example above.

Posted by Uli Köhler in Traefik

Traefik docker container labels for wildcard certificate using Cloudflare

See our previous post Simple Traefik docker-compose setup with Lets Encrypt Cloudflare DNS-01 & TLS-ALPN-01 & HTTP-01 challenges for the general config we’re using to deploy Traefik.

If you want to automatically connect Traefik to your docker container, use labels like

   labels:
     - "traefik.enable=true"
     - "traefik.http.routers.homeassistant.rule=Host(`homeassistant.mydomain.com`)"
     - "traefik.http.routers.homeassistant.entrypoints=websecure"
     - "traefik.http.routers.homeassistant.tls.certresolver=cloudflare"
     - "traefik.http.routers.homeassistant.tls.domains[0].main=mydomain.com"
     - "traefik.http.routers.homeassistant.tls.domains[0].sans=*.mydomain.com"
     - "traefik.http.services.homeassistant.loadbalancer.server.port=80"

 

Posted by Uli Köhler in Traefik

How to make Tasmota report the sensor readings every 10 seconds

By default, Tasmota reports the sensor readings such as smart plug energy only every 5 minutes (300 seconds). In order to report them every 10 seconds, run this via the web UI console:

TelePeriod 10

 

Posted by Uli Köhler in Home-Assistant

How to enable Home-Assistant MQTT auto-discovery on Tasmota

First, upgrade your Tasmota to the latest firmware. For me, only firmware 10.1.0+ worked with Home-Assistant MQTT autodiscovery.

Then, configure your MQTT server and username/password using the webinterface.

After that, open the console in the webinterface and enter

SetOption19 1

and press return. Now reboot Tasmota using the webinterface.

Posted by Uli Köhler in Home-Assistant

Should you use the .bin or .bin.gz for Tasmota firmware upgrade?

Due to limited flash size issues, always use the .bin.gz if the current Tasmota is at least version 8.2 (older versions do not support the .gz format!)

Posted by Uli Köhler in Home-Assistant

How to fix Tasmota Upload Failed: Upload buffer miscompare on Nous A1T

Problem:

When trying to do a Tasmota firmware upgrade on the Nous A1T, you see this error message:

Upload Failed
Upload buffer miscompare


Solution:

This issue occurs because in the default configuration there is not enough flash space to flash the firmware.
However, this is easy to fix: First, flash the tasmota-minimal.bin.gz firmware, then flash the regular tasmota.bin.gz firmware using the webinterface of the minimal firmware.

Download link for the minimal firmware
Download link for the regular firmware

After that, upgrades will work just fine.

Posted by Uli Köhler in Home-Assistant, MQTT

How to fix Tasmota MQT: Connect failed to …, rc 5

Problem:

On the Tasmota console, you see an error message like

17:56:11.326 MQT: Connect failed to 10.19.50.10:1883, rc 5. Retry in 50 sec

Solution:

Your MQTT username/password is wrong. Check if they match what you have configured in your server in the Tasmota MQTT configuration page.

Posted by Uli Köhler in MQTT

How to fix bellows Error: Invalid value for “-D” / “–database”: File “/home/user/.config/bellows/app.db” does not exist.

Problem:

When running

bellows devices

you see this error message:

Error: Invalid value for "-D" / "--database": File "/home/uli/.config/bellows/app.db" does not exist.

Solution:

Just create the directory and create an empty file for the database:

mkdir -p ~/.config/bellows
touch ~/.config/bellows/app.db

Then retry running your original command like

bellows devices
Posted by Uli Köhler in Python, Zigbee

How to fix Angular Service ngOnInit() not being called

Problem:

You have an Angular service implementing OnInit:

import { Injectable, OnInit } from '@angular/core';

@Injectable()
export class MyService implements OnInit {

  constructor() { }
  
  ngOnInit() {
    console.log("MyService initializing");
  }
}

but it never prints MyService initializing – i.e. the ngOnInit() function is never actually being called.

Solution:

Services should not implement OnInit, the function is deliberately never called. Instead, add the code from ngOnInit() in the constructor() and remove implements OnInit and ngOnInit():

import { Injectable, OnInit } from '@angular/core';

@Injectable()
export class MyService {

  constructor() {
    console.log("MyService initializing");
  }
  
}

 

Posted by Uli Köhler in Angular, Typescript

How to fix Angular HttpClient toPromise() deprecated (rxjs)

Problem:

You have angular HTTP client code like

this.http.get<MyType>(`${this.baseURL}/api/myAPI`).toPromise()

but toPromise() is deprecated in recent versions of angular / rxjs.

/** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. Details: https://rxjs.dev/deprecations/to-promise */
toPromise(): Promise<T | undefined>;

Solution:

In most cases, for HttpClient, you want to use rxjs’s firstValueFrom() since the HttpClient Observables typically only return one value anyway.

First, import firstValueFrom from rxjs:

import { firstValueFrom } from 'rxjs';

then remove the .toPromise() call:

// Before
this.http.get<MyType>(`${this.baseURL}/api/myAPI`).toPromise()
// After
this.http.get<MyType>(`${this.baseURL}/api/myAPI`)

and surround the entire statement with firstValueFrom:

// Before
this.http.get<MyType>(`${this.baseURL}/api/myAPI`)
// After
firstValueFrom(this.http.get<MyType>(`${this.baseURL}/api/myAPI`).toPromise())

This will fix the issue.

Posted by Uli Köhler in Angular, Typescript

Angular HTTPClient ReplaySubject example without query parameters

import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { ReplaySubject } from 'rxjs';
import { MyType } from './my-type';

@Injectable()
export class MyService {
  baseURL = "http://localhost:18674";

  // Replay subject: New subscribers will get previous values
  public nodes = new ReplaySubject<MyType>();

  constructor(private http: HttpClient) {
    // Currently only acquire nodes once
    this.http.get<MyType>(`${this.baseURL}/api/myapi`).subscribe(value => 
      this.values.next(value);
    });
  }
}

 

Posted by Uli Köhler in Angular, Javascript, Typescript

How to use streamripper to rip & split online radios using docker-compose

I published the docker image ulikoehler/streamripper to make it trivially easy to rip & split online radios.

Use this docker-compose.yml to rip a single online radio to ./TheRadio:

version: '3.5'
services:
   theradio:
     image: ulikoehler/streamripper:latest
     volumes:
       - ./TheRadio:/app
     command: ["streamripper", "https://theradio.domain/stream.mp3", "-s", "--xs2", "-d", "."]

You can use our script from Create a systemd service for your docker-compose project in 10 seconds in order to create a script to autostart the ripper on boot:

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

 

Posted by Uli Köhler in Audio/Video
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPTPrivacy &amp; Cookies Policy