Skip to content

Home Assistant Integration

Ezra edited this page Jan 12, 2020 · 4 revisions

Home Assistant Integration

Automatic

Check out the HA docs on how to set up discovery for MQTT here: https://www.home-assistant.io/docs/mqtt/discovery/

Use the env variable section to set up the MQTT client and connect to your MQTT broker. If auto discovery is enabled in home assistant the following will be created:

  • An entity for each of your servers
    • (sensor) Monitor server status
    • (switch) On/Off switch allows you to start stop array
  • An entity for each of your VMs
    • (switch) On/Off toggle VM state
    • (switch) A seperate entity with a switch to attach / detach any usbs to that vm
    • (sensor) Whether or not a particular usb device is connected to the machine (can be used to automate hotplugging e.g. when connected toggle the usb switch off and on again)
  • An entity for each of your dockers
    • (switch) On/Off toggle Docker state

You will end up having entities like these:

  • binary_sensor.unraid_server (Server info in attributes)
  • binary_sensor.unraid_vm_VMNAME_usb_USBDEVICE
  • sensor.unraid_vm_VMNAME_status (VM stats in attributes)
  • switch.unraid_array
  • switch.unraid_docker_DOCKERNAME (Docker info in attributes)
  • switch.unraid_vm_VMNAME (VM info in attributes)

Manual

Manual Config Example: The server and VM names are as they are in MQTT (spaces are underscores and all lower case) The payload options are started, stopped, paused, restart, kill, hibernate

- platform: mqtt

  command_topic: "homeassistant/servername/vmname/state"
  
  payload_on: "started"
 
  payload_off: "stopped"

When connecting the unraid api to an mqtt broker config details for all the various api functions are posted under the various homeassistant entity types. For example under homeassistant/switch/server/vm/config.