pashamray

dsmr-parser issue dependences on OrangePI

Library

https://github.com/ndokter/dsmr_parser

A library for parsing Dutch Smart Meter Requirements (DSMR) telegram data. It also includes client implementation to directly read and parse smart meter data.

Repository

I wrote reader base on examples

git clone https://github.com/pashamray/dsmr-read.git

Troble on OrangePI

pip install -r requirements.txt

And I had error, console output:

Collecting dsmr-parser==1.4.3 (from -r requirements.txt (line 1))
  Using cached dsmr_parser-1.4.3-py3-none-any.whl.metadata (539 bytes)
Collecting rich==14.1.0 (from -r requirements.txt (line 2))
  Using cached rich-14.1.0-py3-none-any.whl.metadata (18 kB)
Collecting pyserial<4,>=3 (from dsmr-parser==1.4.3->-r requirements.txt (line 1))
  Using cached pyserial-3.5-py2.py3-none-any.whl.metadata (1.6 kB)
Collecting pyserial-asyncio-fast>=0.11 (from dsmr-parser==1.4.3->-r requirements.txt (line 1))
  Using cached pyserial_asyncio_fast-0.16-py3-none-any.whl.metadata (2.5 kB)
Collecting pytz (from dsmr-parser==1.4.3->-r requirements.txt (line 1))
  Using cached pytz-2025.2-py2.py3-none-any.whl.metadata (22 kB)
