Skip to content

Instantly share code, notes, and snippets.

View chpego's full-sized avatar
😃

chpego

😃
  • Strasbourg, France
View GitHub Profile
#!/usr/bin/env bash
# Setup script environment
set -o errexit #Exit immediately if a pipeline returns a non-zero status
set -o errtrace #Trap ERR from shell functions, command substitutions, and commands from subshell
set -o nounset #Treat unset variables as an error
set -o pipefail #Pipe will exit with last non-zero status if applicable
shopt -s expand_aliases
alias die='EXIT=$? LINE=$LINENO error_exit'
trap die ERR
{% set mystates = states|selectattr('entity_id', 'in', state_attr('light.all', 'entity_id')) |selectattr('state', 'equalto', 'on') | list %}
{% set names = mystates | map(attribute='name') | list %}
{% set times = mystates | map(attribute='last_updated') | list %}
{% for i in range(mystates | length) %}
{{ names[i] }} depuis ( {{ as_timestamp(times[i])|timestamp_custom("%Hh:%M") }} ),
{%- endfor %}
---
automation:
- alias: "[System] - Chargement Tablette"
trigger:
- platform: numeric_state
entity_id: sensor.tablette_info
attribute: batteryLevel
above: 0
below: 6
- platform: state
- alias: "[System] - Heure Reveil"
trigger:
platform: time
at: input_datetime.heure_reveil_avant_A
action:
- service: hommeassistant.toggle
data:
entity_id: switch.monchauffage
- alias: "[System] - Modification de l'input_datetime heure_reveil_avant_A"
@chpego
chpego / shelly.yaml
Created January 8, 2021 12:54
shelly automation
- alias: "ShellyButton Simple"
trigger:
- platform: state
entity_id: binary_sensor.shelly_shbtn_1_*******_switch
to: "on"
condition:
condition: template
value_template: "{{ state_attr('binary_sensor.shelly_shbtn_1_*******_switch', 'click_type') == 'single' }}"
action:
#### WHAT YOU WANT ####
@chpego
chpego / reveil.yaml
Created January 8, 2021 09:33
package reveil pour home assistant
---
automation:
- alias: "[System] - Heure Reveil PERSONNE 1"
trigger:
platform: state
entity_id: sensor.telephone_next_alarm
for: "00:00:15"
action:
- choose:
- conditions: >