Skip to content

idreamshen/esphome-universal-uart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Core Example

external_components:
  - source:
      type: git
      url: https://github.com/idreamshen/esphome-universal-uart
      ref: v1.0.0

uart:
  - id: myuart1
    tx_pin: 1
    rx_pin: 3
    baud_rate: 9600

binary_sensor:
  - platform: template
    device_class: motion
    name: Person Motion
    id: test_motion

universal_uart:
  data_length: 7
  on_data:
    - then:
        - logger.log: hi
        - lambda: !lambda |-
            if (data[0] == 4 && data[4] == 1) {
              id(test_motion).publish_state(true);
            } else if (data[0] == 4 && data[4] == 0) {
              id(test_motion).publish_state(false);
            }

Full Example

esphome:
  name: universal-uart-test
  friendly_name: universal-uart-test

external_components:
  # - source:
  #     type: local
  #     path: my_components/esphome-universal-uart/components
  - source:
      type: git
      url: https://github.com/idreamshen/esphome-universal-uart
      ref: v1.0.0

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "cNkmuFHM4O2xbN2dzBanOnFtmbUyM2kDiD2GukiWBRo="

ota:
  password: "7d51c5ed4db6e5d5ffde70e06f56af82"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Universal-Uart-Test"
    password: "gqozzGVztdww"

captive_portal:

uart:
  - id: myuart1
    tx_pin: 1
    rx_pin: 3
    baud_rate: 9600

binary_sensor:
  - platform: template
    device_class: motion
    name: test motion
    id: test_motion

universal_uart:
  data_length: 7
  on_data:
    - then:
        - logger.log: hi
        - lambda: !lambda |-
            if (data[0] == 4 && data[4] == 1) {
              id(test_motion).publish_state(true);
            } else if (data[0] == 4 && data[4] == 0) {
              id(test_motion).publish_state(false);
            }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published