Skip to content

Instantly share code, notes, and snippets.

@8none1
8none1 / esw-0zaa-eu.yaml
Created December 6, 2023 15:58
Blueprint zigbee2mqtt Tuya Scene Switch
blueprint:
name: Tuya 4-Button Scene Switch (TS004) [Z2M]
description: Tuya 4-Button Scene Switch via Zigbee2MQTT
domain: automation
#Input declarations
input:
controller:
name: Zigbee2MQTT Controller Name
description: Exact name as shown in Zigbee2MQTT (beware trailing space)
default: ''
@8none1
8none1 / auto_browser_switch.py
Created July 5, 2022 20:09
Automatically change the default web browser depending on which workspace you are in
#!/usr/bin/env python3
from gi.repository import Wnck, Gtk
import os
def workspace_change(new_screen, old_workspace):
# Workspaces are numbered from 0
workspace_number = new_screen.get_active_workspace().get_number()
if workspace_number == 0:
print("Workspace 0 - setting browser to Chrome")
import paho.mqtt.client as mqtt
import json
import os
def on_connect(client, userdata, flags, rc):
print("Connected with result code "+str(rc))
client.subscribe("triones/control/global")
def on_message(client, userdata, msg):
#!/bin/bash
echo "Zoom call monitor started"
was_in_call=0 # Assuming we are not in a call when this starts
while true; do
pactl list source-outputs | grep zoom > /dev/null
in_call=$? # note inverted logic. 0 = true, 1 = false
@8none1
8none1 / virtual smart home.md
Last active October 2, 2021 17:17
Things supported by virtual smarthome

A virtual device that can be controlled via Amazon Alexa.

The node gets invoked through Amazon Alexa (either via a voice command or via the Alexa app) and outputs a msg object containing the updated device state as payload.

If the "Diff" option is enabled, the outgoing msg object will only contain those attributes that were set by the Alexa command. For example, "Alexa, dim the light to fifty percent" results in only the 'directive' and 'brightness' attributes being emitted.

The node also accepts inbound messages that can be used to inform Alexa about local device changes, which will then be reflected in the Alexa app. If the "Passthrough" option is enabled, this will also trigger an outgoing message with the complete current local state. In this case payload.source is set to 'device' instead of 'alexa'. If the inbound message has a topic attribute, its value will be present in the outbound msg instead of the topic configured in the editor.

Inputs