Skip to content

Instantly share code, notes, and snippets.

@Grateful-J
Grateful-J / ikea-rodret_E2201_ZHA-Z2M_control-light.yaml
Last active February 6, 2025 11:10 — forked from damru/ikea-rodret_E2201_ZHA-Z2M_control-light.yaml
IKEA RODRET Dimmer Remote (E2201) - Z2M - Control Light
blueprint:
name: IKEA Rodret Dimmer (Zigbee2MQTT)
description: "## IKEA RODRET Dimmer remote (v1.2)
For use with Zigbee2MQTT (cf [MQTT](https://www.home-assistant.io/integrations/mqtt)
+ [Z2M addon](https://www.zigbee2mqtt.io/guide/installation/03_ha_addon.html)).
Available controls:
- Click the **on** or **off** buttons
- Click and hold the **on**/**off** buttons (optional)
- Double click the **on** or **off** buttons (optional)
- Triple click the **on** or **off** buttons (optional)
@Grateful-J
Grateful-J / index.js
Created September 29, 2023 22:23 — forked from ihsangan/index.js
Send email from Workers with MailChannel API
async function readRequestBody(request) {
const { headers } = request;
const contentType = headers.get('content-type') || '';
if (contentType.includes('application/json')) {
return JSON.stringify(await request.json());
} else if (contentType.includes('form')) {
const formData = await request.formData();
const body = {};
for (const entry of formData.entries()) {
body[entry[0]] = entry[1];