Skip to content

Instantly share code, notes, and snippets.

View adlerweb's full-sized avatar

Florian Knodt adlerweb

View GitHub Profile
@adlerweb
adlerweb / energy.py
Created May 27, 2021 18:19
Fetch predicted renewable energy generation for Germany and find time of day where appliances would theoretically run with lowest environmental impact
import datetime
import urllib.request
import json
weeknr = datetime.date.today().strftime("%V")
year = datetime.date.today().strftime("%Y")
url = "https://energy-charts.info/charts/power/data/de/week_"+year+"_"+weeknr+".json"
data = urllib.request.urlopen(url).read()
data = json.loads(data)
@adlerweb
adlerweb / ina-config.php
Created November 14, 2020 21:34
USB WiFi Power Logger
<?php
$mysql_serv = 'localhost';
$mysql_user = 'usblogger';
$mysql_pass = 'usblogger';
$mysql_datb = 'volkszaehler';
$uuid_v = 1;
$uuid_a = 2;
?>
@adlerweb
adlerweb / redis-mygrate.py
Last active April 13, 2020 13:19 — forked from romanmah/redis-mygrate.py
A small utility to dump/restore serialized redis data to text files
#!/usr/bin/python
import redis
import pickle
import argparse
class RedisMigrate():
def __init__(self, host, port, db):
/***************************************************************************
IR Ferraris Reader
2019 Adlerweb//Bitbastelei
Florian Knodt - www.adlerweb.info
Note: Just a few minutes of coding, not heavily tested, etc
***************************************************************************/
#include <Arduino.h>
<?php
/*
Usage:
- platform: command_line
name: foo
command: "php -f /home/homeassistant/vzapi.php 1"
unit_of_measurement: "W"
Todo:
- Rewrite in Python
#include <LEDMatrixDriver.hpp>
extern "C" {
#include "user_interface.h"
}
// This sketch draw marquee text on your LED matrix using the hardware SPI driver Library by Bartosz Bielawski.
// https://github.com/bartoszbielawski/LEDMatrixDriver
// Example written 16.06.2017 by Marko Oette, www.oette.info
#include <Arduino.h>
#include <SPI.h>
#include <MCP23S17.h>
#include <Wire.h>
#include <LiquidCrystal_PCF8574.h>
extern "C" {
#include "user_interface.h"
}
@adlerweb
adlerweb / vz.md
Last active December 30, 2023 17:25
Grafana MySQL query to visualize Volkszähler-Data

Using Channel-IDs (that's not UUID)

SELECT
  timestamp/1000 as time_sec, 
  data.value as value, 
  properties.value as metric
FROM data
  LEFT JOIN properties ON (properties.entity_id = data.channel_id)
  LEFT JOIN entities ON (entities.id = data.channel_id)
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <PubSubClient.h>
const char* cfg_wifi_ssid = "freifunk-myk.de";
const char* cfg_wifi_pwd = "";
const char* mqtt_server = "deinserver.local";
const unsigned int mqtt_port = 1883;