Skip to content

Instantly share code, notes, and snippets.

@roypeter
roypeter / homeassistant-esp32-esphome-a0221au-ultrasonic-sensor-integration.md
Last active April 21, 2024 20:32
Home Assistant ESP32 Esphome A0221AU Ultrasonic Sensor Integration

Integrating a A0221AU Ultrasonic Sensor with ESPHome and Home Assistant

This guide walks you through the process of integrating a custom ultrasonic sensor with ESPHome and Home Assistant, from initial setup to viewing the sensor data in Home Assistant.

Prerequisites

  • Home Assistant instance running
  • An ESP32 device
  • A0221AU Ultrasonic sensor

Steps

@benpeoples
benpeoples / readme.txt
Created June 1, 2020 16:03
ESP32 LEDC Maximum frequency by resolution
Per this forum post: https://esp32.com/viewtopic.php?t=6701
The way to calculate max PWM frequency is integer (log 2 (LEDC_APB_CLK / frequency))
With a LEDC_APB_CLK == 80MHz, these are the following maximum values, in Hz:
LEDC_TIMER_1_BIT, 40000000
LEDC_TIMER_2_BIT, 20000000
LEDC_TIMER_3_BIT, 10000000
LEDC_TIMER_4_BIT, 5000000
LEDC_TIMER_5_BIT, 2500000
@mattiaslundberg
mattiaslundberg / pylgtv.py
Created May 30, 2014 13:53
Control LG televisions from python
import serial
import re
class LGTV(object):
""" Interface for serial control of LG Televisions """
def __init__(self, port='/dev/ttyUSB0'):
super(LGTV, self).__init__()
self.port = port
@reclosedev
reclosedev / parsimonious_json.py
Last active August 29, 2018 19:13
JSON parser implementation using https://github.com/erikrose/parsimonious + simple demo and benchmark.
# -*- coding: utf-8 -*-
import ast
from parsimonious.grammar import Grammar
from parsimonious.nodes import NodeVisitor
json_syntax = r'''
json_file = ws? json ws?
json = object / array
@ChrisWills
ChrisWills / .screenrc-main-example
Created November 3, 2011 17:50
A nice default screenrc
# GNU Screen - main configuration file
# All other .screenrc files will source this file to inherit settings.
# Author: Christian Wills - cwills.sys@gmail.com
# Allow bold colors - necessary for some reason
attrcolor b ".I"
# Tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'