Skip to content

Instantly share code, notes, and snippets.

View pavax's full-sized avatar

Patrick D. pavax

  • schaltstelle
  • Bern, Switzerland
View GitHub Profile
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="no" omit-xml-declaration="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="text()">
@pavax
pavax / SvgFixingDirective.ts
Last active November 10, 2019 07:28
Fixing fontawesome SVG mask, clip-path and fill url() values for the safari browser when using a base-href
import { AfterViewInit, Directive, ElementRef, Inject } from '@angular/core';
import { AbstractSubscriber } from '../../core/abstract-subscriber';
import { filter, startWith, takeUntil } from 'rxjs/operators';
import { NavigationEnd, Router } from '@angular/router';
import { APP_BASE_HREF, Location } from '@angular/common';
function isSafariBrowser() {
return navigator.vendor && navigator.vendor.indexOf('Apple') > -1 &&
navigator.userAgent &&
navigator.userAgent.indexOf('CriOS') === -1 &&
@pavax
pavax / motion_aware_lights.yaml
Last active April 6, 2025 22:20
Home Assistant Motion Aware Lights Blueprint
blueprint:
name: Motion-Aware Light Control
description: >
Automatically controls lights based on motion detection, with optional conditions for illuminance and binary sensors.
The automation can be disabled using binary sensors (e.g., sleep mode or movie watching) to prevent lights from turning on under certain conditions.
Additionally, if the lights were already turned on and motion is detected, the automation will wait for the motion detection to clear before turning off the lights.
domain: automation
source_url: https://gist.github.com/pavax/ce9559c428b9a3c369ce79ef215ef1e2
homeassistant:
@pavax
pavax / nagging_alert_notification.yaml
Last active February 4, 2025 22:44
Home Assistant Alert Notification Blueprint
blueprint:
name: Nagging Alerting Notification Automation
description: >
Trigger an alert based on the state of a given sensor.
The Alert is send to a mobile app device and repeats as long as the sensor is in the given state.
An additonal action can be specified. This might be useful to tts the message.
domain: automation
source_url: https://gist.github.com/pavax/08705e383bdd3b58ea7b75a1f01c7e54
input:
sensor_entity:
@pavax
pavax / scheduled_timeslot.yaml
Last active January 3, 2021 12:11
Home Assistant Scheduled Timeslot Blueprint
blueprint:
name: Scheduled Timeslot
description: >
Timeslot Scheduler (e.g for vacuums) that allows to define a action to be executed within the specified timeslot and its condition.
domain: automation
input:
monday_enabled:
name: Monday
default: false
selector:
@pavax
pavax / script.vacuum_dispatch.yaml
Last active December 24, 2020 13:43
home-ssistant script: [vacuum] room dispatcher
alias: '[vacuum] room dispatcher'
sequence:
- variables:
room_name: >-
{{room_name|lower|replace('ä','ae')|replace('ü','ue')|replace('ö','oe')
}}
room_last_trigger: 'input_datetime.vacuum_{{room_name}}_last_schedule_triggered'
room_zone: '{{ state_attr(room_last_trigger,''zone'') }}'
- condition: template
value_template: '{{ room_zone != null }}'
blueprint:
name: Ikea on/off-switch and 5-Button Toggle
description: Custom Blueprint for Ikea Remote Controls (On/Off, TRADFRI remote control) x
domain: automation
input:
remote:
name: Remote
description: IKEA remote to use
selector:
entity:
@pavax
pavax / z2m-ikea-remote-controls.yaml
Last active December 12, 2024 19:38
z2m-ikea-remote-controls.yaml
blueprint:
name: "[Z2M] Generic Ikea Remote Control"
description: "Blueprint for Ikea Remote Controls (On/Off, 5-Button, Shortuct)"
domain: automation
source_url: https://community.home-assistant.io/t/zigbee2mqtt-ikea-on-off-switch-general-use/263895
input:
remote:
name: Remote
description: IKEA remote to use (e.g sensor.kitchen_remote_action)
selector:
blueprint:
name: Turn off entity after a while
description: >
Turn off entity after a period of time
domain: automation
source_url: "https://gist.github.com/pavax/4eb086412c1e455a26da4dc64673b3b9"
input:
target_entity:
name: target_entity
description: "The entity to turn off after a while."
@pavax
pavax / window_aware_lights_control.yaml
Last active June 21, 2021 18:45
window_aware_lights_control.yaml
blueprint:
name: Window aware Light control
description: >
Turn off the active lights when a window is opened.
As soon as the window is closed, turn them on again.
domain: automation
source_url: https://gist.github.com/pavax/TBD
input:
window_sensor_entity:
name: Window Sensor Entity