Compare commits

..

45 Commits

Author SHA1 Message Date
henk f046229313 2025-01-22 18:10:19 2025-01-22 18:10:19 +01:00
henk e4401e4a94 2025-01-03 19:36:19 2025-01-03 19:36:19 +01:00
henk 7b0c6a5f9e 2025-01-03 19:22:30 2025-01-03 19:22:30 +01:00
henk 341ffd2385 2025-01-03 15:09:32 2025-01-03 15:09:32 +01:00
henk fb5d102ca5 2025-01-03 14:53:57 2025-01-03 14:53:57 +01:00
henk b4c22b7f5b 2025-01-02 21:09:05 2025-01-02 21:09:05 +01:00
henk 8c76112230 2025-01-02 21:07:23 2025-01-02 21:07:23 +01:00
henk 4a6c9c5d2c 2025-01-02 21:03:29 2025-01-02 21:03:29 +01:00
henk 02375b1bbb 2025-01-02 20:59:59 2025-01-02 20:59:59 +01:00
henk 0684906bc0 2025-01-02 20:53:20 2025-01-02 20:53:20 +01:00
henk 5f2fbac8bd 2025-01-02 20:51:49 2025-01-02 20:51:49 +01:00
henk b09b940a32 2025-01-02 20:44:01 2025-01-02 20:44:01 +01:00
henk 8115ca3220 2025-01-02 20:41:47 2025-01-02 20:41:47 +01:00
henk de8048e727 2024-02-13 23:09:37 2024-02-13 23:09:37 +01:00
henk 44b0915d5e 2024-02-13 20:15:11 2024-02-13 20:15:11 +01:00
henk 0448715529 2023-08-21 16:49:46 2023-08-21 16:49:46 +02:00
henk 5b593735c5 2023-08-20 13:27:51 2023-08-20 13:27:51 +02:00
henk ec244c4387 2023-08-20 01:36:44 2023-08-20 01:36:44 +02:00
henk e9a33c69a7 2023-08-20 00:55:50 2023-08-20 00:55:50 +02:00
henk 7a397eb242 2023-08-17 19:19:28 2023-08-17 19:19:28 +02:00
henk 3823f24ed7 2023-08-17 19:00:19 2023-08-17 19:00:19 +02:00
henk 1fa53926ad 2023-08-17 18:56:22 2023-08-17 18:56:22 +02:00
henk 2716eb140f 2023-08-17 18:49:30 2023-08-17 18:49:30 +02:00
henk 03fe9c341b 2023-07-25 21:35:59 2023-07-25 21:35:59 +02:00
henk 70fcc5669f 2023-07-25 20:20:47 2023-07-25 20:20:47 +02:00
henk b08d6b0b63 2023-07-25 20:08:51 2023-07-25 20:08:51 +02:00
henk 92b9156c3e 2023-07-16 23:31:34 2023-07-16 23:31:34 +02:00
henk 22110a5cc8 2023-07-16 23:30:36 2023-07-16 23:30:36 +02:00
henk bbcd5bd21e 2023-07-16 23:27:55 2023-07-16 23:27:55 +02:00
henk 4d47ce1c42 2023-06-16 22:55:35 2023-06-16 22:55:35 +02:00
henk 0ca7d0be34 2023-06-03 23:38:27 2023-06-03 23:38:27 +02:00
henk 4ea21be42b 2023-05-24 20:32:21 2023-05-24 20:32:21 +02:00
henk 9eab138daf 2023-05-12 14:34:09 2023-05-12 14:34:09 +02:00
henk d9f79376ec 2023-05-09 15:18:09 2023-05-09 15:18:09 +02:00
henk 726848452a 2023-05-07 23:49:25 2023-05-07 23:49:25 +02:00
henk 6c6d2cb127 2023-04-26 15:04:31 2023-04-26 15:04:31 +02:00
henk 9e2c799f9d 2023-04-26 14:46:38 2023-04-26 14:46:38 +02:00
henk 7e4dedcafd 2023-04-26 14:38:55 2023-04-26 14:38:55 +02:00
henk e214e17be8 2023-04-23 18:58:35 2023-04-23 18:58:35 +02:00
henk be054407ae 2023-04-14 17:51:05 2023-04-14 17:51:05 +02:00
henk 9574d56569 2023-04-13 19:26:23 2023-04-13 19:26:23 +02:00
henk 83d85fc3fd 2023-01-10 15:47:02 2023-01-10 15:47:02 +01:00
henk 46e86338cc 2023-01-10 15:43:37 2023-01-10 15:43:37 +01:00
henk 46f792cb03 2022-12-23 18:03:40 2022-12-23 18:03:40 +01:00
henk 274bfdf4ee 2022-12-23 18:03:23 2022-12-23 18:03:23 +01:00
50 changed files with 1215 additions and 27 deletions
+3
View File
@@ -0,0 +1,3 @@
Volg de instructies van deze Github pagina.
https://github.com/aandrew-me/tgpt
-2
View File
@@ -1,5 +1,3 @@
LET OP deze website werkt allleen als je ipv6 hebt!
Copieren van deze repo is makkelijk.
+7
View File
@@ -9,3 +9,10 @@ Belangrijk is dat je docker-compose niet moet installeren dat is nu
docker compose ( ja met spatie zonder -)
Als die niet aanwezig is sudo apt install docker-compose-plugin -y
Goede docker compose website
https://docs.linuxserver.io/images/docker-mariadb/
+25
View File
@@ -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
+25
View File
@@ -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
+19
View File
@@ -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
+21
View File
@@ -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
+25
View File
@@ -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
+27
View File
@@ -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
+4
View File
@@ -1,3 +1,7 @@
This Gitea docker server with its own ip adress
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!!!
+15 -1
View File
@@ -9,7 +9,7 @@ esphome:
logger:
# Enable Home Assistant API
#api:
api:
ota:
@@ -113,6 +113,20 @@ sensor:
((17.67*id(z7_temp).state)/(243.5+id(z7_temp).state))));
unit_of_measurement: °C
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
+15 -4
View File
@@ -9,7 +9,7 @@ esphome:
logger:
# Enable Home Assistant API
#api:
api:
ota:
password: !secret ota
@@ -48,9 +48,6 @@ mqtt:
broker: mqtt.lan
discovery: true
#dallas:
# - pin: D1
i2c:
sda: D3
scl: D2
@@ -124,6 +121,20 @@ sensor:
name: "Z1 HTU21 Hum"
accuracy_decimals: 1
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
+256
View File
@@ -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
+280
View File
@@ -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
+16
View File
@@ -67,6 +67,22 @@ sensor:
gas_delivered:
name: Gas
# 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:
- platform: dsmr
-1
View File
@@ -19,7 +19,6 @@ wifi:
password: !secret wifi_password
- ssid: !secret wifi_ssid2
password: !secret wifi_password2
domain: .lan
# Enable fallback hotspot (captive portal) in case wifi connection fails
+14
View File
@@ -84,6 +84,20 @@ sensor:
id: pwr2
entity_id: sensor.power_usage
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:
- platform: mqtt_subscribe
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
#Bookworm
# Ubuntu
apt -y install xrdp tigervnc-standalone-server
systemctl enable xrdp
+35
View File
@@ -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
+11
View File
@@ -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
+11
View File
@@ -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
+11
View File
@@ -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
+10
View File
@@ -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
+6
View File
@@ -0,0 +1,6 @@
#!/bin/bash
#
#
RETENTION=5
DIR=/srv/somedir/here
find $DIR/* -mtime +$RETENTION -delete
+7
View File
@@ -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
+2
View File
@@ -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
+1
View File
@@ -0,0 +1 @@
apt remove -y linux-image-amd64 'linux-image-5.19*'
+13
View File
@@ -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 #
+2
View File
@@ -0,0 +1,2 @@
mount -o remount,rw /
mount -o remount,rw #mountpoint in /etc/fstab
+5
View File
@@ -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
+14
View File
@@ -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
+11
View File
@@ -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
+4
View File
@@ -0,0 +1,4 @@
touch .hushlogin
chmod -x /etc/update-motd.d/90-updates-available
+4
View File
@@ -0,0 +1,4 @@
# on the prompt
# apt install curl -y
curl ifconfig.io
+33
View File
@@ -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
-5
View File
@@ -1,5 +0,0 @@
Proxmox is een opensource virtual machine server
https://tteck.github.io/Proxmox/
Proxmox helper scripts
+1 -1
View File
@@ -7,5 +7,5 @@ cd RTLSDR-Airband
mkdir build
cd build
# dit is op een PI4 platform aanpassen naar eigen pi etc
cmake -DPLATFORM=armv8-generic -DSOAPYSDR=OFF -DNFM=ON ../
cmake -DNFM=ON ../
make install
Binary file not shown.

Before

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

+4 -3
View File
@@ -13,6 +13,7 @@ api:
ota:
password: !secret ota
platform: esphome
wifi:
networks:
@@ -49,7 +50,7 @@ mqtt:
discovery: true
dsmr:
id: dsmr_instance
id: dsmr_instance1
uart:
- rx_pin: RX
@@ -57,9 +58,9 @@ uart:
sensor:
- platform: dsmr
energy_delivered_tariff1:
energy_delivered_tariff1: # Dit is het Dal tarief
name: Energy Tarief 1
energy_delivered_tariff2:
energy_delivered_tariff2: # Dit is het Normaal tarief
name: Energy Tarief 2
power_delivered:
name: Power
+3
View File
@@ -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
+10
View File
@@ -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
+5
View File
@@ -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
+12
View File
@@ -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
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
#Bookworm
# Ubuntu
apt -y install xrdp tigervnc-standalone-server
systemctl enable xrdp
+35
View File
@@ -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.
-10
View File
@@ -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)