some template sensors, and testing sending data to influxdb #37

Merged
ben merged 1 commits from hass-updates into main 2022-11-06 16:35:52 +00:00
5 changed files with 81 additions and 1 deletions

View File

@ -0,0 +1,6 @@
- sensor:
- name: "chance_of_rain"
unit_of_measurement: "%"
icon: "mdi:weather-pouring"
state: "{{ state_attr('weather.hourly', 'forecast')[:2] | map(attribute='precipitation_probability') | list | max | float }}"

View File

@ -130,6 +130,17 @@
tags: tags:
- hass-config - hass-config
- name: copy home assistant templates file
copy:
src: templates.yaml
dest: "{{ systemuserlist.hass.home }}/home-assistant/config/templates.yaml"
owner: "{{ systemuserlist.hass.uid }}"
group: "{{ systemuserlist.hass.gid }}"
mode: 0644
notify: restart hass container
tags:
- hass-config
- name: install git sync script - name: install git sync script
template: template:
src: git-hass-config.sh.j2 src: git-hass-config.sh.j2
@ -152,6 +163,16 @@
- hass-cron - hass-cron
- hass-git - hass-git
# the host needs to have bluez installed for the container to use bluetooth
- name: install bluetooth packages
apt:
name:
- bluez
- bluetooth
state: latest
tags:
- packages
# docker run --run -it -p 8091:8091 -p 3000:3000 --network # docker run --run -it -p 8091:8091 -p 3000:3000 --network
#bridgewithdns --device /dev/ttyACM0:/dev/zwave -v #bridgewithdns --device /dev/ttyACM0:/dev/zwave -v
# /home/ben/zwavejs:/usr/src/app/store zwavejs/zwavejs2mqtt:latest # /home/ben/zwavejs:/usr/src/app/store zwavejs/zwavejs2mqtt:latest
@ -224,6 +245,16 @@
- type: bind - type: bind
source: "{{ systemuserlist.hass.home }}/home-assistant/media" source: "{{ systemuserlist.hass.home }}/home-assistant/media"
target: /usr/var/media target: /usr/var/media
# for bluetooth, container needs access to the dbus socket
# https://www.home-assistant.io/integrations/bluetooth/
- type: bind
source: /run/dbus/
target: /run/dbus/
read_only: true
- type: bind
source: /etc/bluetooth/main.conf
target: /etc/bluetooth/main.conf
read_only: true
# scripts from role: common # scripts from role: common
# only depends on requests, which hass image has # only depends on requests, which hass image has
- type: bind - type: bind

View File

@ -66,6 +66,7 @@ tts:
automation: !include automations.yaml automation: !include automations.yaml
script: !include scripts.yaml script: !include scripts.yaml
scene: !include scenes.yaml scene: !include scenes.yaml
template: !include templates.yaml
{# calendar: {# calendar:
# {% for item in hass_caldav.urls %} # {% for item in hass_caldav.urls %}
@ -148,6 +149,42 @@ binary_sensor:
country: DE country: DE
workdays: [mon, tue, wed, thu, fri] workdays: [mon, tue, wed, thu, fri]
excludes: [sat, sun, holiday] excludes: [sat, sun, holiday]
{% for target in hass_ping -%}
- platform: ping
name: ping_{{ target.name }}
host: {{ target.host }}
count: 1
scan_interval: {{ target.interval_secs }}
{% endfor %}
device_tracker:
- platform: ping
hosts:
{% for target in hass_ping -%}
{{ target.name }}: {{ target.host }}
{% endfor %}
# enabling bluetooth
bluetooth:
influxdb:
host: "{{ influxdb_url }}"
port: 443
database: hass
username: hass
password: !secret influxdb_pass
ssl: true
verify_ssl: true
max_retries: 3
default_measurement: state
include:
entities:
- sensor.washing_machine_electric_consumption_w
- sensor.washing_machine_electric_consumption_kwh
tags:
instance: prod
source: hass
home: S21
shell_command: shell_command:
matrixmsg: /usr/local/bin/matrixmsg.py matrixmsg: /usr/local/bin/matrixmsg.py

View File

@ -23,6 +23,7 @@ if ! grep -q "secrets.y[a]ml" ${PATH_REPO}/.gitignore; then
fi fi
mkdir -p ${PATH_REPO}/config/ mkdir -p ${PATH_REPO}/config/
mkdir -p ${PATH_REPO}/config/.storage
{% for item in hass_config_repo_files -%} {% for item in hass_config_repo_files -%}
cp ${PATH_HASS}/config/{{ item }} ${PATH_REPO}/config/{{ item }} cp ${PATH_HASS}/config/{{ item }} ${PATH_REPO}/config/{{ item }}

View File

@ -1,7 +1,12 @@
# kind of dont need this file # this file is _not_ synced to the {{ hass_config_repo_name }} repo, so
# we can "safely" template in the actual secrets here and keep them out of
# configuration.yaml, which does get synced to the repo.
caldav_user: "{{ hass_caldav.user }}" caldav_user: "{{ hass_caldav.user }}"
caldav_passwd: "{{ hass_caldav.passwd }}" caldav_passwd: "{{ hass_caldav.passwd }}"
voicerss_api_key: {{ voicerss_api_key }} voicerss_api_key: {{ voicerss_api_key }}
# see group_vars/monitoring.yml
influxdb_pass: {{ hass_influxdb_pass }}