From cf72c2ad2625f923547147a2e17b3c7d5390a00d Mon Sep 17 00:00:00 2001 From: henk Date: Sat, 1 Oct 2022 16:03:08 +0200 Subject: [PATCH] 2022-10-01 16:03:08 --- homeassistant/esphome/bme280.yaml | 118 ++++++++++++++++++++++++++++++ nginx/README.md | 7 ++ nginx/git.pg0h.nl.conf | 30 ++++++++ nginx/unifi.conf | 37 ++++++++++ 4 files changed, 192 insertions(+) create mode 100644 homeassistant/esphome/bme280.yaml create mode 100644 nginx/README.md create mode 100644 nginx/git.pg0h.nl.conf create mode 100644 nginx/unifi.conf diff --git a/homeassistant/esphome/bme280.yaml b/homeassistant/esphome/bme280.yaml new file mode 100644 index 0000000..c56f29c --- /dev/null +++ b/homeassistant/esphome/bme280.yaml @@ -0,0 +1,118 @@ +esphome: + name: bme280 + board: d1_mini + platform: esp8266 + + + +# Enable logging +logger: + +# Enable Home Assistant API +#api: + + +ota: + password: !secret ota + +wifi: + networks: + - ssid: !secret wifi_ssid + password: !secret wifi_password + - ssid: !secret wifi_ssid2 + password: !secret wifi_password2 + domain: .lan + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "bme280 Fallback Hotspot" + password: !secret ap_password + +captive_portal: + +web_server: + port: 80 + +time: + - platform: sntp + timezone: Europe/Amsterdam + id: time1 + + +status_led: + pin: + number: GPIO2 + inverted: True + + + +mqtt: + broker: mqtt.lan + discovery: true + +i2c: + sda: D2 + scl: D1 + scan: true + +sensor: + - platform: sht3xd + temperature: + name: "SHT30 Temp" + id: z41_temp + accuracy_decimals: 2 + filters: + - offset: -1.9 + humidity: + name: "SHT30 Hum" + id: z41_hum + address: 0x45 + update_interval: 60s + + - platform: htu21d + temperature: + name: " HTU21 Temp" + accuracy_decimals: 2 + id: z3_temp + humidity: + name: " HTU21 Hum" + accuracy_decimals: 1 + id: z3_hum + + - platform: bme280 + temperature: + name: " BME280 Temperature" + accuracy_decimals: 2 + oversampling: 16x + id: z7_temp + pressure: + name: " BME280 Pressure" + id: z6_press + humidity: + name: " BME280 Humidity" + id: z6_hum + address: 0x76 + update_interval: 60s + - platform: template + name: " BME280 Absolute Humidity" + lambda: |- + const float mw = 18.01534; // molar mass of water g/mol + const float r = 8.31447215; // Universal gas constant J/mol/K + return (6.112 * powf(2.718281828, (17.67 * id(z7_temp).state) / + (id(z7_temp).state + 243.5)) * id(z6_hum).state * mw) / + ((273.15 + id(z7_temp).state) * r); // in grams/m^3 + accuracy_decimals: 2 + update_interval: 15s + icon: 'mdi:water' + unit_of_measurement: 'g/m³' + - platform: template + name: " BME280 Dew Point" + lambda: |- + return (243.5*(log(id(z6_hum).state/100)+((17.67*id(z7_temp).state)/ + (243.5+id(z7_temp).state)))/(17.67-log(id(z6_hum).state/100)- + ((17.67*id(z7_temp).state)/(243.5+id(z7_temp).state)))); + unit_of_measurement: °C + icon: 'mdi:thermometer-alert' + + + diff --git a/nginx/README.md b/nginx/README.md new file mode 100644 index 0000000..94eb93d --- /dev/null +++ b/nginx/README.md @@ -0,0 +1,7 @@ +Diverse reverse proxy conf files + +Kopieer ze en zet ze in de /etc/nginx/sites-enabled/ + +nginx -t + +en dan service nginx restart diff --git a/nginx/git.pg0h.nl.conf b/nginx/git.pg0h.nl.conf new file mode 100644 index 0000000..cc16fd5 --- /dev/null +++ b/nginx/git.pg0h.nl.conf @@ -0,0 +1,30 @@ + +# Gitea config +# destination ip is aangepast +server { + #listen 443 ssl http2; + # if you need IPv6: + listen [::]:443 ssl http2; + server_name git.pg0h.nl www.pg0h.nl; + access_log /var/log/nginx/gitpg0h-access.log combined; + error_log /var/log/nginx/gitpg0h-error.log info; + + http2_push_preload on; # Enable HTTP/2 Server Push + + ssl_certificate /etc/letsencrypt/live/pg0h.nl-0001/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/pg0h.nl-0001/privkey.pem; + include /etc/letsencrypt/options-ssl-nginx.conf; + ssl_dhparam /etc/letsencrypt/ssl-dhparams2.pem; + + ssl_stapling on; + ssl_stapling_verify on; + + location / { + proxy_pass http://172.16.69.69:3000; + client_max_body_size 100g; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } +} diff --git a/nginx/unifi.conf b/nginx/unifi.conf new file mode 100644 index 0000000..b9f2a31 --- /dev/null +++ b/nginx/unifi.conf @@ -0,0 +1,37 @@ +upstream unifi { + server 172.16.60.99:8443; + keepalive 64; +} +# bedoelt voor een unifi controller +server { + #listen 443 ssl http2; + # nee ik gebruik geen ipv4 meer op de internet kant + # if you need IPv6: + listen [::]:443 ssl http2; + server_name unifi.blablabla; + access_log /var/log/nginx/unifi-access.log combined; + error_log /var/log/nginx/unifi-error.log info; + http2_push_preload on; # Enable HTTP/2 Server Push + + ssl_certificate /etc/letsencrypt/live/uniifi.blablabla/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/unifi.blablabla/privkey.pem; + include /etc/letsencrypt/options-ssl-nginx.conf; + ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; + + add_header Strict-Transport-Security max-age=15768000; + ssl_stapling on; + ssl_stapling_verify on; + + location / { + + proxy_pass https://unifi; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + include /etc/nginx/proxy_params; + proxy_buffers 256 16k; + proxy_buffer_size 16k; + proxy_read_timeout 600s; + proxy_ssl_verify off; + proxy_http_version 1.1; + } +}