Updated entity names for esphome/home-assistant

This commit is contained in:
Chris Stuurman 2025-04-25 22:29:27 +02:00
parent 26a21600f3
commit 8801f142f1
5 changed files with 202 additions and 18 deletions

View File

@ -140,6 +140,11 @@ sections:
icon: dashboard-icons/svg/home-assistant.svg icon: dashboard-icons/svg/home-assistant.svg
url: https://home-assistant.sthome.org url: https://home-assistant.sthome.org
target: newtab target: newtab
- title: ESPHome
description: ESPHome
icon: dashboard-icons/svg/esphome.svg
url: https://esphome.sthome.org
target: newtab
- title: Frigate - title: Frigate
description: Network video recorder description: Network video recorder
icon: dashboard-icons/svg/frigate.svg icon: dashboard-icons/svg/frigate.svg

View File

@ -9,6 +9,7 @@ services:
# build: . # build: .
env_file: .dashy.env env_file: .dashy.env
restart: unless-stopped restart: unless-stopped
#user: "${PUID}:${PGID}"
healthcheck: healthcheck:
test: ['CMD', 'node', '/app/services/healthcheck'] test: ['CMD', 'node', '/app/services/healthcheck']
interval: 1m30s interval: 1m30s
@ -34,19 +35,23 @@ services:
# http middlewares # http middlewares
# ---------------- # ----------------
#- "traefik.http.middlewares.${APPLICATION_NAME}-auth.basicauth.usersfile=/mnt/users/${APPLICATION_NAME}.txt" #- "traefik.http.middlewares.${APPLICATION_NAME}-auth.basicauth.usersfile=/mnt/users/${APPLICATION_NAME}.txt"
# - "traefik.http.middlewares.testheader.headers.accesscontrolallowmethods=GET,OPTIONS,PUT"
# - "traefik.http.middlewares.testheader.headers.accesscontrolalloworiginlist=https://truenas.sthome.org,https://dashy.sthome.org"
# - "traefik.http.middlewares.testheader.headers.accesscontrolmaxage=100"
# - "traefik.http.middlewares.testheader.headers.addvaryheader=true"
# #
# http routers # http routers
# ------------ # ------------
# http://appname.domainname/ # http://appname.domainname/
- "traefik.http.routers.${APPLICATION_NAME}-rtr.entrypoints=web" - "traefik.http.routers.${APPLICATION_NAME}-rtr.entrypoints=web"
- "traefik.http.routers.${APPLICATION_NAME}-rtr.rule=Host(`${APPLICATION_NAME}.${DOMAINNAME}`)&& PathPrefix(`/`)" - "traefik.http.routers.${APPLICATION_NAME}-rtr.rule=Host(`${APPLICATION_NAME}.${DOMAINNAME}`)&& PathPrefix(`/`)"
- "traefik.http.routers.${APPLICATION_NAME}-rtr.middlewares=http-mw-rateLimit-secureHeaders-redirect@file" - "traefik.http.routers.${APPLICATION_NAME}-rtr.middlewares=http-redirect@file"
- "traefik.http.routers.${APPLICATION_NAME}-rtr.service=${APPLICATION_NAME}-svc" - "traefik.http.routers.${APPLICATION_NAME}-rtr.service=${APPLICATION_NAME}-svc"
# https://appname.domainname/ # https://appname.domainname/
- "traefik.http.routers.${APPLICATION_NAME}-secure-rtr.entrypoints=websecure" - "traefik.http.routers.${APPLICATION_NAME}-secure-rtr.entrypoints=websecure"
- "traefik.http.routers.${APPLICATION_NAME}-secure-rtr.rule=Host(`${APPLICATION_NAME}.${DOMAINNAME}`)&& PathPrefix(`/`)" - "traefik.http.routers.${APPLICATION_NAME}-secure-rtr.rule=Host(`${APPLICATION_NAME}.${DOMAINNAME}`)&& PathPrefix(`/`)"
- "traefik.http.routers.${APPLICATION_NAME}-secure-rtr.tls=true" - "traefik.http.routers.${APPLICATION_NAME}-secure-rtr.tls=true"
- "traefik.http.routers.${APPLICATION_NAME}-secure-rtr.tls.certresolver=solver-dns" - "traefik.http.routers.${APPLICATION_NAME}-secure-rtr.tls.certresolver=solver-dns"
- "traefik.http.routers.${APPLICATION_NAME}-secure-rtr.middlewares=http-mw-rateLimit-secureHeaders@file" #- "traefik.http.routers.${APPLICATION_NAME}-secure-rtr.middlewares=http-mw-rateLimit-secureHeaders@file"
# - "traefik.http.routers.${APPLICATION_NAME}-secure-rtr.middlewares=${APPLICATION_NAME}-auth" # - "traefik.http.routers.${APPLICATION_NAME}-secure-rtr.middlewares=${APPLICATION_NAME}-auth"
- "traefik.http.routers.${APPLICATION_NAME}-secure-rtr.service=${APPLICATION_NAME}-svc" - "traefik.http.routers.${APPLICATION_NAME}-secure-rtr.service=${APPLICATION_NAME}-svc"

