Skip to content

lm-sensors, nvidia-smi and maybe more to mqtt and home assistant

License

Notifications You must be signed in to change notification settings

romkey/sensors2mqtt

 
 

Repository files navigation

Docker Pulls   GitHub Actions Workflow Status

pushes lm-sensors and nvidia-smi to mqtt. Also creates home assistant sensors for these resources

docker-compose.yml:

version: "3.9"
services:
  sensors2mqtt:
    container_name: sensors2mqtt
    privileged: true
    restart: unless-stopped
    image: kevinpdavid/sensors2mqtt:main
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              capabilities:
                - gpu
    environment:
      - MQTT_URL=mqtt://mosquitto
      # - MQTT_TOPIC=sensors2mqtt #this is the default
      - INTERVAL=5000 # In milliseconds
      # - MQTT_USERNAME=homeassistant
      # - MQTT_PASSWORD=<your password here>

Run as a service?

Sure thing:

################################################################################
# A template for docker-compose based service
# Can be put somewhere like /etc/systemd/system/sensors2mqtt.service
# Then enabled/started with `systemctl enable` and `systemctl start `
################################################################################
[Unit]
Description=Docker Compose sensors2mqtt Service
Requires=docker.service
After=docker.service

[Service]
User=kevin
Type=oneshot
RemainAfterExit=yes
WorkingDirectory=/home/kevin/sensors2mqtt
ExecStart=/usr/bin/docker compose up -d
ExecStop=/usr/bin/docker compose down
TimeoutStartSec=0

[Install]
WantedBy=multi-user.target

About

lm-sensors, nvidia-smi and maybe more to mqtt and home assistant

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 87.7%
  • Dockerfile 6.8%
  • JavaScript 5.5%