Skip to content

Instantly share code, notes, and snippets.

@hkraal
hkraal / home-assistant_autodimm-lights.j2
Last active July 15, 2023 07:02
A Home-assistant automation to dimm the lights gradually with vanilla HA.
{% set min_dim_level = 20 %}
{% set max_dim_level = 100 %}
# Calculate sun_dim_level based on sun elevation.
{% set sun_dim_level = 100 - (states.sun.sun.attributes.elevation|abs * 3) %}
{% if sun_dim_level < min_dim_level %}
{% set sun_dim_level = min_dim_level %}
{% endif %}
# Calculate time_dim_level based on time and reset to max.
@hkraal
hkraal / delete_logs.py
Created March 24, 2020 18:05
Script for removing messages from Graylog
#!/usr/bin/env python
"""
# Remove data from Graylog.
This script makes it possible to selectively remove data from an index set.
### Usage
* Setup an SSH tunnel to Graylog and Elasticsearch.