View File

@ -51,17 +51,29 @@ captive_portal:
#preferences: #preferences:
# flash_write_interval: 30s # flash_write_interval: 30s
sun:
latitude: 25.7566° S
longitude: 28.1914° E
time:
- platform: homeassistant
#define OUTPUT_R1 16
#define OUTPUT_R2 17
#define OUTPUT_R3 18
#define OUTPUT_R4 19
switch: switch:
- platform: gpio - platform: gpio
pin: pin:
number: GPIO16 number: GPIO16
inverted: true inverted: False
id: relay1 id: relay1
name: "Relay 1" name: "Floodlights Backyard"
icon: "mdi:run-fast" icon: "mdi:light-flood-down"
restore_mode: RESTORE_DEFAULT_OFF restore_mode: RESTORE_DEFAULT_OFF
on_turn_on: on_turn_on:
- delay: 1000ms - delay: 300s
- switch.turn_off: relay1 - switch.turn_off: relay1
- platform: gpio - platform: gpio
@ -93,9 +105,112 @@ switch:
number: GPIO19 number: GPIO19
inverted: true inverted: true
id: relay4 id: relay4
name: "Relay 4" name: "Alarm Zone 4"
icon: "mdi:run-fast" icon: "mdi:alarm-light-outline"
restore_mode: RESTORE_DEFAULT_OFF restore_mode: RESTORE_DEFAULT_OFF
on_turn_on: on_turn_on:
- if:
condition:
- sun.is_below_horizon:
then:
- switch.turn_on: relay1
- delay: 1000ms - delay: 1000ms
- switch.turn_off: relay4 - switch.turn_off: relay4
#define ANALOG_A1 33
#define ANALOG_A2 32
#define ANALOG_A3 35
#define ANALOG_A4 34
#define ANALOG_A5 39
#define ANALOG_A6 36
#sensor:
# - platform: adc
# pin: 33
# name: "A1 Voltage"
# update_interval: 1s
# attenuation: 12db
# filters:
# # - multiply: 1.51515
# - lambda:
# if (x >= 3.11) {
# return x * 1.60256;
# } else if (x <= 0.15) {
# return 0;
# } else {
# return x * 1.51;
# }
# - platform: adc
# pin: 32
# name: "A2 Voltage"
# update_interval: 1s
# attenuation: 12db
# filters:
# - lambda:
# if (x >= 3.11) {
# return x * 1.60256;
# } else if (x <= 0.15) {
# return 0;
# } else {
# return x * 1.51;
# }
# - platform: adc
# pin: 35
# name: "A3 Voltage"
# update_interval: 1s
# attenuation: 12db
# sampling_mode: avg
# filters:
# - lambda:
# if (x >= 3.11) {
# return x * 1.60256;
# } else if (x <= 0.15) {
# return 0;
# } else {
# return x * 1.51;
# }
# - platform: adc
# pin: 34
# name: "A4 Voltage"
# update_interval: 5s
# attenuation: 12db
# filters:
# - lambda:
# if (x >= 3.11) {
# return x * 1.60256;
# } else if (x <= 0.15) {
# return 0;
# } else {
# return x * 1.51;
# }
# - platform: adc
# pin: 39
# name: "A5 Voltage"
# update_interval: 5s
# attenuation: 12db
# filters:
# - lambda:
# if (x >= 3.11) {
# return x * 1.60256;
# } else if (x <= 0.15) {
# return 0;
# } else {
# return x * 1.51;
# }
# - platform: adc
# pin: 36
# name: "A6 Voltage"
# update_interval: 5s
# attenuation: 12db
# filters:
# - lambda:
# if (x >= 3.11) {
# return x * 1.60256;
# } else if (x <= 0.15) {
# return 0;
# } else {
# return x * 1.51;
# }

