espnow:
  id: espnow_component
  auto_add_peer: false
  channel: 1
  peers:
    - 11:22:33:44:55:66
  on_receive:
    - logger.log:
        format: "Received from: %s = '%s'  RSSI: %d"
        args:
          - format_mac_address_pretty(info.src_addr).c_str()
          - format_hex_pretty(data, size).c_str()
          - info.rx_ctrl->rssi
    - espnow.send:
        address: 11:22:33:44:55:66
        data: "Hello from ESPHome"
        on_sent:
          - logger.log: "ESPNow message sent successfully"
        on_error:
          - logger.log: "ESPNow message failed to send"
        wait_for_sent: true
        continue_on_error: true

    - espnow.send:
        address: 11:22:33:44:55:66
        data: [0x01, 0x02, 0x03, 0x04, 0x05]
    - espnow.send:
        address: 11:22:33:44:55:66
        data: !lambda 'return {0x01, 0x02, 0x03, 0x04, 0x05};'
    - espnow.broadcast:
        data: "Hello, World!"
    - espnow.broadcast:
        data: [0x01, 0x02, 0x03, 0x04, 0x05]
    - espnow.broadcast:
        data: !lambda 'return {0x01, 0x02, 0x03, 0x04, 0x05};'
    - espnow.peer.add:
        address: 11:22:33:44:55:66
    - espnow.peer.delete:
        address: 11:22:33:44:55:66
  on_broadcast:
    - logger.log:
        format: "Broadcast from: %s = '%s'  RSSI: %d"
        args:
          - format_mac_address_pretty(info.src_addr).c_str()
          - format_hex_pretty(data, size).c_str()
          - info.rx_ctrl->rssi
  on_unknown_peer:
    - logger.log:
        format: "Unknown peer: %s = '%s'  RSSI: %d"
        args:
          - format_mac_address_pretty(info.src_addr).c_str()
          - format_hex_pretty(data, size).c_str()
          - info.rx_ctrl->rssi

packet_transport:
  - platform: espnow
    id: transport1
    espnow_id: espnow_component
    peer_address: "FF:FF:FF:FF:FF:FF"
    encryption:
      key: "0123456789abcdef0123456789abcdef"
    sensors:
      - temp_sensor
    providers:
      - name: test-provider
        encryption:
          key: "0123456789abcdef0123456789abcdef"

sensor:
  - platform: internal_temperature
    id: temp_sensor

  - platform: packet_transport
    provider: test-provider
    remote_id: temp_sensor
    id: remote_temp
