Skip to content

Instantly share code, notes, and snippets.

View devbis's full-sized avatar
:octocat:
Working

Ivan Belokobylskiy devbis

:octocat:
Working
View GitHub Profile
const {
batteryPercentage,
temperature,
humidity,
enumLookup,
binary,
numeric,
quirkAddEndpointCluster,
} = require('zigbee-herdsman-converters/lib/modernExtend');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
@devbis
devbis / roidmi.cleaner.v382.js
Created January 17, 2024 13:40
roidmi.cleaner.v382.js
This file has been truncated, but you can view the full file.
(function (global) {
"use strict";
var __MIOTPACK__ = true;
global.require = metroRequire;
global.__r = metroRequire;
global.__d = define;
global.__c = clear;
global.__registerSegment = registerSegment;
var modules = clear();
@devbis
devbis / georgian-banks.yaml
Created April 12, 2023 08:27
Home Assistant sensors for USD-GEL rates in banks
scrape:
- resource: https://credobank.ge/en/
sensor:
- name: USD/GEL rate Credo
select: "body > div.wrap.container > div.content > main > div.news-section.full-width-padding-lr.flex-wrap.space-between > div.news-container.right > div > div.js-currency-box.currency-box.active > div > div:nth-child(2) > div.currency.second-column"
value_template: '{{ value | float }}'
unit_of_measurement: GEL
sensor:
- platform: rest
@devbis
devbis / dgnwg05lm-19-to-21.sh
Last active November 7, 2022 10:54
Upgrade to 21
#!/bin/sh
set -e
echo "Updating OpenWRT from version 19.07 to 21.02.5"
wget https://openlumi.github.io/releases/21.02.5/targets/imx6/generic/u-boot-xiaomi_dgnwg05lm/u-boot.imx -O /tmp/u-boot.imx
wget https://openlumi.github.io/releases/21.02.5/targets/imx6/generic/openlumi-21.02.5-imx6-imx6ull-xiaomi-dgnwg05lm.dtb -O /tmp/openwrt-imx6-imx6ull-xiaomi-dgnwg05lm.dtb
wget https://openlumi.github.io/releases/21.02.5/targets/imx6/generic/openlumi-21.02.5-imx6-xiaomi_dgnwg05lm-squashfs-sysupgrade.bin -O /tmp/openwrt-imx6-xiaomi_dgnwg05lm-squashfs-sysupgrade.bin
echo "The files are downloaded to the /tmp folder."
@devbis
devbis / currency_rate.py
Created January 25, 2022 13:18
Currency rate websocket service
"""
A websocket service to pull rates and provide subscriptions to an asset
Optimization directions:
- SQLite is used for simplicity without need for extra DB setup.
Can be replaced with postgres (or another DB) connection
- Unification of naming for symbols/assets, etc.
- Handle various signals for graceful shutdown
- Better validation of input JSON
#!/usr/bin/env python3
import optparse
import os
import shutil
import struct
import sys
from typing import List, Tuple
from Crypto.Cipher import AES # type: ignore
@devbis
devbis / JETutils.py
Created December 21, 2021 20:50
NXP JET sources
import sys, struct, string
from rijndael import rijndael
from rijndael import encrypt
import time
crctab = [
0, 79764919, 159529838, 222504665,
319059676, 398814059, 445009330, 507990021,
638119352, 583659535, 797628118, 726387553,
890018660, 835552979, 1015980042, 944750013,
1276238704, 1221641927, 1167319070, 1095957929,
import asyncio
import logging
import os
from bleak import BleakScanner
from bleak.backends.device import BLEDevice
from bleak.exc import BleakDBusError
logger = logging.getLogger(__name__)
// SPDX-License-Identifier: GPL-2.0
#include "qcom-apq8064-v2.0.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/mfd/qcom-rpm.h>
#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
/ {
model = "LGE Nexus 4 (mako)";
compatible = "lge,nexus4-mako", "qcom,apq8064";
@devbis
devbis / gist:ebf8f2e973993c6b537fb2110ed83f71
Created April 15, 2021 07:57
Home assistant entrance trigger
alias: Turn on the light when enter home
description: ''
trigger:
- type: opened
platform: device
device_id: fa0f01d24dedc4bf42a6b72269616a2e
entity_id: binary_sensor.0x00158d000397557e_contact
domain: binary_sensor
condition:
- type: is_illuminance