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 Settings → Add-ons → 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.
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.
mqtt: sensor: - name: "Temperature" state_topic: "funhouse/state" unit_of_measurement: '°F' value_template: "{{ value_json.temperature }}" - name: "Humidity" state_topic: "funhouse/state" unit_of_measurement: '%' value_template: "{{ value_json.humidity }}" - name: "Pressure" state_topic: "funhouse/state" unit_of_measurement: 'hPa' value_template: "{{ value_json.pressure }}"
From the Developer Tools menu, you can check that the configuration is valid and click on Restart to load the configuration changes you made. You can just click Quick reload to reload any 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 to automations.yaml similar to the following:
- id: button_sel alias: "Switch Shortcut" trigger: - platform: mqtt topic: funhouse/state payload: 'on' value_template: '{{ value_json.button_sel }}' action: - service: light.toggle data: {} target: entity_id: light.My_Light mode: single
You can also add automations by going to the Settings menu and choosing Automations & Scenes. The visual editor gives you less control so that you aren't able to enter a value_template
on the MQTT trigger. However, if you select the 3 dot menu, you can can choose Edit in YAML, which will allow you to enter this value.
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.
mqtt: light: - name: "FunHouse Light" schema: template 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.
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.
Page last edited March 08, 2024
Text editor powered by tinymce.