Collecting Tailer==0.4.1 (from dsmr-parser==1.4.3->-r requirements.txt (line 1))
  Using cached tailer-0.4.1.tar.gz (7.5 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting dlms_cosem==21.3.2 (from dsmr-parser==1.4.3->-r requirements.txt (line 1))
  Using cached dlms_cosem-21.3.2-py3-none-any.whl.metadata (10 kB)
Collecting markdown-it-py>=2.2.0 (from rich==14.1.0->-r requirements.txt (line 2))
  Using cached markdown_it_py-4.0.0-py3-none-any.whl.metadata (7.3 kB)
Collecting pygments<3.0.0,>=2.13.0 (from rich==14.1.0->-r requirements.txt (line 2))
  Using cached pygments-2.19.2-py3-none-any.whl.metadata (2.5 kB)
Collecting attrs>=20.3.0 (from dlms_cosem==21.3.2->dsmr-parser==1.4.3->-r requirements.txt (line 1))
  Using cached attrs-25.3.0-py3-none-any.whl.metadata (10 kB)
Collecting cryptography>=35.0.0 (from dlms_cosem==21.3.2->dsmr-parser==1.4.3->-r requirements.txt (line 1))
  Using cached cryptography-45.0.7.tar.gz (744 kB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [29 lines of output]
      Collecting maturin<2,>=1.8.6
        Using cached maturin-1.9.4.tar.gz (213 kB)
        Installing build dependencies: started
        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 'error'
        error: subprocess-exited-with-error

        × Preparing metadata (pyproject.toml) did not run successfully.
        │ exit code: 1
        ╰─> [4 lines of output]
            Python reports SOABI: cpython-312-riscv64-linux-gnu
            Computed rustc target triple: riscv64-unknown-linux-gnu
            Target triple not supported by rustup: riscv64-unknown-linux-gnu
            Rust not found, installing into a temporary directory
            [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
      error: metadata-generation-failed

      × Encountered error while generating package metadata.
      ╰─> See above for output.

      note: This is an issue with the package mentioned above, not pip.
      hint: See above for details.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Fix

install build dependences for packages

Read values from Landis + Gyr E360 SMR 5.0 by DSMR

Hardware

Counter

short doc

counter img from: https://eu.landisgyr.com/blog/european-utility-week-2016/advanced-metering-infrastructure/e360

Counter has P1 port for read parameters by DSMR protocol

UART FTDI Adapter for connect to P1 port

I buy adapler on aliexpress

adapter

Software

Library

I use https://github.com/ndokter/dsmr_parser library for read values and use example from README

Example

from dsmr_parser import telegram_specifications
from dsmr_parser.clients import SerialReader, SERIAL_SETTINGS_V5

serial_reader = SerialReader(
    device='/dev/ttyUSB0',
    serial_settings=SERIAL_SETTINGS_V5,
    telegram_specification=telegram_specifications.V5
)

for telegram in serial_reader.read():
    print(telegram)  # see 'Telegram object' docs below

run it and get log in telegram format

STM32G4xx project template

Repository with project template for STM32G4xx microcontrollers and nucleo G4 board

board image

Repository

git clone --recurse-submodules https://github.com/pashamray/stm32g4xx-project-template

References

S100 cam light wall adapter

Wired Wall Light Cam S100 wall adapter

Repo

https://github.com/pashamray/S100-cam-light-wall-adapter.git

Model

model

Wall box

wall-box

Installed

installed

Kitchen hood adapter

Adapter for kitchen hood BTC9740SS-EU

https://github.com/pashamray/kitchen-hood-adapter-btc9740ss-eu

Kitchen hood adapter

print parameters

print model

try to install

install model

final

Cosmetic bag

https://github.com/pashamray/cosmetic-bag

Cosmetic bag

laravel schedule run every second

<?php

declare(strict_types=1);

namespace App\Console;

class Kernel extends ConsoleKernel
{
    /**
     * Define the application's command schedule.
     */
    protected function schedule(Schedule $schedule): void
    {
        // Run call every second
        $schedule->call(static function (int $seconds) use ($schedule) {
            $dt = Carbon::now();
            $x = 60 / $seconds;

            do {
                app('log')->debug('Run call with params:', ['seconds' => $seconds]);

                $schedule->command(YourCommand::class, ['--force', '--param', 123])->withoutOverlapping(1);

                time_sleep_until((float) $dt->addSeconds($seconds)->timestamp);
            } while ($x-- > 0);
        }, ['seconds' => 1])->everyMinute();
    }
}

refs

https://laracasts.com/discuss/channels/laravel/how-to-run-scheduling-every-2-sec

ESP32 + OpenTherm + Brink Renovent HR Medium

https://github.com/pashamray/brink-opentherm-controller

Intro

Имеется система вентиляции Brink Renovent HR Medium, которая имеет 3 скорости работы: низкая, средняя, высокая. При этом, в зависимости от времени года или времени суток, необходимо переключать скорости работы системы. Brink Renovent HR Medium image source: https://www.brinkclimatesystems.nl pdf: https://www.brinkclimatesystems.nl/documenten/renovent-hr-medium-large-611925.pdf

Скорости переключаются с помощью настенного переключателя, но бегать к переключателю напрягает. Переключатель имеет 3 положения:

Sai-1-3v image source: https://www.ventilatieland.nl/nl_NL/p/zehnder-stork-drie-standen-schakelaar-sai-1-3v-inbouw/5959/

Download site by wget

for create a mirror site, you can use command:

wget --mirror --page-requisites --adjust-extension --convert-links --no-parent <URL>
  -m,  --mirror                    shortcut for -N -r -l inf --no-remove-listing
  -p,  --page-requisites           get all images, etc. needed to display HTML page
  -E,  --adjust-extension          save HTML/CSS documents with proper extensions
  -k,  --convert-links             make links in downloaded HTML or CSS point to local files
  -np, --no-parent                 don't ascend to the parent directory

ssh ports forwarding

Port forwarding

nginx config

server {
  listen [::]:443 ssl;
  listen 443 ssl;

  server_name tun.site.xyz;

  location / {
    proxy_set_header Host $host;
    proxy_pass https://localhost:5443;
  }

  ssl_certificate /etc/letsencrypt/live/tun.site.xyz/fullchain.pem; # managed by Certbot
  ssl_certificate_key /etc/letsencrypt/live/tun.site.xyz/privkey.pem; # managed by Certbot
}

server {
  listen [::]:80;
  listen 80;
  
  server_name tun.site.xyz;
  
  location / {
    proxy_set_header Host $host;
    proxy_pass http://localhost:5080;
  }
}
ssh -f -N -R 5443:localhost:443 tun.site.xyz

https://ngrok.com
https://serveo.net

check foreign keys in mySQL

https://gist.github.com/pashamray/eac6a730b4033f315a5cf9e2c50ca112

links

generate ssh keys

Генерируем ключ

ssh-keygen -t ed25519 -b 4096 -C "name@example.com" -f ~/.ssh/my_key

вводим пароль для ключа

Generating public/private ed25519 key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:

наш ключ готов

Your identification has been saved in ~/.ssh/my_key
Your public key has been saved in ~/.ssh/my_key.pub
The key fingerprint is:
SHA256:YZNwKF/ExLQxXW5j+nnQo1v1CBcEGd65I5MDvK/pUYo name@example.com
The key's randomart image is:
+--[ED25519 256]--+
|      .BB. .++.  |
|    . .o+*.o.o . |
|     o .* o * +  |
|      .. o * + o |
|        S o O * .|
|         . = X =.|
|        E o = + .|
|           + +   |
|         .+ .    |
+----[SHA256]-----+

копируем наш ключ на сервер где server_ip ай-пи сервера куда копируем ключ

имитация сетевых проблем

Только дурак нуждается в порядке — гений господствует над хаосом

Albert Einstein

Когда мы разрабатываем приложение, мы хотим, чтобы оно было стабильным и надежным. Но как мы можем быть уверены, что наше приложение справится со сбоями, которые могут возникнуть во внешних сервисах, от которых оно зависит? В этом случае нам может помочь инструмент под названием Toxiproxy.

toxiproxy

Toxiproxy - это инструмент, который позволяет имитировать различные виды сбоев и ошибок во внешних сервисах, чтобы убедиться, что наше приложение правильно обрабатывает эти ситуации. Мы можем использовать Toxiproxy для тестирования наших приложений на всех этапах разработки и убедиться в их надежности и стабильности.

underscore headers

Веб сервера, такие как NGINX и Apache отбрасывают заголовки которые содержат в своем имени _ (подчеркивание).

В документаций NGINX написано следующее:

Missing (disappearing) HTTP Headers

If you do not explicitly set underscores_in_headers on;, NGINX will silently drop HTTP headers with underscores (which are perfectly valid according to the HTTP standard). This is done in order to prevent ambiguities when mapping headers to CGI variables as both dashes and underscores are mapped to underscores during that process.

docker get container ip by name or by id

# Узнать IP адрес контейнера
docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' CONTAINER_ID_OR_NAME

прошивка генератора SG-420M

Прошивка доступна в репозиторий на github.

Прошивка модифицирована для работы с экранами на контроллере HD44780, размером 16x2, такими как WH1602. Подключение экрана аналогично подключению в частотомере FC-510

Общий вид генератора

alt wh1602s

Вид лицевой панели

alt wh1602s

Схема подключения экрана

alt sch_wh1602s

Автор конструкций генератора и базовой прошивки

Ридико Леонид Иванович

эмуляция резистивного touch screen дисплея

emulation resistive touch screen - https://www.youtube.com/watch?v=JYI9l9yhL6E

emulation resistive touch screen v2 - https://www.youtube.com/watch?v=cjByUmV9f5U

java pincode sender + arduino receiver + touch screen multiplex interface - https://www.youtube.com/watch?v=IUqy0aOLqSg