Skip to content

Commit

Permalink
[Docs] Add quotes in rules examples for SendTo and SendToHTTP
Browse files Browse the repository at this point in the history
  • Loading branch information
tonhuisman committed Nov 18, 2022
1 parent 41f60a2 commit fd4fec9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
10 changes: 8 additions & 2 deletions docs/source/Plugin/P000_commands.repl
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,10 @@
:green:`Rules`","
Send command to other ESP (using UDP)

``SendTo,<unit nr>,<command>``"
``SendTo,<unit nr>,<command>``

If the ``<command>`` contains comma's or spaces, it should be quoted, like ``SendTo,<unit nr>,'<command>'``, the usual quotes can be used, double quotes, single quotes or backticks.
"
"
SendToHTTP","
:green:`Rules`","
Expand All @@ -402,7 +405,10 @@

Example:

``sendtohttp,192.168.10.114,80,'control?cmd=event,poff'``"
``sendtohttp,192.168.10.114,80,'control?cmd=event,poff'``

On completion of the command, the returned status code can be handled in a generated event, f.e. ``http#hostname=404`` for not found error, or ``http#hostname=200`` for success.
"
"
SendToUDP","
:green:`Rules`","
Expand Down
10 changes: 7 additions & 3 deletions docs/source/Rules/Rules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1749,16 +1749,19 @@ There are two flavors:

SendTo: SendTo <unit>,<command>

(Command must be quoted if it contains commas or spaces.)

Imagine you have two ESP Easy modules, ESP#1 and ESP#2
In the Rules section of ESP#1 you have this:

.. code-block:: none
on demoEvent do
sendTo,2,event,startwatering //(to use the previous example.)
sendTo,2,'event,startwatering' //(to use the previous example.)
endon
(Command must be quoted because it contains commas.)

And ESP#2 has the rules according to the previous example (givemesomewater)

If you then enter this with the correct IP address in the URL of your browser:
Expand All @@ -1774,9 +1777,10 @@ It is also possible to directly order GPIO changes, like:
.. code-block:: none
on demoEvent do
sendTo,2,GPIO,2,1
sendTo,2,'GPIO,2,1'
endon
(Command must be quoted because it contains commas.)

Publish

Expand Down Expand Up @@ -1849,7 +1853,7 @@ There is the following workaround:
Added: 2022/07/23

* ``SendToHTTP`` can now also be called with a full URL starting with ``http://``, so no longer the host, port and uri have to be separated. (it is still possible of course)
* HTTP return value will be made available as event to be evaluated in the rules. Example event: ``http#hostname=404``
* HTTP return value will be made available as **event** to be evaluated in the rules. Example event: ``http#hostname=404``
* Calls made to a HTTP server can now also follow redirects. (GET and HEAD calls only) This has to be enabled in Tools->Advanced page.
* Host name can contain user credentials. For example: ``http://username:pass@hostname:portnr/foo.html``
* HTTP user credentials now can handle Basic Auth and Digest Auth.
Expand Down

0 comments on commit fd4fec9

Please sign in to comment.