duc2mqtt is a project designed to integrate with Home Assistant via MQTT, allowing you to publish sensors from Bastec Bas2 DUC to MQTT.
As the license states, this software is NOT endorsed by Bastec, nor is it supported by them in any way.
-
Copy the
duc2mqtt.service
file to the systemd directory.sudo cp duc2mqtt.service /etc/systemd/system/duc2mqtt.service
-
Reload the systemd daemon to acknowledge the new service file.
sudo systemctl daemon-reload
-
Enable the service to start at boot.
sudo systemctl enable duc2mqtt.service
-
Start the service.
sudo systemctl start duc2mqtt.service
-
Check the status to ensure it's running properly.
sudo systemctl status duc2mqtt.service
-
Ensure you have Docker Compose installed on your system.
sudo apt-get install docker-compose
-
Navigate to the directory containing the
docker-compose.yml
file. -
Start the services defined in the Docker Compose file.
docker-compose up -d
-
Verify the containers are running.
docker-compose ps
Unfortunately, I've been unable to make a repository, so the following is required. The instructions are for HassOS, but should apply to any docker-based home assistant installation
- Install an ssh-server on home assistant (I use the official addon Terminal & SSH)
- Use sftp to upload the files in the repository's addon directory into e.g. duc2mqtt. If you're not used to sftp, I recommend using filezilla. Caveat: SFTP is what you want, NOT FTPS
- The structure should look like /addon/duc2mqtt/Dockerfile /addon/duc2mqtt/config.json
- Restart the hassio
- Go into the plugin and press install. It will take a while as it will download and build the duc2mqtt software.
- Configure it
- Go SDK
- Docker (for containerized build)
-
Clone the repository if you haven't already.
git clone https://github.com/SourceForgery/duc2mqtt.git cd duc2mqtt
-
Build the Go project.
go build -o duc2mqtt ./src/main.go
-
You can now run the executable.
./duc2mqtt
-
Ensure Docker is installed on your system.
sudo apt-get install docker
-
Build the Docker image.
docker build -t duc2mqtt:latest .
-
Run the Docker container.
docker run -d --name duc2mqtt duc2mqtt:latest
mqtt:
url: tcp://user:[email protected]:1883
uniqueId: duccer
topicPrefix: homeassistant
duc:
url: http://foo:[email protected]
disallowedPrefixes:
- 1.dm.
- 1.al.
- 1.am.
{
"mqtt": {
"url": "tcp://user:[email protected]:1883",
"uniqueId": "duccer",
"topicPrefix": "homeassistant"
},
"duc": {
"url": "http://foo:[email protected]",
"disallowedPrefixes": [
"1.dm.",
"1.al.",
"1.am."
]
}
}
- mqtt
- url the url to the mqtt server (with auth). I use rabbitmq which is an amqp server which has a special caveat,
namely vhosts. vhosts are set by adding a path at the end, e.g.
tcp://user:[email protected]:1883/my_vhost
. If you have/
as vhost, you need to set it in the url with double slashes, e.g.....org:1883//
- topicPrefix optional. If not set, will default to "homeassistant". it's the first part of the mqtt topic published to, e.g. "homeassistant/sensor/id/status"
- uniqueId what the device will present itself as in the mqtt. Just use something that isn't used by something else.
- url the url to the mqtt server (with auth). I use rabbitmq which is an amqp server which has a special caveat,
namely vhosts. vhosts are set by adding a path at the end, e.g.
- duc
- url http url (with auth) used to connect to the Bas2 duc.
- disallowedPrefixes There are a lot of test properties in a freshly installed duc that are useless. Some others are not interesting for other reasons. This allows for blacklisting sensor pids.
go get github.com/SourceForgery/duc2mqtt/bastec
This is what's needed to communicate with the Bastec BAS2 DUCs. It encapsulates logging in and getting data.
go get github.com/SourceForgery/duc2mqtt/hassio
This is the MQTT Home Assistant integration. It's rather limited (as the sensors I have connected to the duc are few), but the sensor types etc. that are implemented do work flawlessly with home assistant including autodetection of device and auto-reconfigure if home assistant restarts.
This is mostly a scratch-my-itch project. That means issues and pull requests for bugs will be happily investigated or accepted, but maybe not in a timely fashion.
Feature issues and pull requests on the other hand are less likely to be accepted due to it likely introducing some bugs my environment doesn't check for. There's absolutely nothing stopping you from forking (least of all me), so don't let my lack of time/interest stop you from making great features. Don't be suprised if I grab a feature from your fork, should I see a use for it in my environment.
Apache 2.0 License