Skip to content

Instantly share code, notes, and snippets.

View jpsingleton's full-sized avatar
🌲

James Singleton jpsingleton

🌲
View GitHub Profile
@markgdev
markgdev / solis_5g_modbus.py
Last active October 29, 2023 19:30
Query a Solis Hybrid 5G inverter and push to MQTT
import minimalmodbus
import time
import paho.mqtt.publish as publish
instrument = minimalmodbus.Instrument('/dev/ttyUSB0', 1, debug = False)
instrument.serial.baudrate = 9600
# This probably doesn't need setting but I was getting timeout failures
# rather than wrong data address when I had the registers wrong
instrument.serial.timeout = 2
# An example read for long
@madskristensen
madskristensen / ETagMiddleware.cs
Last active March 18, 2024 15:11
ASP.NET Core ETAg middleware
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.Net.Http.Headers;
using System.IO;
using System.Security.Cryptography;
using System.Threading.Tasks;
public class ETagMiddleware
{