Morse Code Blinker
A Home Assistant custom integration that blinks lights in morse code.
Installation
HACS Installation
⚠️ Important Note: HACS does not natively support integrations located in subfolders of a repository. Since this integration is in the morse-code-blinker subfolder of the home-assistant repository, HACS may not automatically detect it.
Option 1: Try HACS (may not work)
- Open HACS in Home Assistant
- Go to "Integrations"
- Click the three dots menu (⋮) in the top right
- Select "Custom repositories"
- Add this repository URL:
https://git.falkvinge.net/rick/home-assistant - Select "Integration" as the category
- Click "Add"
- If HACS finds it, click "Download" and restart Home Assistant
- If HACS doesn't find it, use Manual Installation below
Option 2: Manual Installation (Recommended for subfolder structure)
Manual Installation (Recommended)
Since this integration is in a subfolder, manual installation is the most reliable method:
-
Clone or download the repository:
git clone https://git.falkvinge.net/rick/home-assistant.git cd home-assistant/morse-code-blinker -
Copy the
custom_components/morse_code_blinkerfolder to your Home Assistantcustom_componentsdirectory:cp -r custom_components/morse_code_blinker /config/custom_components/ -
Restart Home Assistant
Alternative: You can also download just the morse-code-blinker subfolder from the web interface at:
https://git.falkvinge.net/rick/home-assistant/src/branch/master/morse-code-blinker
Configuration
After manual installation, add the integration to your configuration.yaml file:
morse_code_blinker:
That's it! This integration doesn't require any configuration options - it just needs to be loaded. After adding this to your configuration.yaml:
-
Check your configuration:
- Go to Developer Tools > YAML
- Click Check Configuration
- Fix any errors if present
-
Restart Home Assistant to load the integration
Note: The integration will work even without adding it to configuration.yaml (it will be auto-discovered), but adding it explicitly ensures it's loaded and allows Home Assistant to show it in the integrations list.
Usage
After installation, the integration provides a service morse_code_blinker.blink that can be used to blink any light entity in morse code.
Service Parameters
entity_id(required): The entity ID of the light to blink (e.g.,light.living_room)message(required): The text message to convert to morse codedot_duration(optional): Duration of a dot in seconds (default: 0.2)dash_duration(optional): Duration of a dash in seconds (default: 0.6)element_gap(optional): Gap between dots/dashes within a letter in seconds (default: 0.2)letter_gap(optional): Gap between letters in seconds (default: 0.6)word_gap(optional): Gap between words in seconds (default: 1.4)transition(optional): Transition time in seconds for light on/off (default: 0 = instant). Set to 0 for LED lights to get crisp, instant on/off transitions. Use higher values for incandescent lights if needed.
Examples
Using the Developer Tools
- Go to Developer Tools > Services
- Select
morse_code_blinker.blink - Enter the following YAML:
entity_id: light.living_room
message: "SOS"
Using Automations
automation:
- alias: "Blink SOS on doorbell"
trigger:
- platform: state
entity_id: binary_sensor.doorbell
to: "on"
action:
- service: morse_code_blinker.blink
data:
entity_id: light.front_porch
message: "SOS"
Using Scripts
script:
blink_hello:
alias: "Blink Hello"
sequence:
- service: morse_code_blinker.blink
data:
entity_id: light.bedroom
message: "Hello World"
Custom Timing
service: morse_code_blinker.blink
data:
entity_id: light.kitchen
message: "FAST"
dot_duration: 0.1
dash_duration: 0.3
element_gap: 0.1
letter_gap: 0.3
word_gap: 0.7
Instant Transitions for LED Lights
For LED lights (Zigbee, Z-Wave, etc.), set transition: 0 to get instant on/off without fade:
service: morse_code_blinker.blink
data:
entity_id: light.led_strip
message: "SOS"
transition: 0
Supported Characters
The integration supports:
- Letters (A-Z)
- Numbers (0-9)
- Common punctuation:
. , ? ' ! / ( ) & : ; = + - _ " $ @ - Spaces (for word separation)
Troubleshooting
Service Returns "Unknown Error"
If you get an "Unknown error" when calling the service, check the Home Assistant logs:
-
View Logs:
- Go to Developer Tools > Logs
- Look for errors containing
morse_code_blinker - The logs will show the actual error message
-
Enable Debug Logging (for more detailed information): Add this to your
configuration.yaml:logger: default: info logs: custom_components.morse_code_blinker: debugThen restart Home Assistant and try the service again. The debug logs will show exactly what data is being received and where any errors occur.
-
Common Issues:
- Missing entity_id: Make sure you provide an
entity_idparameter - Missing message: Make sure you provide a
messageparameter - Entity not found: Verify the entity ID exists (check in Developer Tools > States)
- Entity is not a light: The service requires a light entity that supports
turn_onandturn_off
- Missing entity_id: Make sure you provide an
-
Test with Minimal Example: Try this minimal service call first:
service: morse_code_blinker.blink data: entity_id: light.your_light_entity message: "SOS"Replace
light.your_light_entitywith an actual light entity ID from your system.
Notes
- The light will be turned on and off automatically during the morse code sequence
- The service is non-blocking but will take time to complete based on the message length
- Make sure the light entity supports
turn_onandturn_offservices