Skip to content

Instantly share code, notes, and snippets.

View fabaff's full-sized avatar

Fabian Affolter fabaff

View GitHub Profile
@fabaff
fabaff / power-monitoring.yaml
Created May 10, 2019 20:14
Power monitoring with ESP32, INA219, esphome and Home Assistant
esphome:
name: pm
platform: ESP32
board: esp32dev
wifi:
ssid: 'YOUR_SSID'
password: 'YOUR_PASSWORD'
mqtt:
@fabaff
fabaff / prg320.py
Created May 12, 2019 08:51
Reading one number from a PRG320
import asyncio
import binascii
import json
import serial_asyncio
class Prg320Output(asyncio.Protocol):
"""Get the output of PRG320."""
def connection_made(self, transport):
@fabaff
fabaff / gases.yaml
Created December 30, 2019 09:53
GAses sensor with ESPHome
esphome:
name: gas_quadrat
platform: ESP8266
board: nodemcuv2
logger:
level: VERBOSE
wifi:
ssid: SSID
@fabaff
fabaff / __init__.py
Last active January 7, 2023 02:34
Update SpaceAPi component with support for SpaceAPI v14
"""Support for the SpaceAPI."""
from contextlib import suppress
import voluptuous as vol
from homeassistant.components.http import HomeAssistantView
from homeassistant.const import (
ATTR_ENTITY_ID,
ATTR_ICON,
ATTR_LOCATION,
@fabaff
fabaff / xy-md02.py
Last active June 7, 2024 08:31
Get the temperature and the humidity from a XY-MD02 sensor
#!/usr/bin/env python
"""Get the temperature and the humidity from a XY-MD02 sensor."""
from pymodbus.client import ModbusSerialClient as ModbusClient
from pymodbus.constants import Endian
from pymodbus.payload import BinaryPayloadDecoder
SERIAL_PORT = "/dev/ttyUSB0"
BAUDRATE = 9600
SLAVE_ID = 1