low space

On my server (with docker) i have sometime the space of the root directory to 0%

df -h
Filesystem                    Size  Used Avail Use% Mounted on
tmpfs                          86M   11M   75M  13% /run
/dev/sda2                      20G   20G     0 100% /
tmpfs                         476M     0  476M   0% /dev/shm
tmpfs                         5,0M     0  5,0M   0% /run/lock
192.212.40.6:/6-40-SystemSvg  227G   32G  184G  15% /SystemSvg
192.212.40.6:/9-VideoClub     1,8T  774G  967G  45% /VideoClub
tmpfs                         146M  8,0K  146M   1% /run/user/1000

docker clean non essential stuff

docker system prune -a
docker volume rm $(docker volume ls -qf dangling=true)
docker system prune --all --volumes --force

empty trash

rm -rf ~/.local/share/Trash/*

or

sudo apt install trash-cli
trash-empty

system clean sweep

sudo apt-get autoremove
sudo apt-get clean
sudo apt-get autoclean

find big stuff in file system

sudo du -h --max-depth=1 | sort -h
0       ./dev
0       ./proc
0       ./sys
4,0K    ./cdrom
4,0K    ./media
4,0K    ./mnt
4,0K    ./srv
4,0K    ./VideoClub
16K     ./lost+found
16K     ./opt
52K     ./root
60K     ./home
68K     ./tmp
1,3M    ./run
6,7M    ./etc
428M    ./boot
823M    ./SystemSvg
1,7G    ./snap
4,7G    ./var
9,9G    ./usr
20G     .

limit log in container

https://forums.docker.com/t/some-way-to-clean-up-identify-contents-of-var-lib-docker-overlay/30604/53

<service_name>
	logging:
		options:
			max-size: "10m"
			max-file: "5"

https://forums.docker.com/t/some-way-to-clean-up-identify-contents-of-var-lib-docker-overlay/30604/52

/etc/docker/daemon.json

{
  "log-opts": {
    "max-size": "10m",
    "max-file": "5"
  }
}

dont forget the “,” if they have allready param in daemon.json

Add Weather Station

source

https://github.com/maliciamrg/Bresser-Weather-Station

dns

dns record

edit 2025-03-22, the new IP is 192.212.30.10

xampp install

xamp server
sudo apt upgrade -y
sudo apt update -y
wget https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/8.2.4/xampp-linux-x64-8.2.4-0-installer.run
chmod a+x xampp-linux-x64-8.2.4-0-installer.run
sudo ./xampp-linux-x64-8.2.4-0-installer.run

auto start xampp server at ubuntu startup:

sudo nano /etc/systemd/system/xampp.service
[Unit]
Description=XAMPP

[Service]
ExecStart=/opt/lampp/lampp start
ExecStop=/opt/lampp/lampp stop
Type=forking

[Install]
WantedBy=multi-user.target
sudo systemctl enable xampp.service

scripting

sudo apt update
sudo apt install php-cli unzip -y
cd ~
curl -sS https://getcomposer.org/installer -o composer-setup.php
HASH=`curl -sS https://composer.github.io/installer.sig`
php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
cd /opt/lampp/htdocs
sudo mkdir weatherstation
cd weatherstation
composer require php-mqtt/client
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

require_once ('vendor/autoload.php');

use PhpMqtt\Client\Exceptions\ConnectingToBrokerFailedException;
use PhpMqtt\Client\Exceptions\DataTransferException;
use PhpMqtt\Client\Exceptions\UnexpectedAcknowledgementException;
use PhpMqtt\Client\ConnectionSettings;
use PhpMqtt\Client\MqttClient;

const MQTT_HOST = '192.212.30.105';
const MQTT_PORT = 1883;
const MQTT_CLIENT_ID = 'weather-data-publisher';
const MQTT_USER = 'mqttuser';
const MQTT_PASSWORD = 'mqttuser';
const TOPIC = 'pws/sensors/';

$myfile = fopen("last_SERVER_QUERY_STRING.txt", "w") or die("Unable to open file!");
fwrite($myfile, $_SERVER['QUERY_STRING']);
fclose($myfile);

$winddir = $_GET["winddir"];

$wspeed = $_GET["windspeedmph"];
$wgust = $_GET["windgustmph"];
$hum = $_GET["humidity"];
$dew = $_GET["dewptf"];
$temp = $_GET["tempf"];
$rainhour = $_GET["rainin"];
$rainday = $_GET["dailyrainin"];
$baro = $_GET["baromin"];

function RoundIt($ee){
  return round($ee, 2);
}
function toKM( $a) {
  return  RoundIt( floatval($a)*1.60934);
}
function toC( $a) {
  return RoundIt(  (floatval($a)-32) * (5/9) );
}
function toMM( $a) {
    return RoundIt( floatval($a)*25.4);
}
  
function toHPA( $a) {
  return RoundIt((floatval($a)*33.8639));
}

function wind_cardinal( $degree ) { 
  switch( $degree ) {
      case ( $degree >= 348.75 && $degree <= 360 ):
          $cardinal = "N";
      break;
      case ( $degree >= 0 && $degree <= 11.249 ):
          $cardinal = "N";
      break;
      case ( $degree >= 11.25 && $degree <= 33.749 ):
          $cardinal = "NNE";
      break;
      case ( $degree >= 33.75 && $degree <= 56.249 ):
          $cardinal = "NE";
      break;
      case ( $degree >= 56.25 && $degree <= 78.749 ):
          $cardinal = "ENE";
      break;
      case ( $degree >= 78.75 && $degree <= 101.249 ):
          $cardinal = "E";
      break;
      case ( $degree >= 101.25 && $degree <= 123.749 ):
          $cardinal = "ESE";
      break;
      case ( $degree >= 123.75 && $degree <= 146.249 ):
          $cardinal = "SE";
      break;
      case ( $degree >= 146.25 && $degree <= 168.749 ):
          $cardinal = "SSE";
      break;
      case ( $degree >= 168.75 && $degree <= 191.249 ):
          $cardinal = "S";
      break;
      case ( $degree >= 191.25 && $degree <= 213.749 ):
          $cardinal = "SSW";
      break;
      case ( $degree >= 213.75 && $degree <= 236.249 ):
          $cardinal = "SW";
      break;
      case ( $degree >= 236.25 && $degree <= 258.749 ):
          $cardinal = "WSW";
      break;
      case ( $degree >= 258.75 && $degree <= 281.249 ):
          $cardinal = "W";
      break;
      case ( $degree >= 281.25 && $degree <= 303.749 ):
          $cardinal = "WNW";
      break;
      case ( $degree >= 303.75 && $degree <= 326.249 ):
          $cardinal = "NW";
      break;
      case ( $degree >= 326.25 && $degree <= 348.749 ):
          $cardinal = "NNW";
      break;
      default:
          $cardinal = null;
  }
 return $cardinal;
}

// Send it to MQTT
$mqtt = new MqttClient(MQTT_HOST, MQTT_PORT, MQTT_CLIENT_ID);

$settings = (new ConnectionSettings)
    ->setUsername(MQTT_USER)
    ->setPassword(MQTT_PASSWORD);

$mqtt->connect($settings, true);

$mqtt->publish(TOPIC.'baromin', toHPA($_GET["baromin"]), 0);
$mqtt->publish(TOPIC .'temp', toC($_GET["tempf"]), 0);
$mqtt->publish(TOPIC .'dewpt', toC($_GET["dewptf"]), 0);
$mqtt->publish(TOPIC .'humidity', $_GET["humidity"], 0);
$mqtt->publish(TOPIC .'windspeedkph', toKM($_GET["windspeedmph"]), 0);
$mqtt->publish(TOPIC .'windgustkph', toKM($_GET["windgustmph"]), 0);

// Use this WindDir if you want wind direction in degrees
$mqtt->publish(TOPIC .'winddirection', $_GET["winddir"], 0);

$mqtt->publish(TOPIC .'rainmm', toMM($_GET["rainin"]), 0);
$mqtt->publish(TOPIC .'dailyrainmm', toMM($_GET["dailyrainin"]), 0);
$mqtt->publish(TOPIC .'indoortemp', toC($_GET["indoortempf"]), 0);
$mqtt->publish(TOPIC .'indoorhumidity', $_GET["indoorhumidity"], 0);

$mqtt->disconnect();

// POST TO WU
$xml = file_get_contents("http://pws-ingest-use1-01.sun.weather.com/weatherstation/updateweatherstation.php?".$_SERVER['QUERY_STRING']);

?>
success

test

http://192.212.30.10/weatherstation/updateweatherstation.php?ID=IANTON13&PASSWORD=nY2hD3eO&action=updateraww&realtime=1&rtfreq=5&dateutc=now&baromin=29.91&tempf=75.9&dewptf=60.4&humidity=59&windspeedmph=3.5&windgustmph=4.0&winddir=45&rainin=0.0&dailyrainin=0.0&indoortempf=81.1&indoorhumidity=53

WR840N v6 firmware openwrt

https://openwrt.org/toh/hwdata/tp-link/tp-link_tl-wr840n_v6

Firmware version:0.9.1 4.19 v0001.0 Build 220120 Rel.55489n
Hardware version:TL-WR840N v6 0000000

https://firmware-selector.openwrt.org/?version=19.07.4&target=ramips%2Fmt76x8&id=tl-wr840n-v4

https://github.com/IcedShake/openwrt-19.07-tl-wr840n-v6.x

Compiled file for OpenWrt V6

https://www.dropbox.com/s/fkaiy4rttwpwr6b/openwrt-ramips-mt76x8-tl-wr840n-v6-squashfs-sysupgrade.bin?dl=0

https://www.dropbox.com/s/tu27bcsantl0ezq/openwrt-ramips-mt76x8-tl-wr840n-v6-squashfs-tftp-recovery.bin?dl=0

smart shutter firmware

https://github.com/openshwprojects/OpenBK7231T_App

https://templates.blakadder.com/WF-CS01_EU.html

https://developer.tuya.com/en/docs/iot/wb3s-module-datasheet?id=K9dx20n6hz5n4

https://community.home-assistant.io/t/detailed-guide-on-how-to-flash-the-new-tuya-beken-chips-with-openbk7231t/437276

https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/commands.md

https://www.elektroda.com/rtvforum/viewtopic.php?p=20433363#20433363

//Channel 0 ==> opening 
//Channel 1 ==> stop 
//Channel 2 ==> closing 
//Channel 3 ==> Color Blue (night Mode) 
//Channel 4 ==> value_template (open / closed)


//blue led on
SetStartValue 3 1

// interlock relais
addChangeHandler Channel0 == 1 SetChannel 2 0
addChangeHandler Channel2 == 1 SetChannel 0 0

//cancel button
addChangeHandler Channel1 == 1 SetChannel 0 0
addChangeHandler Channel1 == 1 SetChannel 2 0

//toggle night led mode
addEventHandler OnHold 10 ToggleChannel 3

//auto cancel relais after delai 34s
addChangeHandler Channel0 == 1 addRepeatingEventID 34 1 910 backlog SetChannel 0 0;SetChannel 4 1;
addChangeHandler Channel2 == 1 addRepeatingEventID 34 1 912 backlog SetChannel 2 0;SetChannel 4 0;

//auto cancel cancel button after 5s
addChangeHandler Channel1 == 1 addRepeatingEventID 5 1 911 SetChannel 1 0

//auto cancel cancel relai
addChangeHandler Channel1 == 1 cancelRepeatingEvent 910
addChangeHandler Channel1 == 1 cancelRepeatingEvent 912

https://community.home-assistant.io/t/template-cover-for-garage-door/241763/26

      garden:
        unique_id: template_cov_gardene
        device_class: shutter
        friendly_name: "Cover Garden"
        open_cover:
          - service: switch.turn_on
            target:
              entity_id: switch.obk61c3f99d_0
        close_cover:
          - service: switch.turn_on
            target:
              entity_id: switch.obk61c3f99d_2
        stop_cover:
          service: switch.turn_on
          target:
            entity_id: switch.obk61c3f99d_1
        value_template: >-
          {% if is_state('switch.cover_garden_4', 'on') %}
            open
          {% else %}
            closed
          {% endif %}

Wall Thermostat firmware

https://tasmota.github.io/docs/devices/TYWE3S/

https://templates.blakadder.com/Moes_WHT-HY609.html

https://github.com/blakadder/templates/blob/master/_templates/Moes_WHT-HY609

https://tasmota.github.io/docs/TuyaMCU/#dpid

https://github.com/sillyfrog/Tasmota-Tuya-Helper

{"NAME":"WHT-HY609-GB-WH-MS","GPIO":[0,2304,0,2272,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":54,"CMND":"tuyamcu 11,1 | tuyamcu 71,3 | tuyamcu 72,2 | tuyamcu 63,4"}

https://blakadder.com/tuya-climate/

mqtt:
  climate:
    name: "MQTT Heater"
    unique_id: mqtt_heater_generic_thermostat
    modes: 
      - "heat"
      - "off"
    mode_command_topic: "cmnd/tasmota_6F492A/POWER1"
    mode_command_template: "{{'1' if value == 'heat' else '0'}}"
    mode_state_topic: "tele/tasmota_6F492A/STATE"
    mode_state_template: "{{'heat' if value_json.POWER == 'ON' else 'off'}}"
    current_temperature_topic: "tele/tasmota_6F492A/SENSOR"
    current_temperature_template: "{{value_json['TuyaSNS']['Temperature']}}"
    temperature_state_topic: "tele/tasmota_6F492A/SENSOR"
    temperature_state_template: "{{value_json['TuyaSNS']['TempSet']}}"
    min_temp: 18
    max_temp: 28
    precision: 0.5
    temperature_command_topic: "cmnd/tasmota_6F492A/TUYASEND2"
    temperature_command_template: "2,{{value*10|int}}"
    availability_topic: tele/tasmota_6F492A/LWT
    payload_available: Online
    payload_not_available: Offline