From 35a6940e38716ea9a35d396a5e966d66fef9d153 Mon Sep 17 00:00:00 2001 From: pmknowles <37398451+pmknowles@users.noreply.github.com> Date: Fri, 15 Sep 2023 21:56:46 +0100 Subject: [PATCH 1/4] Added requirements for WebQuery Added the requirement to compile custom bin using #define USE_WEBSEND_RESPONSE if a response is required from a WebQuery. --- docs/Commands.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Commands.md b/docs/Commands.md index 97636029ee..70635f71bc 100644 --- a/docs/Commands.md +++ b/docs/Commands.md @@ -152,7 +152,7 @@ SwitchDebounce|User control over switch SwitchMode|[Switch mode](Buttons-and-Switches#switchmode). Index `0` applies to **all** switches.
`0` = toggle *(default)*
`1` = follow (0 = off, 1 = on)
`2` = inverted follow (0 = on, 1 = off)
`3` = pushbutton (default 1, 0 = toggle)
`4` = inverted pushbutton (default 0, 1 = toggle)
`5` = pushbutton with hold (default 1, 0 = toggle, Hold = hold)
`6` = inverted pushbutton with hold (default 0, 1 = toggle, hold = hold)
`7` = pushbutton toggle (0 = toggle, 1 = toggle)
`8` = multi change toggle (0 = toggle, 1 = toggle, 2x change = hold)
`9` = multi change follow (0 = off, 1 = on, 2x change = hold)
`10` = inverted multi change follow (0 = on, 1 = off, 2x change = hold)
`11` = pushbutton with dimmer mode
`12` = inverted pushbutton with dimmer mode
`13` = pushon mode (1 = on, switch off using `PulseTime`)
`14` = inverted pushon mode (0 = on, switch off using `PulseTime`)
`15` = send only an MQTT message on switch change (`tele/tasmota/SENSOR` with payload `{"Time":"2021-01-01T00:00:00","Switch1":"OFF"}`)
`16` = inverted send only an MQTT message on switch change SwitchText|Show current JSON label of `Switch` (`1..8`). Only `SwitchText` shows value for all 8 switches
`` - replace default `Switch` label in JSON messages with a custom text
WebButton|Change the name of the toggle buttons of the WEB UI. This command accepts spaces in the name -WebQuery|Command for GET, POST, PUT, and PATCH HTTP queries, complete with Request Headers and request body (when applicable)
` GET|POST|PUT|PATCH [] `
[More information...](https://github.com/arendst/Tasmota/pull/13209) +WebQuery|Command for GET, POST, PUT, and PATCH HTTP queries, complete with Request Headers and request body (when applicable).
Note: If a response is needed you must compile your own bin with `#define USE_WEBSEND_RESPONSE`. If the site uses `https:`this (and many other functions) will only work with ESP32s as ESP8266 will not work with `https:`
` GET|POST|PUT|PATCH [] `
[More information...](https://github.com/arendst/Tasmota/pull/13209) See also|[`SetOption1`](#setoption1) - Set button multipress mode
[`SetOption11`](#setoption11) - Swap pushbutton single and double press functionality
[`SetOption13`](#setoption13) - Allow immediate action on single button press
[`SetOption26`](#setoption26) - Use indexes even when only one relay is present
[`SetOption31`](#setoption31) - Disable Wi-Fi LED status blinking
[`SetOption32`](#setoption32) - Set hold interval before sending `HOLD` action
[`SetOption40`](#setoption40) - Stop detecting any input change on button GPIO
[`SetOption67`](#setoption67) - Enable/Disable Buzzer
[`SetOption73`](#setoption73) - Decouple buttons from controlling power outputs ### Management From e092a046e6ca2506dd0dfcb0445adb89a6cdc25b Mon Sep 17 00:00:00 2001 From: sfromis <47082390+sfromis@users.noreply.github.com> Date: Fri, 15 Sep 2023 23:35:49 +0200 Subject: [PATCH 2/4] Update Rules.md Include %power1% and %switch1% etc --- docs/Rules.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/Rules.md b/docs/Rules.md index 5dc3755c9e..70d658c74a 100644 --- a/docs/Rules.md +++ b/docs/Rules.md @@ -222,8 +222,10 @@ The value of a `Var` and `Mem` can be: - %color% - %deviceid% - %macaddr% +- %power1% to number of power channels - %sunrise% - %sunset% +- %switch1% to number of switch gpios - %time% - %timer1% to %timer16% - %timestamp% From 39d3cc20fa94da6b33b78057e0ed7971691f2f3a Mon Sep 17 00:00:00 2001 From: Barbudor Date: Fri, 15 Sep 2023 23:36:42 +0200 Subject: [PATCH 3/4] Update Commands.md --- docs/Commands.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Commands.md b/docs/Commands.md index 70635f71bc..ee2a9ad41b 100644 --- a/docs/Commands.md +++ b/docs/Commands.md @@ -152,7 +152,7 @@ SwitchDebounce|User control over switch SwitchMode|[Switch mode](Buttons-and-Switches#switchmode). Index `0` applies to **all** switches.
`0` = toggle *(default)*
`1` = follow (0 = off, 1 = on)
`2` = inverted follow (0 = on, 1 = off)
`3` = pushbutton (default 1, 0 = toggle)
`4` = inverted pushbutton (default 0, 1 = toggle)
`5` = pushbutton with hold (default 1, 0 = toggle, Hold = hold)
`6` = inverted pushbutton with hold (default 0, 1 = toggle, hold = hold)
`7` = pushbutton toggle (0 = toggle, 1 = toggle)
`8` = multi change toggle (0 = toggle, 1 = toggle, 2x change = hold)
`9` = multi change follow (0 = off, 1 = on, 2x change = hold)
`10` = inverted multi change follow (0 = on, 1 = off, 2x change = hold)
`11` = pushbutton with dimmer mode
`12` = inverted pushbutton with dimmer mode
`13` = pushon mode (1 = on, switch off using `PulseTime`)
`14` = inverted pushon mode (0 = on, switch off using `PulseTime`)
`15` = send only an MQTT message on switch change (`tele/tasmota/SENSOR` with payload `{"Time":"2021-01-01T00:00:00","Switch1":"OFF"}`)
`16` = inverted send only an MQTT message on switch change SwitchText|Show current JSON label of `Switch` (`1..8`). Only `SwitchText` shows value for all 8 switches
`` - replace default `Switch` label in JSON messages with a custom text
WebButton|Change the name of the toggle buttons of the WEB UI. This command accepts spaces in the name -WebQuery|Command for GET, POST, PUT, and PATCH HTTP queries, complete with Request Headers and request body (when applicable).
Note: If a response is needed you must compile your own bin with `#define USE_WEBSEND_RESPONSE`. If the site uses `https:`this (and many other functions) will only work with ESP32s as ESP8266 will not work with `https:`
` GET|POST|PUT|PATCH [] `
[More information...](https://github.com/arendst/Tasmota/pull/13209) +WebQuery|Command for GET, POST, PUT, and PATCH HTTP queries, complete with Request Headers and request body (when applicable).
` GET|POST|PUT|PATCH [] `
Note: If a response is needed you must compile your own bin with `#define USE_WEBSEND_RESPONSE`.
`https:` is only supported on ESP32s
[More information...](https://github.com/arendst/Tasmota/pull/13209) See also|[`SetOption1`](#setoption1) - Set button multipress mode
[`SetOption11`](#setoption11) - Swap pushbutton single and double press functionality
[`SetOption13`](#setoption13) - Allow immediate action on single button press
[`SetOption26`](#setoption26) - Use indexes even when only one relay is present
[`SetOption31`](#setoption31) - Disable Wi-Fi LED status blinking
[`SetOption32`](#setoption32) - Set hold interval before sending `HOLD` action
[`SetOption40`](#setoption40) - Stop detecting any input change on button GPIO
[`SetOption67`](#setoption67) - Enable/Disable Buzzer
[`SetOption73`](#setoption73) - Decouple buttons from controlling power outputs ### Management From 5acb0a4f86231b218537f7dffa8dccb4475d0614 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Sat, 16 Sep 2023 10:20:51 +0200 Subject: [PATCH 4/4] Matter to IR with virtual device example --- docs/Matter.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/Matter.md b/docs/Matter.md index a30f4bbf81..d8032d71f5 100644 --- a/docs/Matter.md +++ b/docs/Matter.md @@ -276,9 +276,9 @@ Keep in mind that many values are in the range `0..254` because `255` is an inva ### Full Example -The example below if theroetical. We will use a Tasmota Relay via `Power1` and map it with rules to a virtual `Light0` type. +The example below implements a simple bridge between Matter and IR (Infra Red). This allows to trigger On/Off commands from the Matter controller, that are translated to On/Off infra-red commands (we use the simple NEC protocol in the example, like used in Magic Home LED strips). You can also received On/Off infra-red commands that are reflected in the virtual light. In reality, you will probably use only Matter-to-IR or IR-to-Matter direction, but it doesn't harm to have both directions implemented. -Note: the example has the sole purpose of showing how virtual devices work. You should use the native mapping to relays. +We will use a Tasmota Relay via `Power1` and map it with rules to a virtual `Light0` type. **Step 1.** Define one endpoint as `(v) Light 0 On` and give it the name `Light0`. @@ -290,10 +290,20 @@ We use `SetOption83 1` to match endpoint name instead of number, which is highly ``` SetOption83 1 -Rule1 on mtrreceived#Light0#power do power %value% endon on power1#state do mtrupdate {"name":"Light0","power":%value%} endon +Rule1 on mtrreceived#Light0#power==1 do irsend {"protocol":"nec","bits":32,"data":"0xffb04f"} endon on mtrreceived#Light0#power==0 do irsend {"protocol":"nec","bits":32,"data":"0xfff807"} endon on irreceived#data=0xFFB04F do mtrupdate {"name":"Light0","power":1} endon on irreceived#data=0xFFF807 do mtrupdate {"name":"Light0","power":0} endon Rule1 1 ``` +If we decompose the Rule, the first two rule matches convert a Matter initiated command to an IR message, the two last convert an IR message to a Matter state update: + +``` +Rule1 + on mtrreceived#Light0#power==1 do irsend {"protocol":"nec","bits":32,"data":"0xffb04f"} endon + on mtrreceived#Light0#power==0 do irsend {"protocol":"nec","bits":32,"data":"0xfff807"} endon + on irreceived#data=0xFFB04F do mtrupdate {"name":"Light0","power":1} endon + on irreceived#data=0xFFF807 do mtrupdate {"name":"Light0","power":0} endon +``` + **Step 3.** Pair Tasmota to the Matter Controller.