Home Assistant

_images/homeassistlogo.png _images/demoDash.png

trigBoard can send to Home Assistant out of the box! If you’re already familiar with Home Assistant, then you already know how powerful this is and will be very happy to find that you can integrate the trigBoard in just a few steps. This takes the trigBoard to a new level, because now you can tie this in to alerts, automations, monitoring, etc… It’s also very easy to add sensors to the trigBoard and provide that additional data to your system.

Home Assistant Setup

First step is to make sure you have Home Assistant Installed (if you don’t already) - head over here and follow these steps: Home Assistant Installation

Note - I am running Home Assistant on a Raspberry Pi 3 64bit

Make sure you’re in advanced mode:


Take note of the IP address:


MQTT Mosquitto Broker Add-On

Supervisor>>Add-on Store


Search for “mqtt”


Go and install, then start:

_images/mqttInsatll.png _images/mqttstart.png

Then just for reference, here is my configuration tab and note the MQTT port we’re going to use:


Now go to Configuration>>Integrations>>Click Configure in the MQTT block>>Click Submit in the popup window


trigBoard Setup

Launch the configurator as you normally would when setting up the trigBoard - hold wake button until Blue LED is flashing. Can go here for reference on all parameters: Configurator Tool

Setup the WiFi network settings first and make sure you get a connection, then setup the messages:

The only requirement here for all of your messages is that they contain no spaces or commas, because we’re going to use these characters for parsing on the Home Assistant side. Also, I recommend setting the battery threshold low, so that it never sends the low battery alert. Reason is because the low battery alert message would be a second packet for you to parse out… when really, you don’t need this alert since you will already have the ability to use the battery voltage to generate alerts within the Home Assistant system. If you have a trigBoard that rarely wakes and reports its status, but still want battery monitoring, you could set the timer to check if the contact is still open/closed and just set those messages to the same as your normal open and close messages like this:


or could use STILL_OPEN/CLOSED and just setup automations to detect these - that works too!


MQTT Settings

1- Enable MQTT
2- Enable Security
3- Enter in same credentials you use to login to Home Assistant
4- Default port is fine at 1883
5- Server is the IP Address of your Home Assistant Server - see above on where you can find this
6- Important The topic is the identifier for this trigBoard and will be unique for this board. Choose something descriptive and take note of what you entered.

Home Assistant Yaml

We’ll be using the File Editor to make changes to the configuration.yaml file, so go an install/start that just as shown above for Mosquitto


I like to keep this in the sidebar for quick access:


Launch the file editor and make you are editing the configuration.yaml file:


Here is where we’re going to add the trigBoards (more advanced users may keep this config elsewhere)

Let’s start by adding a sensor subscribed to that same topic we had set in the trigBoard Configurator:

  - platform: mqtt
    state_topic: "frontdoor"
    name: "Front Door"
    icon: mdi:door

Which looks like this when you paste it in:


Save that:


Go to Configuration>>Server Controls>>Check Configuration


If all good, you can scroll down a bit and click “MANUALLY CONFIGURED MQTT ENTRIES”



Let’s make sure you see the trigBoard - Developer Tools>>**STATES** and look for your newly created entity:


If you look at its state while opening/closing the contact, you should see the normal trigBoard message.


Within the Developer Tools, go to the TEMPLATE tab:

Here we can experiment with parsing, first just to look at the raw message:


If we split by the space character:


Now we can select the part of the message we want:


And we can split again to get rid of that comma:


And we can the same thing to get the voltage and strip out the unit:


Final Config

With this knowledge, we can use a value_template in the YAML file to automatically pull this information out of the trigBoard message. We need to create two sensors for both status and voltage. Note that you can add a custom MDI Icon and give a unit:

  - platform: mqtt
    state_topic: "frontdoor"
    name: "Front Door"
    value_template: "{{ value.split(' ')[1].split(',')[0] }}"
    icon: mdi:door
  - platform: mqtt
    state_topic: "frontdoor"
    name: "Front Door Battery"
    value_template: "{{ value.split(',')[1].split('V')[0] }}"
    icon: mdi:battery
    unit_of_measurement: "V"

Which looks like this in the file:


Don’t forget to save and reload MQTT entries!

