Home Assistant Split-Flap Display Controller (MQTT)
This project provides a smart logic for controlling an 8-character Split-Flap display (based on the hardware by Morgan Manly/Thom Koopman and firmware by Jordan Hoff (jhoff)) via Home Assistant. It solves the problem of long sentences by automatically grouping words into 8-character chunks and handling repeats and delays.
Features
- Smart Word Grouping: Automatically combines words if they fit into the 8-character limit (e.g., “HELLO” + " " + “YOU” = 9 chars → split / “HI” + " " + “YOU” = 6 chars → grouped).
- Dynamic Speed: Control the delay between flips via a slider.
- Auto-Repeat: Loop the entire message multiple times.
- Clean Exit: Automatically clears the display after the message finishes.
Setup
1. Requirements
This script is designed to work with the firmware of jhoff Split-Flap project.
Link: jhoff/splitflap on GitHub (firmware) and Thom Koopman/ Split Flap Display - Extended Charset 48 flaps on MakerWorld (hardware)
2. Create Helpers
Create these in Settings > Devices & Services > Helpers:
input_text.splitflap_test_input(The message)input_number.splitflap_delay(Pause between words, 1-10s)input_number.splitflap_repeat(Number of loops, 1-10)
3. The Script (scripts.yaml)
Note: Make sure to replace
text.sfdisplay_1_displaywith the actual Entity ID of your display’s text entity!
YAML
splitflap_display_sentence:
alias: "SplitFlap: Smart Grouping & Repeat"
sequence:
- repeat:
count: "{{ states('input_number.splitflap_repeat') | default(1) | int }}"
sequence:
- repeat:
for_each: >
{% set limit, ns = 8, namespace(groups=[], current_group="") %}
{% for word in states('input_text.splitflap_test_input').split(' ') %}
{% if ns.current_group == "" %}{% set ns.current_group = word %}
{% elif (ns.current_group ~ " " ~ word) | length <= limit %}{% set ns.current_group = ns.current_group ~ " " ~ word %}
{% else %}{% set ns.groups, ns.current_group = ns.groups + [ns.current_group], word %}{% endif %}
{% endfor %}
{{ (ns.groups + [ns.current_group]) if ns.current_group != "" else ns.groups }}
sequence:
- service: text.set_value
target:
# CHANGE THIS to your display entity:
entity_id: text.sfdisplay_1_display
data:
value: "{{ repeat.item | upper }}"
- delay:
seconds: "{{ states('input_number.splitflap_delay') | default(4) | float }}"
- delay:
seconds: 2
- service: text.set_value
target:
entity_id: text.sfdisplay_1_display
data:
value: " "
4. Dashboard UI
YAML
type: entities
title: Split-Flap Control
entities:
- entity: input_text.splitflap_test_input
name: Message
- entity: input_number.splitflap_delay
name: Word Pause
- entity: input_number.splitflap_repeat
name: Sentence Repeats
- type: button
name: "Push to Display"
action_name: "SEND"
tap_action:
action: call-service
service: script.splitflap_display_sentence
5. Simple Automation Example
This automation demonstrates the syntax for setting the message, delay, and repeats before triggering the script.
YAML
alias: "SplitFlap: Simple Door Greeting"
trigger:
- platform: state
entity_id: binary_sensor.front_door
to: "on"
action:
# 1. Set the message
- service: input_text.set_value
target:
entity_id: input_text.splitflap_test_input
data:
value: "WELCOME HOME"
# 2. Set the delay between words (in seconds)
- service: input_number.set_value
target:
entity_id: input_number.splitflap_delay
data:
value: 3
# 3. Set the number of sentence repeats
- service: input_number.set_value
target:
entity_id: input_number.splitflap_repeat
data:
value: 2
# 4. Trigger the script
- service: script.splitflap_display_sentence