diff --git a/dashy/data/config/config.yml b/dashy/data/config/config.yml index 260052b..af36b0d 100644 --- a/dashy/data/config/config.yml +++ b/dashy/data/config/config.yml @@ -140,6 +140,11 @@ sections: icon: dashboard-icons/svg/home-assistant.svg url: https://home-assistant.sthome.org target: newtab + - title: ESPHome + description: ESPHome + icon: dashboard-icons/svg/esphome.svg + url: https://esphome.sthome.org + target: newtab - title: Frigate description: Network video recorder icon: dashboard-icons/svg/frigate.svg diff --git a/dashy/stacks/compose.yml b/dashy/stacks/compose.yml index 16c3df0..37c922e 100644 --- a/dashy/stacks/compose.yml +++ b/dashy/stacks/compose.yml @@ -9,6 +9,7 @@ services: # build: . env_file: .dashy.env restart: unless-stopped + #user: "${PUID}:${PGID}" healthcheck: test: ['CMD', 'node', '/app/services/healthcheck'] interval: 1m30s @@ -34,19 +35,23 @@ services: # http middlewares # ---------------- #- "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://appname.domainname/ - "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.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" # https://appname.domainname/ - "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.tls=true" - "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.service=${APPLICATION_NAME}-svc" \ No newline at end of file diff --git a/esphome/data/config/sthome-ut1.yaml b/esphome/data/config/sthome-ut1.yaml index 99d5e0d..1f927f5 100644 --- a/esphome/data/config/sthome-ut1.yaml +++ b/esphome/data/config/sthome-ut1.yaml @@ -51,17 +51,29 @@ captive_portal: #preferences: # 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: - platform: gpio pin: number: GPIO16 - inverted: true + inverted: False id: relay1 - name: "Relay 1" - icon: "mdi:run-fast" + name: "Floodlights Backyard" + icon: "mdi:light-flood-down" restore_mode: RESTORE_DEFAULT_OFF on_turn_on: - - delay: 1000ms + - delay: 300s - switch.turn_off: relay1 - platform: gpio @@ -93,9 +105,112 @@ switch: number: GPIO19 inverted: true id: relay4 - name: "Relay 4" - icon: "mdi:run-fast" + name: "Alarm Zone 4" + icon: "mdi:alarm-light-outline" restore_mode: RESTORE_DEFAULT_OFF on_turn_on: + - if: + condition: + - sun.is_below_horizon: + then: + - switch.turn_on: relay1 - delay: 1000ms - 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; +# } + + diff --git a/esphome/data/config/sthome-ut4.yaml b/esphome/data/config/sthome-ut4.yaml new file mode 100644 index 0000000..4c5e8ed --- /dev/null +++ b/esphome/data/config/sthome-ut4.yaml @@ -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: \ No newline at end of file diff --git a/home-assistant/Person detect Actions.yml b/home-assistant/Person detect Actions.yml index 70b671f..1264ac4 100644 --- a/home-assistant/Person detect Actions.yml +++ b/home-assistant/Person detect Actions.yml @@ -1,7 +1,9 @@ alias: Person detect Actions description: "" +icon: mdi:cctv variables: - relay: null + relay_floodlight: null + relay_alarm: switch.sthome_ut1_alarm_zone_4 counter: null sequence: - if: @@ -9,7 +11,7 @@ sequence: value_template: "{{ camera == 'Driveway' }}" then: - variables: - relay: switch.sthome_ut1_relay_1 + relay_floodlight: switch.sthome_ut1_floodlights_backyard counter: counter.driveway_person_alarm_counter else: - if: @@ -17,7 +19,7 @@ sequence: value_template: "{{ camera == 'Patio' }}" then: - variables: - relay: switch.sthome_ut1_relay_2 + relay_floodlight: switch.sthome_ut1_floodlights_backyard counter: counter.patio_person_alarm_counter else: - if: @@ -25,7 +27,7 @@ sequence: value_template: "{{ camera == 'Westwall' }}" then: - variables: - relay: switch.sthome_ut1_relay_2 + relay_floodlight: switch.sthome_ut1_floodlights_backyard counter: counter.west_wall_person_alarm_counter else: - if: @@ -33,7 +35,7 @@ sequence: value_template: "{{ camera == 'Eastwall' }}" then: - variables: - relay: switch.sthome_ut1_relay_3 + relay_floodlight: switch.sthome_ut1_floodlights_backyard counter: counter.east_wall_person_alarm_counter else: - if: @@ -41,7 +43,7 @@ sequence: value_template: "{{ camera == 'Backyard' }}" then: - variables: - relay: switch.sthome_ut1_relay_4 + relay_floodlight: switch.sthome_ut1_floodlights_backyard counter: counter.backyard_person_alarm_counter else: - stop: Unknown camera @@ -57,10 +59,15 @@ sequence: - condition: template value_template: "{{ importance == \"max\" }}" then: - action: switch.turn_on - target: - entity_id: "{{ relay }}" - data: {} + sequence: + - action: switch.turn_on + target: + entity_id: "{{ relay_floodlight }}" + data: {} + - action: switch.turn_on + target: + entity_id: "{{ relay_alarm }}" + data: {} - action: script.send_dynamic_notification_to_devices data: send_to_sm_n986b: "{{ send_to_sm_n986b }}"