#!/usr/bin/with-contenv bash MQTT_BROKER="${MQTT_BROKER:-192.168.100}"; USERNAME="${USERNAME:-mosquitto}"; PASSWORD="${PASSWORD:-insecurebydefault}"; PROXMOX_NAME="${PROXMOX_NAME:-pve}"; TEMP=$(clear;sensors | sed -n 9p | sed 's/^[^=:]*[=:]//' | sed -r 's/\s+//g'); [[ ! -f /config/temp2mqtt ]] && touch /config/temp2mqtt; cat <> /config/temp2mqtt #!/bin/bash # ___ _ _ _ __ # / __|| |_ | |_ ___ | '_ \ ___ # \__ \| _|| \ / _ \| .__// -_) # |___/ \__||_||_|\___/|_| \___| MQTT_BROKER="${MQTT_BROKER:-192.168.100}"; USERNAME="${USERNAME:-mosquitto}"; PASSWORD="${PASSWORD:-insecurebydefault}"; PROXMOX_NAME="${PROXMOX_NAME:-pve}"; TEMP=$(clear;sensors | sed -n 9p | sed 's/^[^=:]*[=:]//' | sed -r 's/\s+//g'); mosquitto_pub -h "${MQTT_BROKER}" -u "${USERNAME}" -P "${PASSWORD}" -t proxmox/"${PROXMOX_NAME}"/cpu_temp -m "${TEMP}" EOF chown -R mosquitto:mosquitto /config/temp2mqtt; chmod +x /config/temp2mqtt;