Skip to content

Instantly share code, notes, and snippets.

View dirkjanfaber's full-sized avatar

Dirk-Jan Faber dirkjanfaber

View GitHub Profile
@dirkjanfaber
dirkjanfaber / README.md
Last active January 4, 2023 12:16
Energy zero

This subflow uses the energy zero API for retrieving the hourly energy prices from the API of https://www.energyzero.nl/ for either today or the next day. These are the prices as they are used by the Dutch energy providers ANWB energie, Energie van Ons and others.

Energy zero

In order not to load the API too heavy a rate limiter of 1 query per 15 minutes has been added to the subflow.

Do note that tomorrows prices can be queried after 15:00, so there is a delay built in the node that handles that.

@dirkjanfaber
dirkjanfaber / README.md
Last active April 21, 2023 13:13
Victron Modbus

This subflow tries to make it easier to use modbus tcp to query and modify Victron Energy equipment via modbus tcp. By default the subflow will try to connect to 127.0.0.1.

Victron Modbus flow

It requires the following node to be added to the palette before installing the subflow:

Installing the subflow is a matter of copying the flow below and pasting it via the Import menu. (ctrl-i)

Unit ID

@dirkjanfaber
dirkjanfaber / flow.json
Created December 11, 2022 13:31
Update interval of Victron output node in Node-RED flow
[
{
"id": "d1dcac4acb3637a1",
"type": "inject",
"z": "bb43ebac.8ecdd8",
"name": "interval every 30 sec",
"props": [
{
"p": "payload"
},
@dirkjanfaber
dirkjanfaber / README.md
Last active April 27, 2024 19:07
Solar yield forecasting using forecast.solar

This subflow uses the http request node to fetch solar forecasts for geographical positions, using the API from https://forecast.solar/. Please check their website and consider getting a paid account.

Solar forecast flow

Do note that, on a free account, you are limited in the number of requests to do. Also note that the data only gets updated once every 15 minutes, so there is no reason to query more often. There is rate limiting built in the subflow not to perform requests more than once every 15 minutes.

Configuration

Solar forecast properties

@dirkjanfaber
dirkjanfaber / poeditor_add_reference_to_po.py
Created August 31, 2021 12:20
POEditor add reference to exported .po file
#!/usr/bin/env python3
import argparse
import polib
parser = argparse.ArgumentParser()
parser.add_argument('-s', '--source', nargs=1,
help='source PO file')
parser.add_argument('-r', '--reference', nargs=1,
@dirkjanfaber
dirkjanfaber / bms-check.py
Created July 16, 2021 14:38
bms-check.py
#!/usr/bin/env python3
import sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-v', '--verbose', action='store_true',
help='increase output verbosity' )
parser.add_argument('-d', '--dry-run', action='store_true',
help='work without input' )
@dirkjanfaber
dirkjanfaber / authenticator_code.py
Created June 14, 2021 07:46
Fetch the authenticator code so it is usable in a script.
#!/usr/bin/env python3
import authenticator as a
import os
def get_code():
cd = (a.data
.ClientFile(
os.environ['AUTHENTICATOR_PASSWORD'])
@dirkjanfaber
dirkjanfaber / venus_os_gui_test_language.sh
Last active May 31, 2021 08:31
POEditor download and convert file for Venus OS gui
#!/bin/bash
# language is first parameter, defaulting to 'nl' if none given
lang=${1:-nl}
# Add Qt to the path
PATH=$PATH:~/Qt/5.13.2/gcc_64/bin/
# export .po file. First query gives us a file location
po_file_location=$(curl -X POST https://api.poeditor.com/v2/projects/export \
@dirkjanfaber
dirkjanfaber / download_from_poeditor.py
Created April 28, 2021 14:50
Download and convert the po file for a given language from the poeditor.com file.
#!/usr/bin/env python3
from poeditor import POEditorAPI
import os
import subprocess
import time
import argparse
project_id = "435155"
filename = "victronconnect"
@dirkjanfaber
dirkjanfaber / tcw181b-cm.py
Created April 15, 2021 07:36
Simple python script to control a tcw181b-cm
#!/usr/bin/python
import requests
import argparse
device="tcw181b-cm"
parser = argparse.ArgumentParser()
parser.add_argument('-d', '--device', nargs=1, help='device (default: '+device+')')
parser.add_argument('-f', '--off', type=int, action='append', nargs=1, help='turn relay X off')