> ## Documentation Index
> Fetch the complete documentation index at: https://docs.glifo.cat/llms.txt
> Use this file to discover all available pages before exploring further.

# Home Assistant integration

> Available entities, dashboard examples, automation recipes, and Bluetooth proxy setup for the ED1 board.

How to use the ED1 board with Home Assistant.

## Available entities

After adding the device, these entities become available:

### Lights

| Entity ID              | Type      | Description     |
| ---------------------- | --------- | --------------- |
| `light.ed1_led_matrix` | RGB Light | 32x8 LED matrix |

### Switches

| Entity ID           | Type   | Description           |
| ------------------- | ------ | --------------------- |
| `switch.ed1_buzzer` | Switch | Buzzer on/off control |

### Sensors

| Entity ID                    | Type   | Unit | Description                |
| ---------------------------- | ------ | ---- | -------------------------- |
| `sensor.ed1_light_level`     | Sensor | %    | Ambient light level        |
| `sensor.ed1_wifi_signal`     | Sensor | dBm  | WiFi signal strength       |
| `sensor.ed1_cpu_temperature` | Sensor | °C   | ESP32 internal temperature |
| `sensor.ed1_uptime`          | Sensor | s    | Device uptime              |

### Binary sensors (touch buttons)

| Entity ID                        | Type          | Description  |
| -------------------------------- | ------------- | ------------ |
| `binary_sensor.ed1_button_up`    | Binary Sensor | Up button    |
| `binary_sensor.ed1_button_down`  | Binary Sensor | Down button  |
| `binary_sensor.ed1_button_left`  | Binary Sensor | Left button  |
| `binary_sensor.ed1_button_right` | Binary Sensor | Right button |
| `binary_sensor.ed1_button_ok`    | Binary Sensor | OK button    |
| `binary_sensor.ed1_button_x`     | Binary Sensor | X button     |

### Text

| Entity ID              | Type | Description             |
| ---------------------- | ---- | ----------------------- |
| `text.ed1_matrix_text` | Text | Send text to LED matrix |

### Diagnostic

| Entity ID                    | Type        | Description       |
| ---------------------------- | ----------- | ----------------- |
| `text_sensor.ed1_ip_address` | Text Sensor | Device IP address |

### Stepper motors (requires stepper package)

| Entity ID                  | Type   | Description                         |
| -------------------------- | ------ | ----------------------------------- |
| `number.ed1_motor_1_steps` | Number | Set Motor 1 steps (-4096 to +4096)  |
| `number.ed1_motor_2_steps` | Number | Set Motor 2 steps (-4096 to +4096)  |
| `button.ed1_motor_1_cw`    | Button | Motor 1 clockwise 512 steps         |
| `button.ed1_motor_1_ccw`   | Button | Motor 1 counter-clockwise 512 steps |
| `button.ed1_motor_2_cw`    | Button | Motor 2 clockwise 512 steps         |
| `button.ed1_motor_2_ccw`   | Button | Motor 2 counter-clockwise 512 steps |
| `button.ed1_motors_stop`   | Button | Stop motors and power down coils    |

**Note**: 512 steps = 1 full rotation (360°)

### IR receiver (logs only)

The IR receiver does not create Home Assistant entities. Received IR codes appear in the ESPHome logs and can be used to trigger automations via ESPHome actions. See [ESPHome configuration](/ed1-hoas/esphome/configuration) for configuration details.

## Dashboard examples

### Basic card

```yaml theme={null}
type: entities
title: ED1 Board
entities:
  - entity: light.ed1_led_matrix
  - entity: text.ed1_matrix_text
  - entity: switch.ed1_buzzer
  - entity: sensor.ed1_light_level
  - entity: sensor.ed1_cpu_temperature
  - entity: sensor.ed1_wifi_signal
```

### LED matrix control card

```yaml theme={null}
type: vertical-stack
cards:
  - type: light
    entity: light.ed1_led_matrix
    name: LED Matrix
  - type: entities
    entities:
      - entity: text.ed1_matrix_text
        name: Display Text
```

### Touch buttons status

```yaml theme={null}
type: glance
title: ED1 Buttons
entities:
  - entity: binary_sensor.ed1_button_up
    name: Up
  - entity: binary_sensor.ed1_button_down
    name: Down
  - entity: binary_sensor.ed1_button_left
    name: Left
  - entity: binary_sensor.ed1_button_right
    name: Right
  - entity: binary_sensor.ed1_button_ok
    name: OK
  - entity: binary_sensor.ed1_button_x
    name: X
```

### Sensor gauges

```yaml theme={null}
type: horizontal-stack
cards:
  - type: gauge
    entity: sensor.ed1_light_level
    name: Light
    min: 0
    max: 100
    severity:
      green: 50
      yellow: 20
      red: 0
  - type: gauge
    entity: sensor.ed1_cpu_temperature
    name: CPU Temp
    min: 20
    max: 80
    severity:
      green: 40
      yellow: 60
      red: 70
```

## Automation examples

### Display notification on matrix

```yaml theme={null}
alias: "Display notification on ED1"
trigger:
  - platform: state
    entity_id: binary_sensor.front_door
    to: "on"
action:
  - service: text.set_value
    target:
      entity_id: text.ed1_matrix_text
    data:
      value: "DOOR!"
  - delay:
      seconds: 10
  - service: text.set_value
    target:
      entity_id: text.ed1_matrix_text
    data:
      value: ""
```