View File

@ -0,0 +1,52 @@
esphome:
name: sthome-ut4
friendly_name: sthome-ut4
esp32:
board: esp32-c3-devkitm-1
variant: ESP32C3
framework:
type: esp-idf
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "qmfAFWSynz6VhvR5oBrtx2wnNP8n1yZKslVGNDMTWMc="
ota:
- platform: esphome
password: "2144396ae4f6a829dc7fe7de88c5887b"
wifi:
#ssid: !secret wifi_ssid
#password: !secret wifi_password
output_power: 8.5dB
# we will use local dns server for local dns resolution
domain: ".sthome.org"
networks:
- ssid: !secret wifi_ssid1
password: !secret wifi_password1
- ssid: !secret wifi_ssid2
password: !secret wifi_password2
- ssid: !secret wifi_ssid3
password: !secret wifi_password3
- ssid: !secret wifi_ssid4
password: !secret wifi_password4
manual_ip:
# For faster connection startup, set a static IP address
# Set this to the IP of the ESP
static_ip: 10.0.2.4
gateway: 10.0.0.2
subnet: 255.255.240.0
dns1: 10.0.0.1
dns2: 10.0.0.2
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Sthome-Ut4 Fallback Hotspot"
password: "FtGGLAU7OFPx"
captive_portal:

View File

@ -1,7 +1,9 @@
alias: Person detect Actions alias: Person detect Actions
description: "" description: ""
icon: mdi:cctv
variables: variables:
relay: null relay_floodlight: null
relay_alarm: switch.sthome_ut1_alarm_zone_4
counter: null counter: null
sequence: sequence:
- if: - if:
@ -9,7 +11,7 @@ sequence:
value_template: "{{ camera == 'Driveway' }}" value_template: "{{ camera == 'Driveway' }}"
then: then:
- variables: - variables:
relay: switch.sthome_ut1_relay_1 relay_floodlight: switch.sthome_ut1_floodlights_backyard
counter: counter.driveway_person_alarm_counter counter: counter.driveway_person_alarm_counter
else: else:
- if: - if:
@ -17,7 +19,7 @@ sequence:
value_template: "{{ camera == 'Patio' }}" value_template: "{{ camera == 'Patio' }}"
then: then:
- variables: - variables:
relay: switch.sthome_ut1_relay_2 relay_floodlight: switch.sthome_ut1_floodlights_backyard
counter: counter.patio_person_alarm_counter counter: counter.patio_person_alarm_counter
else: else:
- if: - if:
@ -25,7 +27,7 @@ sequence:
value_template: "{{ camera == 'Westwall' }}" value_template: "{{ camera == 'Westwall' }}"
then: then:
- variables: - variables:
relay: switch.sthome_ut1_relay_2 relay_floodlight: switch.sthome_ut1_floodlights_backyard
counter: counter.west_wall_person_alarm_counter counter: counter.west_wall_person_alarm_counter
else: else:
- if: - if:
@ -33,7 +35,7 @@ sequence:
value_template: "{{ camera == 'Eastwall' }}" value_template: "{{ camera == 'Eastwall' }}"
then: then:
- variables: - variables:
relay: switch.sthome_ut1_relay_3 relay_floodlight: switch.sthome_ut1_floodlights_backyard
counter: counter.east_wall_person_alarm_counter counter: counter.east_wall_person_alarm_counter
else: else:
- if: - if:
@ -41,7 +43,7 @@ sequence:
value_template: "{{ camera == 'Backyard' }}" value_template: "{{ camera == 'Backyard' }}"
then: then:
- variables: - variables:
relay: switch.sthome_ut1_relay_4 relay_floodlight: switch.sthome_ut1_floodlights_backyard
counter: counter.backyard_person_alarm_counter counter: counter.backyard_person_alarm_counter
else: else:
- stop: Unknown camera - stop: Unknown camera
@ -57,9 +59,14 @@ sequence:
- condition: template - condition: template
value_template: "{{ importance == \"max\" }}" value_template: "{{ importance == \"max\" }}"
then: then:
action: switch.turn_on sequence:
- action: switch.turn_on
target: target:
entity_id: "{{ relay }}" entity_id: "{{ relay_floodlight }}"
data: {}
- action: switch.turn_on
target:
entity_id: "{{ relay_alarm }}"
data: {} data: {}
- action: script.send_dynamic_notification_to_devices - action: script.send_dynamic_notification_to_devices
data: data: