update esppilight lib

content of the library is not filtered on 433mhz only
This commit is contained in:
Florian committed 2018-11-28 20:41:37 +01:00
1 parent a275e48ee1
commit 67dd7ac078
1030 files changed
+203335 -116

No files matched your search

@@ -0,0 +1,12 @@
Examples
========
.. toctree::
:maxdepth: 1
ir
kodi
mail
mail1
sunriseset
time
@@ -0,0 +1,62 @@
.. |yes| image:: ../../images/yes.png
.. |no| image:: ../../images/no.png
.. role:: underline
:class: underline
IR Remote
=========
.. rubric:: Description
Switch devices based on your IR remote buttons
.. rubric:: Devices
.. code-block:: json
:linenos:
{
"devices": {
"television": {
"protocol": [ "kaku_switch" ],
"id": [{
"id": 123456,
"unit": 0
}],
"state": "off"
},
"remote": {
"protocol": [ "lirc" ],
"id": [{
"remote": "logitech"
}],
"code": "000000000000e290",
"repeat": 2,
"button": "KEY_P"
}
}
.. rubric:: Rule
.. code-block:: json
:linenos:
{
"remote-television-switch": {
"rule": "IF remote.button IS KEY_P AND remote.repeat == 0 THEN toggle DEVICE television BETWEEN on AND off",
"active": 1
}
}
.. versionchanged:: 8.1.0
.. code-block:: json
:linenos:
{
"remote-television-switch": {
"rule": "IF remote.button == KEY_P AND remote.repeat == 0 THEN toggle DEVICE television BETWEEN on AND off",
"active": 1
}
}
@@ -0,0 +1,69 @@
.. |yes| image:: ../../images/yes.png
.. |no| image:: ../../images/no.png
.. role:: underline
:class: underline
XBMC / Kodi
===========
.. rubric:: Description
Execute rules based on XBMC / KODI based events
.. rubric:: Devices
.. code-block:: json
:linenos:
{
"xbmcControls": {
"protocol": [ "xbmc" ],
"id": [{
"server": "127.0.0.1",
"port": 9090
}],
"action": "home",
"media": "none"
},
"speakers": {
"protocol": [ "kaku_switch" ],
"id": [{
"id": 123456,
"unit": 4
}],
"state": "off"
}
}
.. rubric:: Rule
.. code-block:: json
:linenos:
{
"speakers-on": {
"rule": "IF xbmcControls.action IS play THEN switch DEVICE speakers TO on",
"active": 1
},
"speakers-off": {
"rule": "IF xbmcControls.action IS pause OR xbmcControls.action IS home THEN switch DEVICE speakers TO off AFTER 3 MINUTES",
"active": 1
}
}
.. versionchanged:: 8.1.0
.. code-block:: json
:linenos:
{
"speakers-on": {
"rule": "IF xbmcControls.action == play THEN switch DEVICE speakers TO on",
"active": 1
},
"speakers-off": {
"rule": "IF xbmcControls.action == pause OR xbmcControls.action == home THEN switch DEVICE speakers TO off AFTER '3 MINUTES'",
"active": 1
}
}
@@ -0,0 +1,67 @@
.. |yes| image:: ../../images/yes.png
.. |no| image:: ../../images/no.png
.. role:: underline
:class: underline
Mail on contact trigger
=======================
.. rubric:: Description
Sending a mail based on a contact device trigger including the time when it happened.
.. rubric:: Devices
.. code-block:: json
:linenos:
{
"currentdatetime": {
"protocol": [ "datetime" ],
"id": [{
"longitude": 1.2345,
"latitude": 12.3456
}],
"year": 2015,
"month": 1,
"day": 27,
"hour": 14,
"minute": 37,
"second": 8,
"weekday": 3,
"dst": 1
},
"frontdoor-contact": {
"protocol": [ "kaku_contact" ],
"id": [{
"id": 123456,
"unit": 0
}],
"state": "opened"
}
}
.. rubric:: Rule
.. code-block:: json
:linenos:
{
"frontdoor-contact-mail": {
"rule": "IF frontdoor-contact.state IS opened THEN sendmail TO foo@bar.com SUBJECT Frontdoor was opened at DATE_FORMAT(currentdatetime, %c) MESSAGE .",
"active": 1
}
}
.. versionchanged:: 8.1.0
.. code-block:: json
:linenos:
{
"frontdoor-contact-mail": {
"rule": "IF frontdoor-contact.state == opened THEN sendmail TO foo@bar.com SUBJECT 'Frontdoor was opened at ' . DATE_FORMAT(currentdatetime, %c) MESSAGE ..",
"active": 1
}
}
@@ -0,0 +1,67 @@
.. |yes| image:: ../../images/yes.png
.. |no| image:: ../../images/no.png
.. role:: underline
:class: underline
Mail on computer disconnection
==============================
.. rubric:: Description
Send a mail when one of the computer goes offline.
.. rubric:: Devices
.. code-block:: json
:linenos:
{
"currentdatetime": {
"protocol": [ "datetime" ],
"id": [{
"longitude": 1.2345,
"latitude": 12.3456
}],
"year": 2015,
"month": 1,
"day": 27,
"hour": 14,
"minute": 37,
"second": 8,
"weekday": 3,
"dst": 1
},
"nasPing": {
"protocol": [ "arping" ],
"id": [{
"mac": "aa:bb:cc:dd:00:11"
}],
"ip": "192.168.1.1",
"state": "connected"
}
}
.. rubric:: Rule
.. code-block:: json
:linenos:
{
"nas-mail": {
"rule": "IF nasPing.state IS disconnected THEN sendmail TO foo@bar.com SUBJECT NAS is offline since DATE_FORMAT(currentdatetime, %c) MESSAGE .",
"active": 1
}
}
.. versionchanged:: 8.1.0
.. code-block:: json
:linenos:
{
"nas-mail": {
"rule": "IF nasPing.state IS disconnected THEN sendmail TO foo@bar.com SUBJECT 'NAS is offline since ' . DATE_FORMAT(currentdatetime, %c) MESSAGE ..",
"active": 1
}
}
@@ -0,0 +1,147 @@
.. |yes| image:: ../../images/yes.png
.. |no| image:: ../../images/no.png
.. role:: underline
:class: underline
Sunrise / Sunset Event
======================
.. rubric:: Description
This rule executes when the sun sets or rises.
.. rubric:: Devices
.. code-block:: json
:linenos:
{
"devices": {
"currentdatetime": {
"protocol": [ "datetime" ],
"id": [{
"longitude": 1.2345,
"latitude": 12.3456
}],
"year": 2015,
"month": 1,
"day": 27,
"hour": 14,
"minute": 37,
"second": 8,
"weekday": 3,
"dst": 1
},
"sunrisesetdevice": {
"protocol": [ "sunriseset" ],
"id": [{
"longitude": 1.234567,
"latitude": 12.123456
}],
"sunrise": 6.40,
"sunset": 18.50,
"sun": "rise"
},
"light": {
"protocol": [ "kaku_switch" ],
"id": [{
"id": 123456,
"unit": 0
}],
"state": "off"
}
}
}
.. rubric:: Rule
By using math
.. code-block:: json
:linenos:
{
"sunset": {
"rule": "IF ((sunrisesetdevice.sunset == (currentdatetime.hour + (currentdatetime.minute / 100)) AND light.state IS off) AND currentdatetime.second == 0) THEN switch DEVICE light TO on",
"active": 1
},
"sunrise": {
"rule": "IF ((sunrisesetdevice.sunrise == (currentdatetime.hour + (currentdatetime.minute / 100)) AND light.state IS off) AND currentdatetime.second == 0) THEN switch DEVICE light TO on",
"active": 1
}
}
By using the DATE_FORMAT function
.. code-block:: json
:linenos:
{
"sunset": {
"rule": "IF (sunrisesetdevice.sunset == DATE_FORMAT(currentdatetime, %H.%M)) AND light.state IS off AND currentdatetime.second == 0 THEN switch DEVICE light TO on",
"active": 1
},
"sunrise": {
"rule": "IF (sunrisesetdevice.sunrise == DATE_FORMAT(currentdatetime, %H.%M)) AND light.state IS off AND currentdatetime.second == 0 THEN switch DEVICE light TO on",
"active": 1
}
}
Or an hour before the sun sets:
.. code-block:: json
:linenos:
{
"sunset": {
"rule": "IF (sunrisesetdevice.sunset == DATE_FORMAT(DATE_ADD(currentdatetime, +1 HOUR), \"%Y-%m-%d %H:%M:%S\", %H.%M)) AND light.state IS off AND currentdatetime.second == 0 THEN switch DEVICE light TO on",
"active": 1
}
}
.. versionchanged:: 8.1.0
By using math
.. code-block:: json
:linenos:
{
"sunset": {
"rule": "IF ((sunrisesetdevice.sunset == (currentdatetime.hour + (currentdatetime.minute / 100)) AND light.state == off) AND currentdatetime.second == 0) THEN switch DEVICE light TO on",
"active": 1
},
"sunrise": {
"rule": "IF ((sunrisesetdevice.sunrise == (currentdatetime.hour + (currentdatetime.minute / 100)) AND light.state == off) AND currentdatetime.second == 0) THEN switch DEVICE light TO on",
"active": 1
}
}
By using the DATE_FORMAT function
.. code-block:: json
:linenos:
{
"sunset": {
"rule": "IF (sunrisesetdevice.sunset == DATE_FORMAT(currentdatetime, %H.%M)) AND light.state == off AND currentdatetime.second == 0 THEN switch DEVICE light TO on",
"active": 1
},
"sunrise": {
"rule": "IF (sunrisesetdevice.sunrise == DATE_FORMAT(currentdatetime, %H.%M)) AND light.state == off AND currentdatetime.second == 0 THEN switch DEVICE light TO on",
"active": 1
}
}
Or an hour before the sun sets:
.. code-block:: json
:linenos:
{
"sunset": {
"rule": "IF (sunrisesetdevice.sunset == DATE_FORMAT(DATE_ADD(currentdatetime, '+1 HOUR'), '%Y-%m-%d %H:%M:%S', %H.%M)) AND light.state == off AND currentdatetime.second == 0 THEN switch DEVICE light TO on",
"active": 1
}
}
@@ -0,0 +1,67 @@
.. |yes| image:: ../../images/yes.png
.. |no| image:: ../../images/no.png
.. role:: underline
:class: underline
Time based
==========
.. rubric:: Description
Trigger events based on time
.. rubric:: Devices
.. code-block:: json
:linenos:
{
"currentdatetime": {
"protocol": [ "datetime" ],
"id": [{
"longitude": 1.2345,
"latitude": 12.3456
}],
"year": 2015,
"month": 1,
"day": 27,
"hour": 14,
"minute": 37,
"second": 8,
"weekday": 3,
"dst": 1
},
"outsidelight": {
"protocol": [ "kaku_switch" ],
"id": [{
"id": 123456,
"unit": 0
}],
"state": "off"
}
}
.. rubric:: Rule
.. code-block:: json
:linenos:
{
"christmass-tree-off": {
"rule": "IF DATE_FORMAT(currentdatetime, %H.%M%S) == 23.0000 THEN switch DEVICE outsidelight TO on AFTER RANDOM(0, 90) MINUTE FOR RANDOM(5, 15) MINUTE",
"active": 1
}
}
.. versionchanged:: 8.1.0
.. code-block:: json
:linenos:
{
"christmass-tree-off": {
"rule": "IF DATE_FORMAT(currentdatetime, %H.%M%S) == 23.0000 THEN switch DEVICE outsidelight TO on AFTER RANDOM(0, 90) . ' MINUTE' FOR RANDOM(5, 15) . ' MINUTE'",
"active": 1
}
}