Skip to content

Instantly share code, notes, and snippets.

View ks00x's full-sized avatar

Klaus Schwarzburg ks00x

View GitHub Profile
blueprint:
name: ZHA - Tuya Smart Knob for lights - v1.2
description: 'Control lights with a Tuya Smart Knob from "_TZ3000_402vrq2i".
Tapping activates toggle event and will toggle the selected light.
Rotating left/right will change the brightness smoothly of the selected light.
Adjusted for generic Tuya Smart Knob, with functionality added for remote mode.
Device is switched to remote mode, and back, by rapidly tapping 3 times.
Once in remote mode the following functions are available
- Short Press
@ks00x
ks00x / owon_cms061.py
Last active December 2, 2025 13:30
OWON CMS101/061 Clampmeter BLE monitor
#! /usr/bin/env python3
# -*- coding: UTF-8 -*-
"""NOTES
starting point was this code:
[OWON OW18E on Python · Issue #4 · sercona/Owon-Multimeters](https://github.com/sercona/Owon-Multimeters/issues/4)
which is a partial port of older C code:
https://github.com/sercona/Owon-Multimeters/blob/main/owon_multi_cli.c
- there is no code to switch modes on the meter like the ISMART software does
@ks00x
ks00x / p2pro.py
Last active January 21, 2024 20:29
minimal python code to read out the raw data from an infiray p2pro camera and convert it to temperature (refactor with class)
import cv2
import numpy as np
'''
with info from , check out:
https://www.eevblog.com/forum/thermal-imaging/infiray-and-their-p2-pro-discussion/200/
https://github.com/leswright1977/PyThermalCamera/blob/main/src/tc001v4.2.py
I did create a seperate conda env for this project on Windows:
conda create -n p2pro python
@ks00x
ks00x / p2prolive.py
Last active March 4, 2026 07:24
minimal python code to read out the raw data from an infiray p2pro camera and convert it to temperature
import cv2
import numpy as np
'''
with info from , check out:
https://www.eevblog.com/forum/thermal-imaging/infiray-and-their-p2-pro-discussion/200/
https://github.com/leswright1977/PyThermalCamera/blob/main/src/tc001v4.2.py
I did create a seperate conda env for this project on Windows:
conda create -n p2pro python
@ks00x
ks00x / MAX31865_simple.py
Last active October 18, 2025 14:56
Micropython code to use a MAX31865 Pt100 temperature sensor module with micropython. Tested with esp32.
import time
import machine
import math
class MAX31865():
def __init__(self,
spi,
cs,
@ks00x
ks00x / streamlit_pageswitch.py
Created August 25, 2022 06:23
one option to work with multiple pages in Streamlit
import streamlit as st
class pageswitcher:
def __init__(self,page=None):
''' streamit (V>=4.8) usage:\n
A browser page corresponds to streamlit code inside a function\n
With .setpage() you can register a function (page) to be run on the next restart\n
With run(page) you can set a function and restart or restart with the last set page (run())\n
Each page function should return with runcaller() to its calling page\n
The first 2 code linses in the main script should be like this (with main() beeing the main page/function):\n
@ks00x
ks00x / livedash.py
Last active August 20, 2022 13:02
streamlit live dashboard using asyncio
import streamlit as st
import asyncio
import math
from random import random
from collections import deque
def red_green(red:bool):
if red: return '🔴'
else : return '🟢'