Compare commits
45 Commits
8d4d4f7308
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| f046229313 | |||
| e4401e4a94 | |||
| 7b0c6a5f9e | |||
| 341ffd2385 | |||
| fb5d102ca5 | |||
| b4c22b7f5b | |||
| 8c76112230 | |||
| 4a6c9c5d2c | |||
| 02375b1bbb | |||
| 0684906bc0 | |||
| 5f2fbac8bd | |||
| b09b940a32 | |||
| 8115ca3220 | |||
| de8048e727 | |||
| 44b0915d5e | |||
| 0448715529 | |||
| 5b593735c5 | |||
| ec244c4387 | |||
| e9a33c69a7 | |||
| 7a397eb242 | |||
| 3823f24ed7 | |||
| 1fa53926ad | |||
| 2716eb140f | |||
| 03fe9c341b | |||
| 70fcc5669f | |||
| b08d6b0b63 | |||
| 92b9156c3e | |||
| 22110a5cc8 | |||
| bbcd5bd21e | |||
| 4d47ce1c42 | |||
| 0ca7d0be34 | |||
| 4ea21be42b | |||
| 9eab138daf | |||
| d9f79376ec | |||
| 726848452a | |||
| 6c6d2cb127 | |||
| 9e2c799f9d | |||
| 7e4dedcafd | |||
| e214e17be8 | |||
| be054407ae | |||
| 9574d56569 | |||
| 83d85fc3fd | |||
| 46e86338cc | |||
| 46f792cb03 | |||
| 274bfdf4ee |
@@ -0,0 +1,3 @@
|
|||||||
|
Volg de instructies van deze Github pagina.
|
||||||
|
|
||||||
|
https://github.com/aandrew-me/tgpt
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
LET OP deze website werkt allleen als je ipv6 hebt!
|
|
||||||
|
|
||||||
|
|
||||||
Copieren van deze repo is makkelijk.
|
Copieren van deze repo is makkelijk.
|
||||||
|
|
||||||
|
|||||||
@@ -9,3 +9,10 @@ Belangrijk is dat je docker-compose niet moet installeren dat is nu
|
|||||||
docker compose ( ja met spatie zonder -)
|
docker compose ( ja met spatie zonder -)
|
||||||
|
|
||||||
Als die niet aanwezig is sudo apt install docker-compose-plugin -y
|
Als die niet aanwezig is sudo apt install docker-compose-plugin -y
|
||||||
|
|
||||||
|
|
||||||
|
Goede docker compose website
|
||||||
|
|
||||||
|
https://docs.linuxserver.io/images/docker-mariadb/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
tag Available Description
|
||||||
|
latest XFCE Alpine
|
||||||
|
ubuntu-xfce XFCE Ubuntu
|
||||||
|
fedora-xfce XFCE Fedora
|
||||||
|
arch-xfce XFCE Arch
|
||||||
|
alpine-kde KDE Alpine
|
||||||
|
ubuntu-kde KDE Ubuntu
|
||||||
|
fedora-kde KDE Fedora
|
||||||
|
arch-kde KDE Arch
|
||||||
|
alpine-mate MATE Alpine
|
||||||
|
ubuntu-mate MATE Ubuntu
|
||||||
|
fedora-mate MATE Fedora
|
||||||
|
arch-mate MATE Arch
|
||||||
|
alpine-i3 i3 Alpine
|
||||||
|
ubuntu-i3 i3 Ubuntu
|
||||||
|
fedora-i3 i3 Fedora
|
||||||
|
arch-i3 i3 Arch
|
||||||
|
alpine-openbox Openbox Alpine
|
||||||
|
ubuntu-openbox Openbox Ubuntu
|
||||||
|
fedora-openbox Openbox Fedora
|
||||||
|
arch-openbox Openbox Arch
|
||||||
|
alpine-icewm IceWM Alpine
|
||||||
|
ubuntu-icewm IceWM Ubuntu
|
||||||
|
fedora-icewm IceWM Fedora
|
||||||
|
arch-icewm IceWM Arch
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
# https://docs.linuxserver.io/images/docker-rdesktop/
|
||||||
|
---
|
||||||
|
services:
|
||||||
|
rdesktop:
|
||||||
|
image: lscr.io/linuxserver/rdesktop:ubuntu-xfce
|
||||||
|
container_name: rdesktop
|
||||||
|
security_opt:
|
||||||
|
- seccomp:unconfined #optional
|
||||||
|
environment:
|
||||||
|
- PUID=1000
|
||||||
|
- PGID=1000
|
||||||
|
- TZ=Europe/Amsterdam
|
||||||
|
- LC_ALL=nl_NL.UTF-8
|
||||||
|
- KEYBOARD=en-us-qwerty
|
||||||
|
- TITLE=rdesktop
|
||||||
|
hostname: rdesktop
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock #optional
|
||||||
|
- ./data:/config #optional
|
||||||
|
ports:
|
||||||
|
- 3389:3389
|
||||||
|
devices:
|
||||||
|
- /dev/dri:/dev/dri #optional
|
||||||
|
shm_size: "1gb" #optional
|
||||||
|
restart: unless-stopped
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
services:
|
||||||
|
homeassistant:
|
||||||
|
image: lscr.io/linuxserver/homeassistant:latest
|
||||||
|
container_name: homeassistant
|
||||||
|
network_mode: host
|
||||||
|
environment:
|
||||||
|
- PUID=1000
|
||||||
|
- PGID=1000
|
||||||
|
- TZ=Europe/Amsterdam
|
||||||
|
volumes:
|
||||||
|
- ./data:/config
|
||||||
|
- /var/run/dbus:/var/run/dbus:ro
|
||||||
|
#devices:
|
||||||
|
# - /path/to/device:/path/to/device #optional
|
||||||
|
restart: unless-stopped
|
||||||
|
cap_add:
|
||||||
|
- NET_ADMIN
|
||||||
|
- NET_RAW
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
# https://docs.linuxserver.io/images/docker-mariadb/
|
||||||
|
---
|
||||||
|
services:
|
||||||
|
mariadb:
|
||||||
|
image: lscr.io/linuxserver/mariadb:latest
|
||||||
|
container_name: mariadb
|
||||||
|
environment:
|
||||||
|
- PUID=1000
|
||||||
|
- PGID=1000
|
||||||
|
- TZ=Europe/Amsterdam
|
||||||
|
- MYSQL_ROOT_PASSWORD=ROOT_ACCESS_PASSWORD
|
||||||
|
- MYSQL_DATABASE=USER_DB_NAME #optional
|
||||||
|
- MYSQL_USER=MYSQL_USER #optional
|
||||||
|
- MYSQL_PASSWORD=DATABASE_PASSWORD #optional
|
||||||
|
#- REMOTE_SQL=http://URL1/your.sql,https://URL2/your.sql #optional
|
||||||
|
volumes:
|
||||||
|
- ./config:/config
|
||||||
|
ports:
|
||||||
|
- 3306:3306
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
|
||||||
|
services:
|
||||||
|
pihole:
|
||||||
|
container_name: pihole
|
||||||
|
image: pihole/pihole:latest
|
||||||
|
# For DHCP it is recommended to remove these ports and instead add: network_mode: "host"
|
||||||
|
network_mode: "host"
|
||||||
|
#ports:
|
||||||
|
# - "53:53/tcp"
|
||||||
|
# - "53:53/udp"
|
||||||
|
# - "67:67/udp" # Only required if you are using Pi-hole as your DHCP server
|
||||||
|
# - "80:80/tcp"
|
||||||
|
environment:
|
||||||
|
TZ: 'Europe/Amsterdam'
|
||||||
|
WEBPASSWORD: ''
|
||||||
|
# Volumes store your data between container upgrades
|
||||||
|
volumes:
|
||||||
|
- './etc-pihole:/etc/pihole'
|
||||||
|
- './etc-dnsmasq.d:/etc/dnsmasq.d'
|
||||||
|
- './log:/var/log/pihole'
|
||||||
|
# https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
|
||||||
|
cap_add:
|
||||||
|
- NET_ADMIN # Required if you are using Pi-hole as your DHCP server, else not needed
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
# https://docs.linuxserver.io/images/docker-webtop/
|
||||||
|
---
|
||||||
|
services:
|
||||||
|
webtop:
|
||||||
|
image: lscr.io/linuxserver/webtop:ubuntu-xfce
|
||||||
|
container_name: webtop
|
||||||
|
hostname: webtop
|
||||||
|
security_opt:
|
||||||
|
- seccomp:unconfined #optional
|
||||||
|
environment:
|
||||||
|
- PUID=1000
|
||||||
|
- PGID=1000
|
||||||
|
- TZ=Europe/Amsterdam
|
||||||
|
- LC_ALL=nl_NL.UTF-8
|
||||||
|
- SUBFOLDER=/ #optional
|
||||||
|
- KEYBOARD=en-us-qwerty #optional
|
||||||
|
- TITLE=Webtop #optional
|
||||||
|
volumes:
|
||||||
|
- ./data:/config
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock #optional
|
||||||
|
ports:
|
||||||
|
- 3000:3000
|
||||||
|
- 3001:3001
|
||||||
|
devices:
|
||||||
|
- /dev/dri:/dev/dri #optional
|
||||||
|
shm_size: "1gb" #optional
|
||||||
|
restart: unless-stopped
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
This Gitea docker server with its own ip adress
|
This Gitea docker server with its own ip adress
|
||||||
|
|
||||||
Gitea is a git server and is easy to use
|
Gitea is a git server and is easy to use
|
||||||
|
|
||||||
|
Please note that http(s) and ssh git push does not work on the same host(VM/LXC) as the pub_net container!!!
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ esphome:
|
|||||||
logger:
|
logger:
|
||||||
|
|
||||||
# Enable Home Assistant API
|
# Enable Home Assistant API
|
||||||
#api:
|
api:
|
||||||
|
|
||||||
|
|
||||||
ota:
|
ota:
|
||||||
@@ -113,6 +113,20 @@ sensor:
|
|||||||
((17.67*id(z7_temp).state)/(243.5+id(z7_temp).state))));
|
((17.67*id(z7_temp).state)/(243.5+id(z7_temp).state))));
|
||||||
unit_of_measurement: °C
|
unit_of_measurement: °C
|
||||||
icon: 'mdi:thermometer-alert'
|
icon: 'mdi:thermometer-alert'
|
||||||
|
- platform: wifi_signal
|
||||||
|
name: WiFi Signal
|
||||||
|
id: wifi_signal_db
|
||||||
|
update_interval: 60s
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: copy # Reports the WiFi signal strength in %
|
||||||
|
source_id: wifi_signal_db
|
||||||
|
name: "WiFi Signal Percent"
|
||||||
|
filters:
|
||||||
|
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
|
||||||
|
unit_of_measurement: "%"
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: uptime
|
||||||
|
name: Uptime
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ esphome:
|
|||||||
logger:
|
logger:
|
||||||
|
|
||||||
# Enable Home Assistant API
|
# Enable Home Assistant API
|
||||||
#api:
|
api:
|
||||||
|
|
||||||
ota:
|
ota:
|
||||||
password: !secret ota
|
password: !secret ota
|
||||||
@@ -48,9 +48,6 @@ mqtt:
|
|||||||
broker: mqtt.lan
|
broker: mqtt.lan
|
||||||
discovery: true
|
discovery: true
|
||||||
|
|
||||||
#dallas:
|
|
||||||
# - pin: D1
|
|
||||||
|
|
||||||
i2c:
|
i2c:
|
||||||
sda: D3
|
sda: D3
|
||||||
scl: D2
|
scl: D2
|
||||||
@@ -124,6 +121,20 @@ sensor:
|
|||||||
name: "Z1 HTU21 Hum"
|
name: "Z1 HTU21 Hum"
|
||||||
accuracy_decimals: 1
|
accuracy_decimals: 1
|
||||||
update_interval: 60s
|
update_interval: 60s
|
||||||
|
- platform: wifi_signal
|
||||||
|
name: WiFi Signal
|
||||||
|
id: wifi_signal_db
|
||||||
|
update_interval: 60s
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: copy # Reports the WiFi signal strength in %
|
||||||
|
source_id: wifi_signal_db
|
||||||
|
name: "WiFi Signal Percent"
|
||||||
|
filters:
|
||||||
|
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
|
||||||
|
unit_of_measurement: "%"
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: uptime
|
||||||
|
name: Uptime
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,256 @@
|
|||||||
|
# https://github.com/esphome/esphome/pull/4434
|
||||||
|
|
||||||
|
substitutions:
|
||||||
|
pretty: MW22
|
||||||
|
RXPIN: GPIO1
|
||||||
|
TXPIN: GPIO3
|
||||||
|
out_pin: GPIO16
|
||||||
|
|
||||||
|
esphome:
|
||||||
|
name: mw22
|
||||||
|
comment: LD2410C
|
||||||
|
friendly_name: MW22
|
||||||
|
|
||||||
|
esp32:
|
||||||
|
board: mhetesp32minikit
|
||||||
|
framework:
|
||||||
|
type: arduino
|
||||||
|
|
||||||
|
mqtt:
|
||||||
|
broker: 192.168.10.102
|
||||||
|
|
||||||
|
ota:
|
||||||
|
password: !secret ota
|
||||||
|
|
||||||
|
wifi:
|
||||||
|
ssid: !secret wifi_ssid
|
||||||
|
password: !secret wifi_password
|
||||||
|
|
||||||
|
ap:
|
||||||
|
ssid: !secret ap_ssid
|
||||||
|
password: !secret ap_password
|
||||||
|
|
||||||
|
web_server:
|
||||||
|
port: 80
|
||||||
|
|
||||||
|
api:
|
||||||
|
reboot_timeout: 0s
|
||||||
|
services:
|
||||||
|
- service: set_ld2410_bluetooth_password
|
||||||
|
variables:
|
||||||
|
password: string
|
||||||
|
then:
|
||||||
|
- bluetooth_password.set:
|
||||||
|
id: ld2410_comp
|
||||||
|
password: !lambda 'return password;'
|
||||||
|
|
||||||
|
uart:
|
||||||
|
id: ld2410_uart
|
||||||
|
tx_pin: ${TXPIN}
|
||||||
|
rx_pin: ${RXPIN}
|
||||||
|
baud_rate: 115200 #256000
|
||||||
|
parity: NONE
|
||||||
|
stop_bits: 1
|
||||||
|
|
||||||
|
ld2410:
|
||||||
|
uart_id: ld2410_uart
|
||||||
|
throttle: 1500ms
|
||||||
|
id: ld2410_comp
|
||||||
|
|
||||||
|
select:
|
||||||
|
- platform: ld2410
|
||||||
|
distance_resolution:
|
||||||
|
name: distance resolution
|
||||||
|
baud_rate:
|
||||||
|
name: baud rate
|
||||||
|
light_function:
|
||||||
|
name: light function
|
||||||
|
out_pin_level:
|
||||||
|
name: out pin level
|
||||||
|
|
||||||
|
button:
|
||||||
|
- platform: ld2410
|
||||||
|
factory_reset:
|
||||||
|
name: "factory reset"
|
||||||
|
restart:
|
||||||
|
name: "restart"
|
||||||
|
query_params:
|
||||||
|
name: query params
|
||||||
|
|
||||||
|
number:
|
||||||
|
- platform: ld2410
|
||||||
|
timeout:
|
||||||
|
name: timeout
|
||||||
|
max_move_distance_gate:
|
||||||
|
name: max move distance gate
|
||||||
|
max_still_distance_gate:
|
||||||
|
name: max still distance gate
|
||||||
|
g0:
|
||||||
|
move_threshold:
|
||||||
|
name: g0 move threshold
|
||||||
|
still_threshold:
|
||||||
|
name: g0 still threshold
|
||||||
|
g1:
|
||||||
|
move_threshold:
|
||||||
|
name: g1 move threshold
|
||||||
|
still_threshold:
|
||||||
|
name: g1 still threshold
|
||||||
|
g2:
|
||||||
|
move_threshold:
|
||||||
|
name: g2 move threshold
|
||||||
|
still_threshold:
|
||||||
|
name: g2 still threshold
|
||||||
|
g3:
|
||||||
|
move_threshold:
|
||||||
|
name: g3 move threshold
|
||||||
|
still_threshold:
|
||||||
|
name: g3 still threshold
|
||||||
|
g4:
|
||||||
|
move_threshold:
|
||||||
|
name: g4 move threshold
|
||||||
|
still_threshold:
|
||||||
|
name: g4 still threshold
|
||||||
|
g5:
|
||||||
|
move_threshold:
|
||||||
|
name: g5 move threshold
|
||||||
|
still_threshold:
|
||||||
|
name: g5 still threshold
|
||||||
|
g6:
|
||||||
|
move_threshold:
|
||||||
|
name: g6 move threshold
|
||||||
|
still_threshold:
|
||||||
|
name: g6 still threshold
|
||||||
|
g7:
|
||||||
|
move_threshold:
|
||||||
|
name: g7 move threshold
|
||||||
|
still_threshold:
|
||||||
|
name: g7 still threshold
|
||||||
|
g8:
|
||||||
|
move_threshold:
|
||||||
|
name: g8 move threshold
|
||||||
|
still_threshold:
|
||||||
|
name: g8 still threshold
|
||||||
|
light_threshold:
|
||||||
|
name: light threshold
|
||||||
|
|
||||||
|
text_sensor:
|
||||||
|
- platform: ld2410
|
||||||
|
version:
|
||||||
|
name: "presenece sensor version"
|
||||||
|
mac_address:
|
||||||
|
name: "presenece sensor mac address"
|
||||||
|
|
||||||
|
switch:
|
||||||
|
- platform: ld2410
|
||||||
|
engineering_mode:
|
||||||
|
name: "engineering mode"
|
||||||
|
bluetooth:
|
||||||
|
name: control Bluetooth
|
||||||
|
|
||||||
|
binary_sensor:
|
||||||
|
- platform: ld2410
|
||||||
|
has_target:
|
||||||
|
name: "presence"
|
||||||
|
has_moving_target:
|
||||||
|
name: "movement"
|
||||||
|
has_still_target:
|
||||||
|
name: "still"
|
||||||
|
out_pin_presence_status:
|
||||||
|
name: out pin presence status
|
||||||
|
- platform: gpio
|
||||||
|
pin: ${out_pin}
|
||||||
|
name: ${pretty} Presence2
|
||||||
|
device_class: presence
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: ld2410
|
||||||
|
moving_distance:
|
||||||
|
name: "Moving distance"
|
||||||
|
still_distance:
|
||||||
|
name: "Still Distance"
|
||||||
|
moving_energy:
|
||||||
|
name: "Move Energy"
|
||||||
|
still_energy:
|
||||||
|
name: "Still Energy"
|
||||||
|
detection_distance:
|
||||||
|
name: "Distance Detection"
|
||||||
|
g0:
|
||||||
|
move_energy:
|
||||||
|
name: g0 move energy
|
||||||
|
still_energy:
|
||||||
|
name: g0 still energy
|
||||||
|
g1:
|
||||||
|
move_energy:
|
||||||
|
name: g1 move energy
|
||||||
|
still_energy:
|
||||||
|
name: g1 still energy
|
||||||
|
g2:
|
||||||
|
move_energy:
|
||||||
|
name: g2 move energy
|
||||||
|
still_energy:
|
||||||
|
name: g2 still energy
|
||||||
|
g3:
|
||||||
|
move_energy:
|
||||||
|
name: g3 move energy
|
||||||
|
still_energy:
|
||||||
|
name: g3 still energy
|
||||||
|
g4:
|
||||||
|
move_energy:
|
||||||
|
name: g4 move energy
|
||||||
|
still_energy:
|
||||||
|
name: g4 still energy
|
||||||
|
g5:
|
||||||
|
move_energy:
|
||||||
|
name: g5 move energy
|
||||||
|
still_energy:
|
||||||
|
name: g5 still energy
|
||||||
|
g6:
|
||||||
|
move_energy:
|
||||||
|
name: g6 move energy
|
||||||
|
still_energy:
|
||||||
|
name: g6 still energy
|
||||||
|
g7:
|
||||||
|
move_energy:
|
||||||
|
name: g7 move energy
|
||||||
|
still_energy:
|
||||||
|
name: g7 still energy
|
||||||
|
g8:
|
||||||
|
move_energy:
|
||||||
|
name: g8 move energy
|
||||||
|
still_energy:
|
||||||
|
name: g8 still energy
|
||||||
|
light:
|
||||||
|
name: light
|
||||||
|
|
||||||
|
- platform: wifi_signal
|
||||||
|
name: WiFi Signal
|
||||||
|
id: wifi_signal_db
|
||||||
|
update_interval: 60s
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: copy # Reports the WiFi signal strength in %
|
||||||
|
source_id: wifi_signal_db
|
||||||
|
name: "WiFi Signal Percent"
|
||||||
|
filters:
|
||||||
|
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
|
||||||
|
unit_of_measurement: "%"
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: uptime
|
||||||
|
name: Uptime
|
||||||
|
- platform: template
|
||||||
|
id: sys_esp_temperature
|
||||||
|
name: ESP Temperature
|
||||||
|
lambda: return temperatureRead();
|
||||||
|
unit_of_measurement: °C
|
||||||
|
device_class: TEMPERATURE
|
||||||
|
update_interval: 45s
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: template
|
||||||
|
id: esp_memory
|
||||||
|
icon: mdi:memory
|
||||||
|
name: ESP Free Memory
|
||||||
|
lambda: return heap_caps_get_free_size(MALLOC_CAP_INTERNAL) / 1024;
|
||||||
|
unit_of_measurement: 'kB'
|
||||||
|
state_class: measurement
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
update_interval: 60s
|
||||||
|
|
||||||
@@ -0,0 +1,280 @@
|
|||||||
|
#include "esphome.h"
|
||||||
|
|
||||||
|
#define CHECK_BIT(var, pos) (((var) >> (pos)) & 1)
|
||||||
|
|
||||||
|
class LD2410 : public PollingComponent, public UARTDevice
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LD2410(UARTComponent *parent) : UARTDevice(parent) {}
|
||||||
|
|
||||||
|
BinarySensor *hasTarget = new BinarySensor();
|
||||||
|
BinarySensor *hasMovingTarget = new BinarySensor();
|
||||||
|
BinarySensor *hasStillTarget = new BinarySensor();
|
||||||
|
BinarySensor *lastCommandSuccess = new BinarySensor();
|
||||||
|
Sensor *movingTargetDistance = new Sensor();
|
||||||
|
Sensor *movingTargetEnergy = new Sensor();
|
||||||
|
Sensor *stillTargetDistance = new Sensor();
|
||||||
|
Sensor *stillTargetEnergy = new Sensor();
|
||||||
|
Sensor *detectDistance = new Sensor();
|
||||||
|
|
||||||
|
Number *maxMovingDistanceRange;
|
||||||
|
Number *maxStillDistanceRange;
|
||||||
|
int movingSensitivities[9] = {0};
|
||||||
|
int stillSensitivities[9] = {0};
|
||||||
|
Number *noneDuration;
|
||||||
|
|
||||||
|
long lastPeriodicMillis = millis();
|
||||||
|
|
||||||
|
void setNumbers(Number *maxMovingDistanceRange_, Number *maxStillDistanceRange_, Number *noneDuration_){
|
||||||
|
maxMovingDistanceRange = maxMovingDistanceRange_;
|
||||||
|
maxStillDistanceRange = maxStillDistanceRange_;
|
||||||
|
noneDuration = noneDuration_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sendCommand(char *commandStr, char *commandValue, int commandValueLen)
|
||||||
|
{
|
||||||
|
lastCommandSuccess->publish_state(false);
|
||||||
|
// frame start bytes
|
||||||
|
write_byte(0xFD);
|
||||||
|
write_byte(0xFC);
|
||||||
|
write_byte(0xFB);
|
||||||
|
write_byte(0xFA);
|
||||||
|
// length bytes
|
||||||
|
int len = 2;
|
||||||
|
if (commandValue != nullptr)
|
||||||
|
len += commandValueLen;
|
||||||
|
write_byte(lowByte(len));
|
||||||
|
write_byte(highByte(len));
|
||||||
|
// command string bytes
|
||||||
|
write_byte(commandStr[0]);
|
||||||
|
write_byte(commandStr[1]);
|
||||||
|
// command value bytes
|
||||||
|
if (commandValue != nullptr)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < commandValueLen; i++)
|
||||||
|
{
|
||||||
|
write_byte(commandValue[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// frame end bytes
|
||||||
|
write_byte(0x04);
|
||||||
|
write_byte(0x03);
|
||||||
|
write_byte(0x02);
|
||||||
|
write_byte(0x01);
|
||||||
|
delay(50);
|
||||||
|
}
|
||||||
|
|
||||||
|
int twoByteToInt(char firstByte, char secondByte)
|
||||||
|
{
|
||||||
|
return (int16_t)(secondByte << 8) + firstByte;
|
||||||
|
}
|
||||||
|
|
||||||
|
void handlePeriodicData(char *buffer, int len)
|
||||||
|
{
|
||||||
|
if (len < 12)
|
||||||
|
return; // 4 frame start bytes + 2 length bytes + 1 data end byte + 1 crc byte + 4 frame end bytes
|
||||||
|
if (buffer[0] != 0xF4 || buffer[1] != 0xF3 || buffer[2] != 0xF2 || buffer[3] != 0xF1)
|
||||||
|
return; // check 4 frame start bytes
|
||||||
|
if (buffer[7] != 0xAA || buffer[len - 6] != 0x55 || buffer[len - 5] != 0x00)
|
||||||
|
return; // data head=0xAA, data end=0x55, crc=0x00
|
||||||
|
/*
|
||||||
|
Data Type: 6th byte
|
||||||
|
0x01: Engineering mode
|
||||||
|
0x02: Normal mode
|
||||||
|
*/
|
||||||
|
char dataType = buffer[5];
|
||||||
|
/*
|
||||||
|
Target states: 9th byte
|
||||||
|
0x00 = No target
|
||||||
|
0x01 = Moving targets
|
||||||
|
0x02 = Still targets
|
||||||
|
0x03 = Moving+Still targets
|
||||||
|
*/
|
||||||
|
char stateByte = buffer[8];
|
||||||
|
hasTarget->publish_state(stateByte != 0x00);
|
||||||
|
/*
|
||||||
|
Reduce data update rate to prevent home assistant database size glow fast
|
||||||
|
*/
|
||||||
|
long currentMillis = millis();
|
||||||
|
if (currentMillis - lastPeriodicMillis < 1000)
|
||||||
|
return;
|
||||||
|
lastPeriodicMillis = currentMillis;
|
||||||
|
|
||||||
|
hasMovingTarget->publish_state(CHECK_BIT(stateByte, 0));
|
||||||
|
hasStillTarget->publish_state(CHECK_BIT(stateByte, 1));
|
||||||
|
|
||||||
|
/*
|
||||||
|
Moving target distance: 10~11th bytes
|
||||||
|
Moving target energy: 12th byte
|
||||||
|
Still target distance: 13~14th bytes
|
||||||
|
Still target energy: 15th byte
|
||||||
|
Detect distance: 16~17th bytes
|
||||||
|
*/
|
||||||
|
int newMovingTargetDistance = twoByteToInt(buffer[9], buffer[10]);
|
||||||
|
if (movingTargetDistance->get_state() != newMovingTargetDistance)
|
||||||
|
movingTargetDistance->publish_state(newMovingTargetDistance);
|
||||||
|
int newMovingTargetEnergy = buffer[11];
|
||||||
|
if (movingTargetEnergy->get_state() != newMovingTargetEnergy)
|
||||||
|
movingTargetEnergy->publish_state(newMovingTargetEnergy);
|
||||||
|
int newStillTargetDistance = twoByteToInt(buffer[12], buffer[13]);
|
||||||
|
if (stillTargetDistance->get_state() != newStillTargetDistance)
|
||||||
|
stillTargetDistance->publish_state(newStillTargetDistance);
|
||||||
|
int newStillTargetEnergy = buffer[14];
|
||||||
|
if (stillTargetEnergy->get_state() != newStillTargetEnergy)
|
||||||
|
stillTargetEnergy->publish_state(buffer[14]);
|
||||||
|
int newDetectDistance = twoByteToInt(buffer[15], buffer[16]);
|
||||||
|
if (detectDistance->get_state() != newDetectDistance)
|
||||||
|
detectDistance->publish_state(newDetectDistance);
|
||||||
|
if (dataType == 0x01)
|
||||||
|
{ // engineering mode
|
||||||
|
// todo: support engineering mode data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleACKData(char *buffer, int len)
|
||||||
|
{
|
||||||
|
if (len < 10)
|
||||||
|
return;
|
||||||
|
if (buffer[0] != 0xFD || buffer[1] != 0xFC || buffer[2] != 0xFB || buffer[3] != 0xFA)
|
||||||
|
return; // check 4 frame start bytes
|
||||||
|
if (buffer[7] != 0x01)
|
||||||
|
return;
|
||||||
|
if (twoByteToInt(buffer[8], buffer[9]) != 0x00)
|
||||||
|
{
|
||||||
|
lastCommandSuccess->publish_state(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lastCommandSuccess->publish_state(true);
|
||||||
|
switch (buffer[6])
|
||||||
|
{
|
||||||
|
case 0x61: // Query parameters response
|
||||||
|
{
|
||||||
|
if (buffer[10] != 0xAA)
|
||||||
|
return; // value head=0xAA
|
||||||
|
/*
|
||||||
|
Moving distance range: 13th byte
|
||||||
|
Still distance range: 14th byte
|
||||||
|
*/
|
||||||
|
maxMovingDistanceRange->publish_state(buffer[12]);
|
||||||
|
maxStillDistanceRange->publish_state(buffer[13]);
|
||||||
|
/*
|
||||||
|
Moving Sensitivities: 15~23th bytes
|
||||||
|
Still Sensitivities: 24~32th bytes
|
||||||
|
*/
|
||||||
|
for (int i = 0; i < 9; i++)
|
||||||
|
{
|
||||||
|
movingSensitivities[i] = buffer[14 + i];
|
||||||
|
}
|
||||||
|
for (int i = 0; i < 9; i++)
|
||||||
|
{
|
||||||
|
stillSensitivities[i] = buffer[23 + i];
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
None Duration: 33~34th bytes
|
||||||
|
*/
|
||||||
|
noneDuration->publish_state(twoByteToInt(buffer[32], buffer[33]));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void readline(int readch, char *buffer, int len)
|
||||||
|
{
|
||||||
|
static int pos = 0;
|
||||||
|
|
||||||
|
if (readch >= 0)
|
||||||
|
{
|
||||||
|
if (pos < len - 1)
|
||||||
|
{
|
||||||
|
buffer[pos++] = readch;
|
||||||
|
buffer[pos] = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pos = 0;
|
||||||
|
}
|
||||||
|
if (pos >= 4)
|
||||||
|
{
|
||||||
|
if (buffer[pos - 4] == 0xF8 && buffer[pos - 3] == 0xF7 && buffer[pos - 2] == 0xF6 && buffer[pos - 1] == 0xF5)
|
||||||
|
{
|
||||||
|
handlePeriodicData(buffer, pos);
|
||||||
|
pos = 0; // Reset position index ready for next time
|
||||||
|
}
|
||||||
|
else if (buffer[pos - 4] == 0x04 && buffer[pos - 3] == 0x03 && buffer[pos - 2] == 0x02 && buffer[pos - 1] == 0x01)
|
||||||
|
{
|
||||||
|
handleACKData(buffer, pos);
|
||||||
|
pos = 0; // Reset position index ready for next time
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setConfigMode(bool enable)
|
||||||
|
{
|
||||||
|
char cmd[2] = {enable ? 0xFF : 0xFE, 0x00};
|
||||||
|
char value[2] = {0x01, 0x00};
|
||||||
|
sendCommand(cmd, enable ? value : nullptr, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void queryParameters()
|
||||||
|
{
|
||||||
|
char cmd_query[2] = {0x61, 0x00};
|
||||||
|
sendCommand(cmd_query, nullptr, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() override
|
||||||
|
{
|
||||||
|
set_update_interval(15000);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() override
|
||||||
|
{
|
||||||
|
const int max_line_length = 80;
|
||||||
|
static char buffer[max_line_length];
|
||||||
|
while (available())
|
||||||
|
{
|
||||||
|
readline(read(), buffer, max_line_length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setEngineeringMode(bool enable)
|
||||||
|
{
|
||||||
|
char cmd[2] = {enable ? 0x62 : 0x63, 0x00};
|
||||||
|
sendCommand(cmd, nullptr, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setMaxDistancesAndNoneDuration(int maxMovingDistanceRange, int maxStillDistanceRange, int noneDuration)
|
||||||
|
{
|
||||||
|
char cmd[2] = {0x60, 0x00};
|
||||||
|
char value[18] = {0x00, 0x00, lowByte(maxMovingDistanceRange), highByte(maxMovingDistanceRange), 0x00, 0x00, 0x01, 0x00, lowByte(maxStillDistanceRange), highByte(maxStillDistanceRange), 0x00, 0x00, 0x02, 0x00, lowByte(noneDuration), highByte(noneDuration), 0x00, 0x00};
|
||||||
|
sendCommand(cmd, value, 18);
|
||||||
|
queryParameters();
|
||||||
|
}
|
||||||
|
|
||||||
|
void factoryReset()
|
||||||
|
{
|
||||||
|
char cmd[2] = {0xA2, 0x00};
|
||||||
|
sendCommand(cmd, nullptr, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void reboot()
|
||||||
|
{
|
||||||
|
char cmd[2] = {0xA3, 0x00};
|
||||||
|
sendCommand(cmd, nullptr, 0);
|
||||||
|
// not need to exit config mode because the ld2410 will reboot automatically
|
||||||
|
}
|
||||||
|
|
||||||
|
void setBaudrate(int index)
|
||||||
|
{
|
||||||
|
char cmd[2] = {0xA1, 0x00};
|
||||||
|
char value[2] = {index, 0x00};
|
||||||
|
sendCommand(cmd, value, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void update()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,191 @@
|
|||||||
|
# https://github.com/Chreece/LD2450-ESPHome.git
|
||||||
|
#
|
||||||
|
substitutions:
|
||||||
|
devicename: mw25
|
||||||
|
upper_devicename: "Hi-Link LD2450"
|
||||||
|
|
||||||
|
esphome:
|
||||||
|
name: ${devicename}
|
||||||
|
comment: ${upper_devicename}
|
||||||
|
includes:
|
||||||
|
- ld2450_uart.h
|
||||||
|
platformio_options:
|
||||||
|
board_build.flash_mode: dio
|
||||||
|
board_build.extra_flags:
|
||||||
|
- "-DARDUINO_USB_CDC_ON_BOOT=0"
|
||||||
|
|
||||||
|
esp32:
|
||||||
|
board: seeed_xiao_esp32c3
|
||||||
|
framework:
|
||||||
|
type: arduino
|
||||||
|
|
||||||
|
|
||||||
|
wifi:
|
||||||
|
ssid: !secret wifi_ssid
|
||||||
|
password: !secret wifi_password
|
||||||
|
# reboot_timeout: 0s
|
||||||
|
ap:
|
||||||
|
password: "admin1234"
|
||||||
|
ap_timeout: 30s
|
||||||
|
|
||||||
|
# Enable logging
|
||||||
|
logger:
|
||||||
|
baud_rate: 0
|
||||||
|
|
||||||
|
# Enable Home Assistant API
|
||||||
|
api:
|
||||||
|
|
||||||
|
ota:
|
||||||
|
password: !secret ota
|
||||||
|
|
||||||
|
web_server:
|
||||||
|
port: 80
|
||||||
|
|
||||||
|
mqtt:
|
||||||
|
broker: 192.168.10.102
|
||||||
|
|
||||||
|
uart:
|
||||||
|
id: uart_ld2450
|
||||||
|
tx_pin:
|
||||||
|
number: GPIO21
|
||||||
|
mode:
|
||||||
|
input: true
|
||||||
|
pullup: true
|
||||||
|
rx_pin:
|
||||||
|
number: GPIO20
|
||||||
|
mode:
|
||||||
|
input: true
|
||||||
|
pullup: true
|
||||||
|
baud_rate: 256000
|
||||||
|
parity: NONE
|
||||||
|
stop_bits: 1
|
||||||
|
# debug:
|
||||||
|
# direction: BOTH
|
||||||
|
# dummy_receiver: false
|
||||||
|
|
||||||
|
custom_component:
|
||||||
|
- lambda: |-
|
||||||
|
return {new LD2450(id(uart_ld2450))};
|
||||||
|
components:
|
||||||
|
- id: ld2450
|
||||||
|
|
||||||
|
binary_sensor:
|
||||||
|
- platform: template
|
||||||
|
name: "Presence Detected"
|
||||||
|
device_class: occupancy
|
||||||
|
lambda: |-
|
||||||
|
if (id(target1).state > 0
|
||||||
|
or id(target2).state > 0
|
||||||
|
or id(target3).state > 0) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: custom
|
||||||
|
lambda: |-
|
||||||
|
auto uart_component = static_cast<LD2450 *>(ld2450);
|
||||||
|
return {uart_component->target1Resolution, uart_component->target1Speed, uart_component->target1X, uart_component->target1Y,
|
||||||
|
uart_component->target2Resolution, uart_component->target2Speed, uart_component->target2X, uart_component->target2Y,
|
||||||
|
uart_component->target3Resolution, uart_component->target3Speed, uart_component->target3X, uart_component->target3Y,
|
||||||
|
};
|
||||||
|
sensors:
|
||||||
|
- name: "Target1 Resolution"
|
||||||
|
unit_of_measurement: "nm"
|
||||||
|
accuracy_decimals: 0
|
||||||
|
icon: mdi:artboard
|
||||||
|
id: target1
|
||||||
|
- name: "Target1 Speed"
|
||||||
|
unit_of_measurement: "cm/s"
|
||||||
|
accuracy_decimals: 0
|
||||||
|
icon: mdi:speedometer
|
||||||
|
- name: "Target1 X"
|
||||||
|
unit_of_measurement: "cm"
|
||||||
|
accuracy_decimals: 0
|
||||||
|
icon: mdi:map-marker-right
|
||||||
|
- name: "Target1 Y"
|
||||||
|
unit_of_measurement: "cm"
|
||||||
|
accuracy_decimals: 0
|
||||||
|
icon: mdi:map-marker-down
|
||||||
|
- name: "Target2 Resolution"
|
||||||
|
unit_of_measurement: "nm"
|
||||||
|
accuracy_decimals: 0
|
||||||
|
icon: mdi:artboard
|
||||||
|
id: target2
|
||||||
|
- name: "Target2 Speed"
|
||||||
|
unit_of_measurement: "cm/s"
|
||||||
|
accuracy_decimals: 0
|
||||||
|
icon: mdi:speedometer
|
||||||
|
- name: "Target2 X"
|
||||||
|
unit_of_measurement: "cm"
|
||||||
|
accuracy_decimals: 0
|
||||||
|
icon: mdi:map-marker-right
|
||||||
|
- name: "Target2 Y"
|
||||||
|
unit_of_measurement: "cm"
|
||||||
|
accuracy_decimals: 0
|
||||||
|
icon: mdi:map-marker-down
|
||||||
|
- name: "Target3 Resolution"
|
||||||
|
unit_of_measurement: "nm"
|
||||||
|
accuracy_decimals: 0
|
||||||
|
icon: mdi:artboard
|
||||||
|
id: target3
|
||||||
|
- name: "Target3 Speed"
|
||||||
|
unit_of_measurement: "cm/s"
|
||||||
|
accuracy_decimals: 0
|
||||||
|
icon: mdi:speedometer
|
||||||
|
- name: "Target3 X"
|
||||||
|
unit_of_measurement: "cm"
|
||||||
|
accuracy_decimals: 0
|
||||||
|
icon: mdi:map-marker-right
|
||||||
|
- name: "Target3 Y"
|
||||||
|
unit_of_measurement: "cm"
|
||||||
|
accuracy_decimals: 0
|
||||||
|
icon: mdi:map-marker-down
|
||||||
|
- platform: template
|
||||||
|
name: "Targets Detected"
|
||||||
|
update_interval: 1s
|
||||||
|
lambda: |-
|
||||||
|
int num = 0;
|
||||||
|
if (id(target1).state > 0) {
|
||||||
|
num += 1;
|
||||||
|
}
|
||||||
|
if (id(target2).state > 0) {
|
||||||
|
num += 1;
|
||||||
|
}
|
||||||
|
if (id(target3).state > 0) {
|
||||||
|
num += 1;
|
||||||
|
}
|
||||||
|
return num;
|
||||||
|
- platform: wifi_signal
|
||||||
|
name: WiFi Signal
|
||||||
|
id: wifi_signal_db
|
||||||
|
update_interval: 60s
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: copy # Reports the WiFi signal strength in %
|
||||||
|
source_id: wifi_signal_db
|
||||||
|
name: "WiFi Signal Percent"
|
||||||
|
filters:
|
||||||
|
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
|
||||||
|
unit_of_measurement: "%"
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: uptime
|
||||||
|
name: Uptime
|
||||||
|
- platform: template
|
||||||
|
id: sys_esp_temperature
|
||||||
|
name: MW25 ESP Temperature
|
||||||
|
lambda: return temperatureRead();
|
||||||
|
unit_of_measurement: °C
|
||||||
|
device_class: TEMPERATURE
|
||||||
|
update_interval: 45s
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: template
|
||||||
|
id: esp_memory
|
||||||
|
icon: mdi:memory
|
||||||
|
name: MW25 ESP Free Memory
|
||||||
|
lambda: return heap_caps_get_free_size(MALLOC_CAP_INTERNAL) / 1024;
|
||||||
|
unit_of_measurement: 'kB'
|
||||||
|
state_class: measurement
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
update_interval: 60s
|
||||||
|
|
||||||
@@ -68,6 +68,22 @@ sensor:
|
|||||||
name: Gas
|
name: Gas
|
||||||
# tarief 1 is dal tarief!!!
|
# tarief 1 is dal tarief!!!
|
||||||
|
|
||||||
|
- platform: wifi_signal
|
||||||
|
name: WiFi Signal
|
||||||
|
id: wifi_signal_db
|
||||||
|
update_interval: 60s
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: copy # Reports the WiFi signal strength in %
|
||||||
|
source_id: wifi_signal_db
|
||||||
|
name: "WiFi Signal Percent"
|
||||||
|
filters:
|
||||||
|
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
|
||||||
|
unit_of_measurement: "%"
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: uptime
|
||||||
|
name: Uptime
|
||||||
|
|
||||||
|
|
||||||
text_sensor:
|
text_sensor:
|
||||||
- platform: dsmr
|
- platform: dsmr
|
||||||
identification:
|
identification:
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ wifi:
|
|||||||
password: !secret wifi_password
|
password: !secret wifi_password
|
||||||
- ssid: !secret wifi_ssid2
|
- ssid: !secret wifi_ssid2
|
||||||
password: !secret wifi_password2
|
password: !secret wifi_password2
|
||||||
domain: .lan
|
|
||||||
|
|
||||||
|
|
||||||
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||||
|
|||||||
@@ -84,6 +84,20 @@ sensor:
|
|||||||
id: pwr2
|
id: pwr2
|
||||||
entity_id: sensor.power_usage
|
entity_id: sensor.power_usage
|
||||||
internal: true
|
internal: true
|
||||||
|
- platform: wifi_signal
|
||||||
|
name: WiFi Signal
|
||||||
|
id: wifi_signal_db
|
||||||
|
update_interval: 60s
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: copy # Reports the WiFi signal strength in %
|
||||||
|
source_id: wifi_signal_db
|
||||||
|
name: "WiFi Signal Percent"
|
||||||
|
filters:
|
||||||
|
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
|
||||||
|
unit_of_measurement: "%"
|
||||||
|
entity_category: "diagnostic"
|
||||||
|
- platform: uptime
|
||||||
|
name: Uptime
|
||||||
|
|
||||||
text_sensor:
|
text_sensor:
|
||||||
- platform: mqtt_subscribe
|
- platform: mqtt_subscribe
|
||||||
|
|||||||
Executable
+8
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#Bookworm
|
||||||
|
# Ubuntu
|
||||||
|
apt -y install xrdp tigervnc-standalone-server
|
||||||
|
systemctl enable xrdp
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
Bookworm
|
||||||
|
apt -y install xrdp tigervnc-standalone-server
|
||||||
|
systemctl enable xrdp
|
||||||
|
|
||||||
|
ubuntu
|
||||||
|
apt -y install xrdp tigervnc-standalone-server
|
||||||
|
systemctl enable xrdp
|
||||||
|
|
||||||
|
create new
|
||||||
|
~startwm.sh
|
||||||
|
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# GNOME
|
||||||
|
dbus-launch --exit-with-session /usr/bin/gnome-session
|
||||||
|
# GNOME Classic
|
||||||
|
# dbus-launch --exit-with-session /usr/bin/gnome-session-classic
|
||||||
|
# KDE
|
||||||
|
# dbus-launch --exit-with-session /usr/bin/startplasma-x11
|
||||||
|
# Cinnamon
|
||||||
|
# dbus-launch --exit-with-session /usr/bin/cinnamon-session
|
||||||
|
# MATE
|
||||||
|
# dbus-launch --exit-with-session /usr/bin/mate-session
|
||||||
|
# Xfce
|
||||||
|
# dbus-launch --exit-with-session /usr/bin/startxfce4
|
||||||
|
# LXDE
|
||||||
|
# dbus-launch --exit-with-session /usr/bin/startlxde
|
||||||
|
# LXQt
|
||||||
|
# dbus-launch --exit-with-session /usr/bin/startlxqt
|
||||||
|
# Budgie
|
||||||
|
# env GNOME_SHELL_SESSION_MODE=Budgie:GNOME dbus-launch --exit-with-session /usr/bin/budgie-desktop
|
||||||
|
|
||||||
|
chmod 755 ~/startwm.sh
|
||||||
|
|
||||||
|
|
||||||
Executable
+11
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
fallocate -l 2G /swap2file
|
||||||
|
chmod 600 /swap2file
|
||||||
|
mkswap /swap2file
|
||||||
|
swapon /swap2file
|
||||||
|
echo "/swap2file swap swap defaults 0 0" | tee -a /etc/fstab
|
||||||
|
|
||||||
|
mount -a
|
||||||
|
systemctl daemon-reload
|
||||||
|
|
||||||
Executable
+11
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
fallocate -l 4G /swap4file
|
||||||
|
chmod 600 /swap4file
|
||||||
|
mkswap /swap4file
|
||||||
|
swapon /swap4file
|
||||||
|
echo "/swap4file swap swap defaults 0 0" | tee -a /etc/fstab
|
||||||
|
|
||||||
|
mount -a
|
||||||
|
systemctl daemon-reload
|
||||||
|
|
||||||
Executable
+11
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
fallocate -l 8G /swap8file
|
||||||
|
chmod 600 /swap8file
|
||||||
|
mkswap /swap8file
|
||||||
|
swapon /swap8file
|
||||||
|
echo "/swap8file swap swap defaults 0 0" | tee -a /etc/fstab
|
||||||
|
|
||||||
|
mount -a
|
||||||
|
systemctl daemon-reload
|
||||||
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# maak plaatjes kleiner
|
||||||
|
# apt install webp -y
|
||||||
|
|
||||||
|
# Convert PNGs
|
||||||
|
find . -iname "*.png" -print0 | xargs -0 -n 1 -P 0 -I '{}' cwebp '{}' -short -q 90 -alpha_q 100 -m 6 -o '{}'.webp
|
||||||
|
|
||||||
|
# Convert JPGs
|
||||||
|
find . \( -iname "*.jpg" -o -iname "*.jpeg" \) -print0 | xargs -0 -n 1 -P 0 -I '{}' cwebp -short -q 80 '{}' -o '{}'.webp
|
||||||
|
|
||||||
Executable
+6
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
#
|
||||||
|
RETENTION=5
|
||||||
|
DIR=/srv/somedir/here
|
||||||
|
find $DIR/* -mtime +$RETENTION -delete
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# with perl
|
||||||
|
perl -pi -w -e s/apt/APT/g file.sh
|
||||||
|
perl -pi -w -e s/.jpg/.jpg.webp/g file.sh
|
||||||
|
# with sed
|
||||||
|
|
||||||
|
sed -i 's/SEARCH_FOR/REPLACE_WITH/g' file.txt
|
||||||
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
sudo apt install flatpak gnome-software-plugin-flatpak -y
|
||||||
|
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
apt remove -y linux-image-amd64 'linux-image-5.19*'
|
||||||
Executable
+13
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
sysctl net.ipv4.ip_forward=1
|
||||||
|
IP4=192.168.200.0/244 # pas je iprange hier aan
|
||||||
|
IF=eth0 # uitgaande iface
|
||||||
|
|
||||||
|
iptables -t nat -A POSTROUTING -s ${IP4} -o ${IF} -j MASQUERADE
|
||||||
|
iptables -A FORWARD -s -s ${IP4} -o ${IF} -j ACCEPT
|
||||||
|
iptables -A FORWARD -d ${IP4} -m state \
|
||||||
|
--state ESTABLISHED,RELATED -i ${IF} -j ACCEPT
|
||||||
|
|
||||||
|
# zet in crontab
|
||||||
|
#@reboot bash /root/Route.sh # zonder eerste #
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
mount -o remount,rw /
|
||||||
|
mount -o remount,rw #mountpoint in /etc/fstab
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
systemctl reboot --firmware-setup
|
||||||
|
of
|
||||||
|
efibootmgr -n 0
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
# Please note that in debian 12 bookworm you will need to
|
||||||
|
# install rsyslogd with apt install rsyslog
|
||||||
|
mkdir -p /var/log/remote
|
||||||
|
chown syslog:adm /var/log/remote
|
||||||
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# add
|
||||||
|
# after adding
|
||||||
|
# systemctl restart rsyslog
|
||||||
|
# provides UDP syslog reception
|
||||||
|
module(load="imudp")
|
||||||
|
input(type="imudp" port="514")
|
||||||
|
|
||||||
|
# provides TCP syslog reception
|
||||||
|
module(load="imtcp")
|
||||||
|
input(type="imtcp" port="514")
|
||||||
|
|
||||||
|
$template RemoteLogs,"/var/log/remote/%HOSTNAME%/%PROGRAMNAME%.log"
|
||||||
|
*.* ?RemoteLogs
|
||||||
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# in /etc/rsyslog.conf
|
||||||
|
# add in the sending rsyslogd
|
||||||
|
# use @@ or @ not BOTH!
|
||||||
|
#
|
||||||
|
*.* @@192.168.100.2:514 # for tcp
|
||||||
|
#*.* @192.168.100.2:514 # for udp
|
||||||
|
# @@ = tcp
|
||||||
|
# @ = udp
|
||||||
|
# After adding
|
||||||
|
#
|
||||||
|
# systemctl restart rsyslog
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
touch .hushlogin
|
||||||
|
chmod -x /etc/update-motd.d/90-updates-available
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# on the prompt
|
||||||
|
# apt install curl -y
|
||||||
|
|
||||||
|
curl ifconfig.io
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
Add the following to the /etc/nginx/nginx.conf
|
||||||
|
to get the real ip adresses from the cloudflare tunnels directed to in your logging.
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
http {
|
||||||
|
|
||||||
|
set_real_ip_from 103.21.244.0/22;
|
||||||
|
set_real_ip_from 103.22.200.0/22;
|
||||||
|
set_real_ip_from 103.31.4.0/22;
|
||||||
|
set_real_ip_from 104.16.0.0/12;
|
||||||
|
set_real_ip_from 108.162.192.0/18;
|
||||||
|
set_real_ip_from 131.0.72.0/22;
|
||||||
|
set_real_ip_from 141.101.64.0/18;
|
||||||
|
set_real_ip_from 162.158.0.0/15;
|
||||||
|
set_real_ip_from 172.64.0.0/13;
|
||||||
|
set_real_ip_from 173.245.48.0/20;
|
||||||
|
set_real_ip_from 188.114.96.0/20;
|
||||||
|
set_real_ip_from 190.93.240.0/20;
|
||||||
|
set_real_ip_from 197.234.240.0/22;
|
||||||
|
set_real_ip_from 198.41.128.0/17;
|
||||||
|
set_real_ip_from 2400:cb00::/32;
|
||||||
|
set_real_ip_from 2606:4700::/32;
|
||||||
|
set_real_ip_from 2803:f800::/32;
|
||||||
|
set_real_ip_from 2405:b500::/32;
|
||||||
|
set_real_ip_from 2405:8100::/32;
|
||||||
|
set_real_ip_from 2c0f:f248::/32;
|
||||||
|
set_real_ip_from 2a06:98c0::/29;
|
||||||
|
set_real_ip_from 172.30.0.0/24; # the CF tunnel local ip's
|
||||||
|
set_real_ip_from 192.168.200.0/24; ;
|
||||||
|
real_ip_header CF-Connecting-IP;
|
||||||
|
# CF documentation and for any tunnel out ip add it here
|
||||||
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
Proxmox is een opensource virtual machine server
|
|
||||||
|
|
||||||
https://tteck.github.io/Proxmox/
|
|
||||||
|
|
||||||
Proxmox helper scripts
|
|
||||||
@@ -7,5 +7,5 @@ cd RTLSDR-Airband
|
|||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
# dit is op een PI4 platform aanpassen naar eigen pi etc
|
# dit is op een PI4 platform aanpassen naar eigen pi etc
|
||||||
cmake -DPLATFORM=armv8-generic -DSOAPYSDR=OFF -DNFM=ON ../
|
cmake -DNFM=ON ../
|
||||||
make install
|
make install
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 170 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 76 KiB |
@@ -13,6 +13,7 @@ api:
|
|||||||
|
|
||||||
ota:
|
ota:
|
||||||
password: !secret ota
|
password: !secret ota
|
||||||
|
platform: esphome
|
||||||
|
|
||||||
wifi:
|
wifi:
|
||||||
networks:
|
networks:
|
||||||
@@ -49,7 +50,7 @@ mqtt:
|
|||||||
discovery: true
|
discovery: true
|
||||||
|
|
||||||
dsmr:
|
dsmr:
|
||||||
id: dsmr_instance
|
id: dsmr_instance1
|
||||||
|
|
||||||
uart:
|
uart:
|
||||||
- rx_pin: RX
|
- rx_pin: RX
|
||||||
@@ -57,9 +58,9 @@ uart:
|
|||||||
|
|
||||||
sensor:
|
sensor:
|
||||||
- platform: dsmr
|
- platform: dsmr
|
||||||
energy_delivered_tariff1:
|
energy_delivered_tariff1: # Dit is het Dal tarief
|
||||||
name: Energy Tarief 1
|
name: Energy Tarief 1
|
||||||
energy_delivered_tariff2:
|
energy_delivered_tariff2: # Dit is het Normaal tarief
|
||||||
name: Energy Tarief 2
|
name: Energy Tarief 2
|
||||||
power_delivered:
|
power_delivered:
|
||||||
name: Power
|
name: Power
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "DPkg::Post-Invoke { \"dpkg -V proxmox-widget-toolkit | grep -q '/proxmoxlib\.js$'; if [ \$? -eq 1 ]; then { echo 'Removing subscription nag from UI...'; sed -i '/data.status/{s/\!//;s/active/NoMoreNagging/}' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js; }; fi\"; };" >/etc/apt/apt.conf.d/no-nag-script
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
Proxmox is een opensource virtual machine server
|
||||||
|
|
||||||
|
https://community-scripts.github.io/ProxmoxVE/scripts
|
||||||
|
|
||||||
|
Proxmox helper scripts
|
||||||
|
|
||||||
|
Automagic commandline expand of ext4 after resize (+ expand disk) with parted.sh
|
||||||
|
|
||||||
|
|
||||||
|
The script next-id.sh sets the ct or vm id to the date + 01 # 25010201
|
||||||
Executable
+5
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cp /etc/pve/datacenter.cfg /root/backup/
|
||||||
|
|
||||||
|
/usr/bin/sed -i "s/lower=".*"/lower=$(/usr/bin/date '+%y%m%d'01),upper=900000000/g" /etc/pve/datacenter.cfg
|
||||||
Executable
+12
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# First install parted
|
||||||
|
# After + rezise of the ext4 HD use this script
|
||||||
|
# Change the resizepart 1 or to the other part
|
||||||
|
# apt install parted
|
||||||
|
# parted -l for the current disk
|
||||||
|
PART=1 # 1 for debian12 (cloudimage) 3 for ubuntu (cloudimage)
|
||||||
|
parted /dev/sda resizepart ${PART} 100%
|
||||||
|
resize2fs /dev/sda1
|
||||||
|
parted -l
|
||||||
|
fstrim -av
|
||||||
|
|
||||||
Executable
+8
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#Bookworm
|
||||||
|
# Ubuntu
|
||||||
|
apt -y install xrdp tigervnc-standalone-server
|
||||||
|
systemctl enable xrdp
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
Bookworm
|
||||||
|
apt -y install xrdp tigervnc-standalone-server
|
||||||
|
systemctl enable xrdp
|
||||||
|
|
||||||
|
ubuntu
|
||||||
|
apt -y install xrdp tigervnc-standalone-server
|
||||||
|
systemctl enable xrdp
|
||||||
|
|
||||||
|
create new
|
||||||
|
~startwm.sh
|
||||||
|
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# GNOME
|
||||||
|
dbus-launch --exit-with-session /usr/bin/gnome-session
|
||||||
|
# GNOME Classic
|
||||||
|
# dbus-launch --exit-with-session /usr/bin/gnome-session-classic
|
||||||
|
# KDE
|
||||||
|
# dbus-launch --exit-with-session /usr/bin/startplasma-x11
|
||||||
|
# Cinnamon
|
||||||
|
# dbus-launch --exit-with-session /usr/bin/cinnamon-session
|
||||||
|
# MATE
|
||||||
|
# dbus-launch --exit-with-session /usr/bin/mate-session
|
||||||
|
# Xfce
|
||||||
|
# dbus-launch --exit-with-session /usr/bin/startxfce4
|
||||||
|
# LXDE
|
||||||
|
# dbus-launch --exit-with-session /usr/bin/startlxde
|
||||||
|
# LXQt
|
||||||
|
# dbus-launch --exit-with-session /usr/bin/startlxqt
|
||||||
|
# Budgie
|
||||||
|
# env GNOME_SHELL_SESSION_MODE=Budgie:GNOME dbus-launch --exit-with-session /usr/bin/budgie-desktop
|
||||||
|
|
||||||
|
chmod 755 ~/startwm.sh
|
||||||
|
|
||||||
|
|
||||||
Binary file not shown.
@@ -1,10 +0,0 @@
|
|||||||
https://c-nergy.be/blog/?p=18205
|
|
||||||
wget https://www.c-nergy.be/downloads/xRDP/xrdp-installer-1.4.3.zip
|
|
||||||
unzip xrdp-installer-1.4.3.zip
|
|
||||||
chmod +x ~/Downloads/xrdp-installer-1.4.3.sh
|
|
||||||
--help or -h => will display a basic help menu
|
|
||||||
--sound or -s => will enable sound redirection
|
|
||||||
--loginscreen or -l => will customize the xRDP login screen
|
|
||||||
--remove or -r => will remove the xrdp package
|
|
||||||
--custom or -c => will perform a custom installation (i.e. compiled from sources)
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user