mirror of
https://github.com/randybb/esphome-configs.git
synced 2026-10-14 08:35:12 +02:00
99 lines
2.8 KiB
YAML
99 lines
2.8 KiB
YAML
---
|
|
# Hardware: Nordic nRF52840 DK
|
|
# Pinout:
|
|
# P0.11 Button 1 (active low) -> Button 1 (binary_sensor gpio)
|
|
# P0.12 Button 2 (active low) -> Button 2 (binary_sensor gpio)
|
|
# P0.13 LED 1 (active low) -> LED 1 (light binary)
|
|
# P0.14 LED 2 (active low) -> LED 2 (light binary)
|
|
# P0.15 LED 3 (active low) -> LED 3 (light binary)
|
|
# P0.16 LED 4 (active low) -> LED 4 (light binary)
|
|
# P0.24 Button 3 (active low) -> Button 3 (binary_sensor gpio)
|
|
# P0.25 Button 4 (active low) -> Button 4 (binary_sensor gpio)
|
|
# P1.01 UART1 RX <- mcu-nrf-ant UART1 TX (P1.01), packet_transport; plus GND
|
|
esphome:
|
|
name: mcu-nrf-dk
|
|
friendly_name: nRF DK
|
|
|
|
# needs the esphomeplatformzephyr fork (esphome-zephyr), upstream has no zephyr: platform yet
|
|
zephyr:
|
|
variant: NRF52
|
|
board: nrf52840dk/nrf52840
|
|
framework:
|
|
type: zephyr
|
|
|
|
logger:
|
|
|
|
network:
|
|
enable_ipv6: true
|
|
|
|
# Active dataset of the Thread network (HA: Settings > Thread > ... > dataset TLV)
|
|
openthread:
|
|
tlv: !secret thread_tlv
|
|
# end device, doesn't route for others; saves flash (FTD fills the MCUboot slot)
|
|
device_type: MTD
|
|
|
|
api:
|
|
encryption:
|
|
key: !secret api_key
|
|
|
|
# ANT+ values from mcu-nrf-ant (second nRF52840 DK) over UART
|
|
uart:
|
|
id: ant_link
|
|
port: UART1
|
|
rx_pin: P1.01
|
|
baud_rate: 115200
|
|
|
|
packet_transport:
|
|
- platform: uart
|
|
uart_id: ant_link
|
|
providers:
|
|
- name: mcu-nrf-ant
|
|
|
|
sensor:
|
|
- platform: packet_transport
|
|
provider: mcu-nrf-ant
|
|
remote_id: heart_rate
|
|
name: Heart Rate
|
|
internal: false
|
|
filters:
|
|
- throttle: 1s
|
|
|
|
output:
|
|
- platform: gpio
|
|
id: led_1_out
|
|
pin: {number: P0.13, inverted: true}
|
|
- platform: gpio
|
|
id: led_2_out
|
|
pin: {number: P0.14, inverted: true}
|
|
- platform: gpio
|
|
id: led_3_out
|
|
pin: {number: P0.15, inverted: true}
|
|
- platform: gpio
|
|
id: led_4_out
|
|
pin: {number: P0.16, inverted: true}
|
|
|
|
light:
|
|
- {platform: binary, name: LED 1, id: led_1, output: led_1_out}
|
|
- {platform: binary, name: LED 2, id: led_2, output: led_2_out}
|
|
- {platform: binary, name: LED 3, id: led_3, output: led_3_out}
|
|
- {platform: binary, name: LED 4, id: led_4, output: led_4_out}
|
|
|
|
# each button toggles its LED locally and is visible in HA
|
|
binary_sensor:
|
|
- platform: gpio
|
|
name: Button 1
|
|
pin: {number: P0.11, inverted: true, mode: {input: true, pullup: true}}
|
|
on_press: {light.toggle: led_1}
|
|
- platform: gpio
|
|
name: Button 2
|
|
pin: {number: P0.12, inverted: true, mode: {input: true, pullup: true}}
|
|
on_press: {light.toggle: led_2}
|
|
- platform: gpio
|
|
name: Button 3
|
|
pin: {number: P0.24, inverted: true, mode: {input: true, pullup: true}}
|
|
on_press: {light.toggle: led_3}
|
|
- platform: gpio
|
|
name: Button 4
|
|
pin: {number: P0.25, inverted: true, mode: {input: true, pullup: true}}
|
|
on_press: {light.toggle: led_4}
|