Morse Code Blinker
A Home Assistant custom integration that blinks lights in morse code.
Installation
HACS Installation
- 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/morse-code-blinker - Select "Integration" as the category
- Click "Add"
- Find "Morse Code Blinker" in the integrations list
- Click "Download"
- Restart Home Assistant
Manual Installation
- Copy the
custom_components/morse_code_blinkerfolder to your Home Assistantcustom_componentsdirectory - Restart Home Assistant
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)
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
Supported Characters
The integration supports:
- Letters (A-Z)
- Numbers (0-9)
- Common punctuation:
. , ? ' ! / ( ) & : ; = + - _ " $ @ - Spaces (for word separation)
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