This guide assumes you already have a working and running Home Assistant server. If you don't, be sure to visit our Set up Home Assistant with a Raspberry Pi guide first.

Check Your Add-Ons

Start out by logging in and opening up your Home Assistant dashboard and checking that the File editor is installed. 

As part of the setup, you should have an add-on either called configurator or File editor with a wrench icon next to it. Go ahead and select it.

If you don't see it, it may not be installed. You can find it under Supervisor Add-on Store File editor and go through the installation procedure.

If you already have it, but it's just not showing up, be sure it is started and the option to show in the sidebar is selected.

Environment Data Setup

Next you'll want to open up the File Editor and add the Environment Data.

Click on the Folder Icon at the top and select configuration.yaml, then click on an area to the right of the file list to close it.

Add the following code to the bottom of the configuration file. Make sure the state_topic values match the MQTT_TOPIC value you used in the sensor code.

sensor Office_Temp:
- platform: mqtt
  name: "Temperature"
  state_topic: "funhouse/state"
  unit_of_measurement: '°F'
  value_template: "{{ value_json.temperature }}"
- platform: mqtt
  name: "Humidity"
  state_topic: "funhouse/state"
  unit_of_measurement: '%'
  value_template: "{{ value_json.humidity }}"
- platform: mqtt
  name: "Pressure"
  state_topic: "funhouse/state"
  unit_of_measurement: 'kPa'
  value_template: "{{ value_json.pressure }}"

Click the save button at the top.

If you have the Check Home Assistant configuration tool installed, now would be a good time to run it. It takes several minutes to run and you can check the log tab to see the results.

From the Configuration menu, choose Server Controls. Here you can check that the configuration is valid and click on Restart to load the configuration changes you made.

With the latest releases of Home Assistant, a LoveLace dashboard was added. If you haven't edited the Dashboard, it should automatically appear.

Otherwise, you may need to manually add a card to the dashboard.

Using the Peripherals for Automation

To create an automation event and use one of the peripherals to trigger an existing entity, is pretty easy. For instance, if you had a light named My_Light that you wanted to toggle when the Select button is pressed, you would add some code similar to the following:

automation button_sel:
  trigger:
    - platform: mqtt
      topic: "funhouse/state"
      payload: "on"
      value_template: "{{ value_json.button_sel }}"
  action:
    service: light.toggle
    entity_id: light.My_Light

This adds an Automation trigger that checks the button_sel JSON value in the funhouse/state MQTT topic for a value of on. When these conditions are met, the action is triggered.

In the action section, the light.toggle event is fired on the light.My_Light entity.

Be sure to Restart your Server as described in the Environment Data Setup section.

Once you have restarted, try pressing the Middle button on your FunHouse. It should toggle your light. You may need to hold it down for a second or so for it to activate.

Emulating an RGB Bulb

You can also emulate an RGB light with the FunHouse DotStar LEDs. You'll want to add the following code to your configuration. 

light FunHouse_light:
  - platform: mqtt
    schema: template
    name: "FunHouse Light"
    command_topic: "funhouse/light/set"
    state_topic: "funhouse/light/state"
    command_on_template: >
      {"state": "on"
      {%- if brightness is defined -%}
      , "brightness": {{ brightness }}
      {%- endif -%}
      {%- if red is defined and green is defined and blue is defined -%}
      , "color": [{{ red }}, {{ green }}, {{ blue }}]
      {%- endif -%}
      }
    command_off_template: '{"state": "off"}'
    state_template: "{{ value_json.state }}"
    brightness_template: '{{ value_json.brightness }}'
    red_template: '{{ value_json.color[0] }}'
    green_template: '{{ value_json.color[1] }}'
    blue_template: '{{ value_json.color[2] }}'

Once you have added that to your configuration, go ahead and restart the server. The FunHouse Light should appear under your lights.

Go ahead and click on the bulb icon and a Color and Brightness dialog should come up. Go ahead and change the values.

Changing these values should update the value on your FunHouse.

Troubleshooting

If you see the icons, but there is no data, it is easiest to start by checking the MQTT messages. We have a guide on how to use Desktop MQTT Client for Adafruit.io, which can be used for the Home Assistant MQTT server as well.

Go ahead and configure a username and password to match your MQTT server and connect. Under subscribe, you can subscribe to the # topic to get all messages.

If you are seeing messages from the sensor, you may want to double check your Home Assistant configuration.

If you don't see any messages, you will want to follow the debugging section on the Code the Sensor page.

This guide was first published on Apr 22, 2021. It was last updated on 2021-04-22 09:11:16 -0400.

This page (Home Assistant Configuration) was last updated on May 08, 2021.

Text editor powered by tinymce.