Skip to content

rkkoszewski/hassio-mqtt-server-telemetry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Server Telemetry Sensor for Home Assistant via MQTT

This is a telemetry service written in Go that publishes information about the server to a MQTT broker. This service has been designed to be used with a Home Assistant, for which all devices and sensors will show up automatically up when autodiscovery is enabled.

Installation:

  1. Install Go and Git on your system (If you haven't yet)

  2. Clone this repository

  3. In the root of the repository run: go build -ldflags="-s -w" main.go

  4. Mark the executable as executable (If you're on linux): chmod +x main

  5. Copy that executable wherever it fits best to you as also thec configuration.yaml file. (Recommended: /opt/server-telemetry/)

  6. Edit the configuration.yaml file to your linking.

  7. Run the binary and that's it. (By default the binary searches for configuration.yaml, a custom path to the configuration file can be set as first argument to the executable)

  8. (optional) create service to autostart the script at boot:

    1. sudo nano /etc/systemd/system/system-telemetry-sensor.service
    2. Copy the following content into the service file:

    [Unit] Description=Home Assistant System Telemetry Sensor service After=multi-user.target

    [Service] User=[user] Type=idle ExecStart=/opt/server-telemetry/telemetry-service /opt/server-telemetry/configuration.yaml

    [Install] WantedBy=multi-user.target

    1. Edit the path to your script path and configuration.yaml. Also make sure you replace [user] with the account from which this script will be run.
    2. sudo systemctl enable system-telemetry-sensor.service
    3. sudo systemctl start system-telemetry-sensor.service

To cross compile for AsusWRT

Tested on an Asus RT-AC68U. Before the compilation step set the following environment variables:

set GOOS=linux set GOARCH=arm set GOARM=5

Extra's

You can reduce the size of the binary by commenting out the drivers used in driver/driver.go. This might be improved in the future by using compiler flags.

To Do's

  • Automatic removal of disabled sensors is missing. (WORKAROUND: Removing the device from HASS and restarting the service)
  • Add support for AsusWRT device temperature measuring (cat /proc/dmu/temperature)
  • AsusWRT Device Tracking

Notes

The project was inspired by: https://github.com/Sennevds/system_sensors

About

Server Telemetry Sensor for Home Assistant via MQTT

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages