google-agents-cli-scaffold
Project scaffolding, deployment configuration, and CI/CD setup for Google ADK agents.
ha-mqtt-autodiscovery
Configures and publishes MQTT auto-discovery messages to automatically register IoT devices and sensors with Home Assistant, defining discovery payloads with device classes, state classes, units, and device grouping for multi-sensor devices. Use when integrating custom IoT devices, creating MQTT ...
Full skill instructions
Works with MQTT brokers (Mosquitto), paho-mqtt Python library, and Home Assistant MQTT integration.
Automatically register IoT devices and sensors with Home Assistant by publishing MQTT discovery configurations.
MQTT auto-discovery allows devices to automatically appear in Home Assistant without manual YAML configuration. Publish a JSON config to the discovery topic and HA creates the entity automatically.
Discovery Topic Pattern:
homeassistant/{component}/{node_id}/{object_id}/config
State Topic Pattern:
{node_id}/{sensor_type}/state
Use this skill when you need to:
Do NOT use when:
Follow these steps to set up MQTT auto-discovery:
import json
import paho.mqtt.client as mqtt
# Connect to MQTT broker
client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)
client.connect("192.168.68.123", 1883, 60)
# Publish discovery config
discovery_topic = "homeassistant/sensor/enviroplus_temperature/config"
config = {
"name": "Enviro+ Temperature",
"unique_id": "enviroplus_temperature",
"state_topic": "enviroplus/temperature/state",
"device_class": "temperature",
"unit_of_measurement": "°C",
"state_class": "measurement",
"device": {
"identifiers": ["enviroplus"],
"name": "Enviro+ Environmental Sensor",
"manufacturer": "Pimoroni",
"model": "Enviro+",
},
}
client.publish(discovery_topic, json.dumps(config), qos=1, retain=True)
# Publish sensor value
client.publish("enviroplus/temperature/state", "23.5", qos=1)
After publishing, the sensor sensor.enviro_temperature appears in Home Assistant automatically.
{
"name": "Friendly Name", # Display name in HA
"unique_id": "unique_identifier", # Must be globally unique
"state_topic": "device/sensor/state", # Topic where values are published
}
{
"device_class": "temperature", # Semantic type (enables icons, units)
"unit_of_measurement": "°C", # Unit for display
"state_class": "measurement", # Enables long-term statistics
"icon": "mdi:thermometer", # Custom icon (optional)
}
Group sensors under a single device:
{
"device": {
"identifiers": ["device_unique_id"], # List of identifiers
"name": "Device Name",
"manufacturer": "Manufacturer",
"model": "Model Name",
"sw_version": "1.0.0",
}
}
See references/sensor_configs.md for complete sensor configuration templates.
# Temperature
{
"device_class": "temperature",
"unit_of_measurement": "°C",
"state_class": "measurement",
}
# Humidity
{
"device_class": "humidity",
"unit_of_measurement": "%",
"state_class": "measurement",
}
# Pressure
{
"device_class": "atmospheric_pressure",
"unit_of_measurement": "hPa",
"state_class": "measurement",
}
# Light
{
"device_class": "illuminance",
"unit_of_measurement": "lx",
"state_class": "measurement",
}
# PM2.5
{
"device_class": "pm25",
"unit_of_measurement": "µg/m³",
"state_class": "measurement",
}
# PM10
{
"device_class": "pm10",
"unit_of_measurement": "µg/m³",
"state_class": "measurement",
}
# Power
{
"device_class": "power",
"unit_of_measurement": "W",
"state_class": "measurement",
}
# Energy (cumulative)
{
"device_class": "energy",
"unit_of_measurement": "kWh",
"state_class": "total_increasing",
}
| State Class | Purpose | Resets? | Statistics? |
|---|---|---|---|
measurement | Current value (temp, power) | No | Yes (mean, min, max) |
total | Monotonically increasing (odometer) | No | Yes (rate of change) |
total_increasing | Cumulative with resets (daily energy) | Yes | Yes (rate of change) |
import json
import paho.mqtt.client as mqtt
DEVICE_ID = "enviroplus"
BROKER = "192.168.68.123"
# Sensor definitions
SENSORS = {
"temperature": {
"name": "Temperature",
"device_class": "temperature",
"unit_of_measurement": "°C",
"state_class": "measurement",
},
"humidity": {
"name": "Humidity",
"device_class": "humidity",
"unit_of_measurement": "%",
"state_class": "measurement",
},
"pressure": {
"name": "Pressure",
"device_class": "atmospheric_pressure",
"unit_of_measurement": "hPa",
"state_class": "measurement",
},
"pm2_5": {
"name": "PM2.5",
"device_class": "pm25",
"unit_of_measurement": "µg/m³",
"state_class": "measurement",
},
}
def publish_discovery(client):
"""Publish discovery configs for all sensors."""
for sensor_key, config in SENSORS.items():
unique_id = f"{DEVICE_ID}_{sensor_key}"
discovery_topic = f"homeassistant/sensor/{unique_id}/config"
payload = {
"name": config["name"],
"unique_id": unique_id,
"state_topic": f"{DEVICE_ID}/{sensor_key}/state",
"device_class": config["device_class"],
"unit_of_measurement": config["unit_of_measurement"],
"state_class": config["state_class"],
"device": {
"identifiers": [DEVICE_ID],
"name": "Enviro+ Sensor",
"manufacturer": "Pimoroni",
"model": "Enviro+",
},
}
client.publish(discovery_topic, json.dumps(payload), qos=1, retain=True)
print(f"Published discovery for {config['name']}")
# Connect and publish
client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)
client.connect(BROKER, 1883, 60)
publish_discovery(client)
# Publish sample values
client.publish(f"{DEVICE_ID}/temperature/state", "23.5", qos=1)
client.publish(f"{DEVICE_ID}/humidity/state", "65", qos=1)
client.publish(f"{DEVICE_ID}/pressure/state", "1013.25", qos=1)
client.publish(f"{DEVICE_ID}/pm2_5/state", "12.3", qos=1)
client.disconnect()
For production devices, use auto-reconnect and offline queuing:
from collections import deque
import paho.mqtt.client as mqtt
class ResilientMQTT:
"""MQTT client with offline queuing and auto-reconnect."""
def __init__(self, broker: str, port: int = 1883):
self.broker = broker
self.port = port
self.connected = False
self._message_queue = deque(maxlen=1000)
self.client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)
self.client.on_connect = self._on_connect
self.client.on_disconnect = self._on_disconnect
def connect(self):
"""Connect with auto-reconnect enabled."""
self.client.reconnect_delay_set(min_delay=1, max_delay=60)
self.client.connect_async(self.broker, self.port, keepalive=60)
self.client.loop_start()
def _on_connect(self, client, userdata, flags, reason_code, properties):
if reason_code == 0:
self.connected = True
self._publish_discovery() # Re-publish on reconnect
self._flush_queue()
def _on_disconnect(self, client, userdata, flags, reason_code, properties):
self.connected = False
def publish(self, topic: str, payload: str, qos: int = 1):
"""Publish with offline queuing."""
if self.connected:
self.client.publish(topic, payload, qos=qos)
else:
self._message_queue.append({"topic": topic, "payload": payload})
def _flush_queue(self):
"""Publish queued messages on reconnect."""
while self._message_queue and self.connected:
msg = self._message_queue.popleft()
self.client.publish(msg["topic"], msg["payload"], qos=1)
def _publish_discovery(self):
"""Re-publish discovery configs on reconnect."""
# Implement your discovery publishing logic here
pass
See references/sensor_configs.md for complete sensor configuration templates, best practices, testing commands, and entity removal procedures.
Project scaffolding, deployment configuration, and CI/CD setup for Google ADK agents.
Set up tracing, logging, and monitoring for deployed ADK agents across Cloud Trace, BigQuery, and third-party platforms.
Enterprise Azure infrastructure architect generating Bicep or Terraform from workload descriptions.
Plan and configure production-ready Azure Kubernetes Service clusters with Day-0 and Day-1 best practices.
Raw mechanical interfaces fusing Swiss typographic print with military terminal aesthetics. Rigid grids, extreme type scale contrast, utilitarian color, analog degradation effects. For data-heavy dashboards, portfolios, or editorial sites that need to feel like declassified blueprints.
Web search, scraping, extraction, crawling, and monitoring via ScrapeGraph AI CLI.
Skill for working with Firebase Hosting (Classic). Use this when you want to deploy static web apps, Single Page Apps (SPAs), or simple microservices. Do NOT use for Firebase App Hosting.
Deploy and manage web apps with Firebase App Hosting. Use this skill when deploying Next.js/Angular apps with backends.
Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".
Build SEO-optimized pages at scale using templates, data, and proven playbook patterns.
Design and build isolated, reusable Convex backend components with clear boundaries and app-facing wrappers.
Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".
Opus.ai: Revolutionize Your Web Experience
Build a no-code AI app in minutes.
An IDE for code migration from legacy to modern frameworks through coding agents.
Automate CGI animation in live-action scenes
Branded artistic QR-code concepts
Launch a website in seconds with AI.
Streamline Your Coding Experience with AI Code Helper
Convert any screenshot or design to clean code.