### Button controls light

```yaml theme={null}
alias: "ED1 OK button toggles living room"
trigger:
  - platform: state
    entity_id: binary_sensor.ed1_button_ok
    to: "on"
action:
  - service: light.toggle
    target:
      entity_id: light.living_room
```

### Button navigation menu

```yaml theme={null}
alias: "ED1 Up button - next scene"
trigger:
  - platform: state
    entity_id: binary_sensor.ed1_button_up
    to: "on"
action:
  - service: input_select.select_next
    target:
      entity_id: input_select.scene_selector
```

### Light level automation

```yaml theme={null}
alias: "Auto lights based on ED1 sensor"
trigger:
  - platform: numeric_state
    entity_id: sensor.ed1_light_level
    below: 30
condition:
  - condition: state
    entity_id: sun.sun
    state: "below_horizon"
action:
  - service: light.turn_on
    target:
      entity_id: light.desk_lamp
```

### Display current time

```yaml theme={null}
alias: "Update ED1 with time every minute"
trigger:
  - platform: time_pattern
    minutes: "/1"
action:
  - service: text.set_value
    target:
      entity_id: text.ed1_matrix_text
    data:
      value: "{{ now().strftime('%H:%M') }}"
```

### Display weather

```yaml theme={null}
alias: "Show weather on ED1"
trigger:
  - platform: state
    entity_id: weather.home
action:
  - service: text.set_value
    target:
      entity_id: text.ed1_matrix_text
    data:
      value: "{{ state_attr('weather.home', 'temperature') }}C"
```

### Buzzer alert on motion

```yaml theme={null}
alias: "ED1 buzzer on motion"
trigger:
  - platform: state
    entity_id: binary_sensor.motion_sensor
    to: "on"
action:
  - service: switch.turn_on
    target:
      entity_id: switch.ed1_buzzer
  - delay:
      milliseconds: 200
  - service: switch.turn_off
    target:
      entity_id: switch.ed1_buzzer
```

### Stepper motor control

```yaml theme={null}
alias: "Rotate Motor 1 half turn"
trigger:
  - platform: state
    entity_id: binary_sensor.ed1_button_up
    to: "on"
action:
  - service: number.set_value
    target:
      entity_id: number.ed1_motor_1_steps
    data:
      value: 256  # Half turn (180°)
```

### Open/close with steppers

```yaml theme={null}
alias: "ED1 Motor Blinds Control"
trigger:
  - platform: state
    entity_id: input_boolean.blinds_open
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: input_boolean.blinds_open
            state: "on"
        sequence:
          - service: number.set_value
            target:
              entity_id: number.ed1_motor_1_steps
            data:
              value: 1024  # Open position
      - conditions:
          - condition: state
            entity_id: input_boolean.blinds_open
            state: "off"
        sequence:
          - service: number.set_value
            target:
              entity_id: number.ed1_motor_1_steps
            data:
              value: -1024  # Close position
```

## Scripts

### Flash matrix red (alert)

```yaml theme={null}
flash_ed1_alert:
  alias: "Flash ED1 Matrix Red"
  sequence:
    - repeat:
        count: 5
        sequence:
          - service: light.turn_on
            target:
              entity_id: light.ed1_led_matrix
            data:
              rgb_color: [255, 0, 0]
              brightness: 255
          - delay:
              milliseconds: 200
          - service: light.turn_off
            target:
              entity_id: light.ed1_led_matrix
          - delay:
              milliseconds: 200
```

### Cycle through colors

```yaml theme={null}
ed1_color_cycle:
  alias: "ED1 Color Cycle"
  sequence:
    - service: light.turn_on
      target:
        entity_id: light.ed1_led_matrix
      data:
        rgb_color: [255, 0, 0]
    - delay:
        seconds: 1
    - service: light.turn_on
      target:
        entity_id: light.ed1_led_matrix
      data:
        rgb_color: [0, 255, 0]
    - delay:
        seconds: 1
    - service: light.turn_on
      target:
        entity_id: light.ed1_led_matrix
      data:
        rgb_color: [0, 0, 255]
```

## Bluetooth proxy

The ED1 acts as a Bluetooth proxy, extending Home Assistant's BLE range.

### Setup

1. Ensure `bluetooth_proxy` is enabled in ESPHome config
2. In Home Assistant, go to Settings > Devices & Services
3. Bluetooth integration will automatically use the ED1 as a proxy

### Use cases

* Detect BLE devices further from HA server
* Track Bluetooth thermometers, plant sensors
* Connect to Bluetooth devices in other rooms

## Tips

### Reduce API traffic

If the device disconnects frequently, reduce sensor update rates:

```yaml theme={null}
sensor:
  - platform: wifi_signal
    update_interval: 300s  # 5 minutes instead of 60s
```

### Entity naming

Entity IDs are derived from `name` fields. To customize:

```yaml theme={null}
sensor:
  - platform: internal_temperature
    name: "ED1 CPU Temp"  # becomes sensor.ed1_cpu_temp
```

### Multiple boards

For multiple ED1 boards, change the device name:

```yaml theme={null}
esphome:
  name: ed1-kitchen
  friendly_name: ED1 Kitchen
```