Now you’re all set - head over to Overview and click the 3 dots in the upper right to edit your dashboard. Go ahead an take control of the Lovelace UI, then create an Entity Card and you should be able to add in the trigBoard:


And now you have a trigBoard in your dashboard!


With these entities, you can go nuts with this! Create conditional cards to show custom text when these states change, automations to run actions based on events (even have your Alexa/Google speak!), or really anything you want from here!

Custom Sensors

Want to add a temperature sensor to the trigBoard? Maybe report status of something along with the message? This is very EASY

First step is to make sure you can compile/upload the Base Firmware

The key is to just concat the data onto the existing message - here is a snippet from a sensor I have that samples a GPIO pin:


You see how it’s just a comma separated value added to the end of the push message? That’s all you need, since this is super easy to then pull out from the value_template, like in this case I only needed battery voltage and this new value for state:

    state_topic: "trigSolarTester"
    name: "trigSolar Voltage"
    icon: mdi:car-battery
    unit_of_measurement: "V"
    value_template: "{{ value.split(',')[1].split('V')[0] }}"

  - platform: mqtt
    state_topic: "trigSolarTester"
    name: "trigSolar State"
    icon: mdi:solar-power
    unit_of_measurement: "V"
    value_template: "{{ value.split(',')[2] }}"

Or here’s another example adding a temperature value:


And same as before, this sensor is on a timer and wakes every minute to send data - I only care about voltage and this new temperature value:

  - platform: mqtt
    state_topic: "MCP9808_OUTSIDE"
    name: "Back Porch Temperature"
    icon: mdi:temperature-fahrenheit
    unit_of_measurement: "F"
    value_template: "{{ value.split(',')[2] }}"

  - platform: mqtt
    state_topic: "MCP9808_OUTSIDE"
    name: "Back Porch TempSensor Voltage"
    icon: mdi:car-battery
    unit_of_measurement: "V"
    value_template: "{{ value.split(',')[1].split('V')[0] }}"

Plotting with Grafana+InfluxDB

This takes plotting your data to the next level - just look at this dashboard I created:


Install InfluxDB

Same as before: Supervisor>>Add-on Store, then search for InfluxDB Go ahead and install/start that:


Once started, go into InfluxDB and click the InfluxDB Admin icon:


Create a new database and call it homeassistant


I changed my duration to 7d


Click on Users and create a new user called homeassistant and choose a password:


Don’t forget to change the permissions to ALL


While we’re in here, add a user for Grafana as well and also give ALL permissions:


Go back to Supervisor and select InfluxDB and click the Documentation tab - scroll down a bit to the Yaml snippet - COPY this:


Head back over to your file editor to modify your configuration.yaml file and paste this in there, but note that the database name, user, and password all match up with what we have created in the InfluxDB admin page:


Finally, give your Home Assistant a restart: Configuration>>Server Controls and click RESTART


Install Grafana

Supervisor>>Add-on Store, then search for Grafana Go ahead and install/start that:


Once started go into the Documentation tab - and COPY this URL:


Go to the configuration tab and make sure SSL is false:


Now open up Grafana and click the configuration icon and go into the Data Sources:


Add a data source:


Search for InfluxDB and select that:


That URL we copied can be pasted here now:


Enter in the homeassistant InfluxDB, then the user and password is the one we created for Grafana - Save & Test and you should see this:


Create a Dashboard

In Grafana, go and create a new dashboard, then add an empty panel:

_images/grafanacreateanewdash.png _images/grafanaaddpaneldash.png

Here we have a query where we can select anything we want to plot or even just display in text. I use it to create a beautiful looking dashboards.

If we wanted to pull in and plot the battery voltage from a trigBoard, we can run a query like this:


Then looks like this:


Then if you save this dashboard, you can share, then copy the link out:

_images/sharegrafanalink.png _images/copygrafanalink.png

In your Home Assistant Dashboard, you can now create a webpage card and paste that URL in:


Now you have Grafana plots in your Dashboard!

Note that you can modify that URL to include the time frame and I recommend enabling kiosk mode, so only the plot is shown - here’s an example:


See the kiosk label in there, the auto refresh time at 30sec, the time frame is now-24hr to give last 24hours

Here’s a query I needed for an ESPhome device to get its state: