Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matter Border Router for ESP8266 (experimental) #18734

Merged

Conversation

s-hadinger
Copy link
Collaborator

@s-hadinger s-hadinger commented May 29, 2023

Description:

Implementation of Matter Border Router which allows to use a single ESP32(/C3/S3) to control multiple other Tasmota devices, including ESP8266.

Matter Controller (Apple/Alexa/Google) <--> Tasmota Matter Border Router (ESP32) <--> Multiple Tasmota devices (via HTTP)

Currently supported:

  • Light with 0/1/2/3 channels: OnOff / Dimmer / CT / RGB
  • Relays
  • Sensors for: Temperature, Pressure, Humidity, Illuminance

Important Note: Full Bridge mode is not yet supported, which means that currently you can't dynamically add new devices/endpoints. Adding a new Tasmota-end-device requires to remove the border router from the controller and pair it again. This will be addresses in the near future.

When a command arrives from the Matter controller, it is passed immediately to the end-device. Any change made on the end-device is eventually sent back to Matter controller via polling. Polling is done every 3 seconds for Lights/Relays, every 5 seconds for sensors.

The Matter border router needs to have IP connectivity to the Tasmota end-device to send HTTP requests. However they don't need to be on the same VLAN (contrary to Matter which needs the controller and the device to be on the same VLAN).

Example:

  • Remote ESP32 with on-board WS2812 RGB Light and ESP32 internal temperature sensor (192.168.2.200)
  • Remote ESP8266 with single relay (192.168.2.203)
  • M5StickC with EnvII sensor: BMP280 & SHT30 (192.168.1.114)

WebUI gives a near-realtime status of remote devices
image

Corresponding view of the Matter configuration UI:
image

Corresponding _matter_device.json configuration file:

{
  "distinguish": <hidden>,
  "passcode": <hidden>,
  "ipv4only": false,
  "config": {
    "0": {
      "type": "root"
    },
    "1": {
      "type": "http_light3",
      "url": "192.168.2.200",
      "relay": 3
    },
    "2": {
      "type": "http_temperature",
      "url": "192.168.2.200",
      "filter": "ESP32#Temperature"
    },
    "11": {
      "type": "http_light0",
      "url": "192.168.2.203",
      "relay": 1
    },
    "21": {
      "type": "http_temperature",
      "url": "192.168.1.114",
      "filter": "BMP280#Temperature"
    },
    "32": {
      "type": "http_pressure",
      "url": "192.168.1.114",
      "filter": "BMP280#Pressure"
    },
    "33": {
      "type": "http_temperature",
      "url": "192.168.1.114",
      "filter": "SHT3X#Temperature"
    },
    "34": {
      "type": "http_humidity",
      "url": "192.168.1.114",
      "filter": "SHT3X#Humidity"
    }
  }
}

Configuration in WebUI:

  • For light: <power_number>,<IP> where <power_number> is the number used in Power<x> command to control the light. Ex: for a single light use 1. For 3 relays and a light, use 4
  • For relay: <relay_number>,<IP> where <relay_number> is the number of the relay in template
  • For sensors; <rule_pattern>,<IP> where <rule_pattern> is the search pattern used on JSON from Status 8 to get the value. Ex: SHT3X#Humidity

Note: logs are currently on-purpose verbose to simplify debugging from early testers. They will be reduced when stabilized.
Example:

09:32:49.553 MTR: HTTP async-resp in 153 ms from 192.168.2.200: [518] '{"StatusSTS":{"Time":"2023-05-...'
09:32:51.879 MTR: HTTP async-resp in 198 ms from 192.168.2.203: [333] '{"StatusSTS":{"Time":"2023-05-...'
09:32:52.037 MTR: HTTP async-resp in 139 ms from 192.168.2.200: [396] '{"StatusSNS":{"Time":"2023-05-...'
09:32:52.796 MTR: HTTP async-resp in 153 ms from 192.168.2.200: [518] '{"StatusSTS":{"Time":"2023-05-...'
09:32:53.888 MTR: HTTP async-resp in 233 ms from 192.168.1.114: [359] '{"StatusSNS":{"Time":"2023-05-...'
09:32:55.137 MTR: HTTP async-resp in 237 ms from 192.168.2.203: [333] '{"StatusSTS":{"Time":"2023-05-...'
09:32:55.801 MTR: HTTP async-resp in 146 ms from 192.168.2.200: [518] '{"StatusSTS":{"Time":"2023-05-...'
09:32:57.079 MTR: HTTP async-resp in 132 ms from 192.168.2.200: [396] '{"StatusSNS":{"Time":"2023-05-...'
09:32:58.129 MTR: HTTP async-resp in 176 ms from 192.168.2.203: [333] '{"StatusSTS":{"Time":"2023-05-...'
09:32:59.055 MTR: HTTP async-resp in 166 ms from 192.168.2.200: [518] '{"StatusSTS":{"Time":"2023-05-...'

Checklist:

  • The pull request is done against the latest development branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • The code change is tested and works with Tasmota core ESP8266 V.2.7.4.9
  • The code change is tested and works with Tasmota core ESP32 V.2.0.9
  • I accept the CLA.

NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass

@s-hadinger s-hadinger merged commit fe570a1 into arendst:development May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant