Files
home-assistant/morse-code-blinker/README.md
T
2025-12-31 11:22:57 +01:00

109 lines
2.7 KiB
Markdown

# Morse Code Blinker
A Home Assistant custom integration that blinks lights in morse code.
## Installation
### HACS Installation
1. Open HACS in Home Assistant
2. Go to "Integrations"
3. Click the three dots menu (⋮) in the top right
4. Select "Custom repositories"
5. Add this repository URL: `https://git.falkvinge.net/rick/home-assistant/morse-code-blinker`
6. Select "Integration" as the category
7. Click "Add"
8. Find "Morse Code Blinker" in the integrations list
9. Click "Download"
10. Restart Home Assistant
### Manual Installation
1. Copy the `custom_components/morse_code_blinker` folder to your Home Assistant `custom_components` directory
2. 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 code
- `dot_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
1. Go to Developer Tools > Services
2. Select `morse_code_blinker.blink`
3. Enter the following YAML:
```yaml
entity_id: light.living_room
message: "SOS"
```
#### Using Automations
```yaml
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
```yaml
script:
blink_hello:
alias: "Blink Hello"
sequence:
- service: morse_code_blinker.blink
data:
entity_id: light.bedroom
message: "Hello World"
```
#### Custom Timing
```yaml
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_on` and `turn_off` services