/savant.mqtt

Savant MQTT Service - acts as a polling service that relays to and reads from MQTT

Primary LanguageGo

Savant MQTT Server

This server is designed to run on Savant's smart hosts and acts as an MQTT client and state polling service.

It's set up to work with Homeassistant's MQTT discovery, where it configures devices as Light Entities.

Setup

Necessary files for the service

  1. Get your lights registry from Savant by exporting loads (plist) and converting them with ./transform [load.plist] > [oldfile]
  2. Set up your MQTT broker in your environment
  3. Create a savantmqtt.conf file (see config for details on settings.

Configuring Savant

Because managing state needs offical softwares from Savant which I doesn't have, so I changed to use service request argument.

Required Workflows for Triggers

Steps:

  • View Services
  • Pick the service where you need lights to match state
  • Find the service request name of each zones, and pick the service name and the request name. E.g. Study-Lighting-Lighting_controller-1-SVC_ENV_LIGHTING-DimmerSet
  • Main action with DimmerSet on Lighting Controller Source

Triggers

You can generate the triggers with: ./converttrigger/transform > tmp.json

./converttrigger/transform [load.plist] > tmp.json
go run ./converttrigger/main.go tmp.json
# Import tmp.plist as into triggers - you have to do this in savant
# Clean up
rm tmp.json tmp.plist

Getting running

  1. Run the build command
  2. Copy the binary to the Savant host
  3. Copy the systemctl config (lib/savant-mqtt.service) to the savant host under /lib/systemd/system/savant-mqtt.service
  4. Run sudo systemctl daemon-reload
  5. Enable the service via sudo systemctl enable savant-mqtt
  6. Start the service via sudo systemctl start savant-mqtt

Shout-outs

Thanks to original version berfarah/savant.mqtt Thanks to this guide for making it easy to get up and running with MQTT in Go!