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,8 @@
API
===
.. toctree::
:maxdepth: 3
program/index
weather/index
@@ -0,0 +1,9 @@
Program
===========
.. toctree::
:maxdepth: 1
lirc
program
xbmc
@@ -0,0 +1,98 @@
.. |yes| image:: ../../../images/yes.png
.. |no| image:: ../../../images/no.png
.. role:: underline
:class: underline
Lirc
====
+------------------+-------------+
| **Feature** | **Support** |
+------------------+-------------+
| Sending | |no| |
+------------------+-------------+
| Receiving | |yes| |
+------------------+-------------+
| Config | |yes| |
+------------------+-------------+
.. rubric:: Supported Brands
*None*
.. rubric:: Sender Arguments
*None*
.. rubric:: Config
.. code-block:: json
:linenos:
{
"ab": {
"protocol": [ "lirc" ],
"id": [{
"remote": "logitech"
}],
"code": "000000000000e204",
"repeat": 1,
"button": "KEY_ARROWDOWN"
}
}
+------------------+-----------------+
| **Option** | **Value** |
+------------------+-----------------+
| remote | *any value* |
+------------------+-----------------+
| code | *any value* |
+------------------+-----------------+
| repeat | 1 - 999 |
+------------------+-----------------+
| button | *any value* |
+------------------+-----------------+
.. rubric:: Comments
The Lirc protocol tries to automatically connect to Lirc when pilight starts. When a connection can be made, it will send the same output as shown with ``irw`` in a pilight format.
.. code-block:: console
root@pi:~# irw
000000037ff07be0 00 KEY_ARROWDOWN logitech-harmony-300i
.. code-block:: console
root@pi:~# pilight-receive
{
"code": {
"id": "000000000000e204",
"repeat": "01",
"button": "KEY_ARROWDOWN",
"remote": "logitech"
},
"origin": "receiver",
"protocol": "lirc"
}
Whenever, a connection to Lirc is lost, pilight will try to automatically reconnect.
All signal processing will be done by Lirc, so make sure you have a working Lirc configuration. Tutorials on this can be found all around the internet.
pilight tries to connect to the lirc socket found in ``/dev/lircd`` so make sure it exists or a symlink to the original socket is created to ``/dev/lircd``.
**Raspbian Kernels 3.18 and higher**
The most recent Raspbian release, with Pi 2 support, switches to a new kernel (3.18), and includes a configuration change to enable Device Tree support by default.
You do need to add ``dtoverlay=lirc-rpi`` to ``/boot/config.txt``.
Depending on your hardware setup, ``lirc-rpi`` module parameters are added to the end of the dtoverlay line: ``gpio_in_pin=16,gpio_in_pull=high,gpio_out_pin=17``
Example:
.. code-block:: console
dtoverlay=lirc-rpi,gpio_in_pin=18,gpio_out_pin=17
@@ -0,0 +1,124 @@
.. |yes| image:: ../../../images/yes.png
.. |no| image:: ../../../images/no.png
.. role:: underline
:class: underline
Program
=======
+------------------+-------------+
| **Feature** | **Support** |
+------------------+-------------+
| Sending | |yes| |
+------------------+-------------+
| Receiving | |yes| |
+------------------+-------------+
| Config | |yes| |
+------------------+-------------+
.. rubric:: Supported Brands
*None*
.. rubric:: Sender Arguments
.. code-block:: console
-t --running start the program
-f --stopped stop the program
-n --name=name name of the program
.. rubric:: Config
.. code-block:: json
:linenos:
{
"devices": {
"XBMC": {
"protocol": [ "program" ],
"id": [{
"name": "xbmc"
}],
"program": "/usr/local/lib/xbmc/xbmc.bin",
"arguments": "",
"stop-command": "service xbmc stop",
"start-command": "service xbmc start",
"state": "running",
"pid": 11642
}
},
"gui": {
"xbmc": {
"name": "XBMC",
"group": [ "Programs" ],
"media": [ "all" ]
}
}
}
+------------------+-----------------+
| **Option** | **Value** |
+------------------+-----------------+
| name | *any value* |
+------------------+-----------------+
| arguments | *any value* |
+------------------+-----------------+
| stop-command | *any value* |
+------------------+-----------------+
| start-command | *any value* |
+------------------+-----------------+
| state | | starting |
| | | running |
| | | stopped |
+------------------+-----------------+
| pid | 0 - 9 |
+------------------+-----------------+
.. rubric:: Optional Settings
:underline:`Device Settings`
+------------------+-------------+------------+-------------------------------------------------+
| **Setting** | **Default** | **Format** | **Description** |
+------------------+-------------+------------+-------------------------------------------------+
| poll-interval | 1 | >= 1 | How ofter do we want to check the program state |
+------------------+-------------+------------+-------------------------------------------------+
:underline:`GUI Settings`
+------------------+-------------+------------+-----------------------------------------------+
| **Setting** | **Default** | **Format** | **Description** |
+------------------+-------------+------------+-----------------------------------------------+
| readonly | 0 | 1 or 0 | Disable controlling this device from the GUIs |
+------------------+-------------+------------+-----------------------------------------------+
| confirm | 0 | 1 or 0 | Ask for confirmation when switching device |
+------------------+-------------+------------+-----------------------------------------------+
.. rubric:: Comment
The program protocol takes two important arguments
- The program
- The arguments
You can run ``ps aux`` to find out what these are. An example:
.. code-block:: console
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 11622 0.0 2.3 20216 8860 tty4 Ssl+ 20:04 0:01 /usr/local/sbin/splash-daemon
root 11636 0.0 0.4 4096 1540 ? Ss 20:04 0:00 sudo -u xbian /usr/local/lib/xbmc/xbmc.bin --standalone -fs --lircdev /run/lirc/lircd
xbian 11642 22.5 12.6 390836 48280 ? RNl 20:04 15:09 /usr/local/lib/xbmc/xbmc.bin --standalone -fs --lircdev /run/lirc/lircd
xbian 11734 0.0 0.2 2692 1092 ? S 20:04 0:00 /bin/bash
root 11868 0.0 1.4 9732 5432 ? Ss 20:04 0:00 python /usr/local/sbin/upstart-xbmc-bridge.py
root 11908 0.0 0.0 0 0 ? S 20:06 0:00 [btrfs-delalloc-]
root 13078 0.0 0.0 0 0 ? S 21:05 0:00 [kworker/u2:0]
root 13085 0.0 0.0 0 0 ? S 21:08 0:00 [btrfs-worker-2]
root 13166 0.0 0.0 0 0 ? S 21:10 0:00 [kworker/u2:1]
root 13186 0.0 0.2 4424 1116 pts/2 R+ 21:11 0:00 ps aux
In thise case, i want to control XBMC. The xbian entry with the PID 11642 is what i want to use. The first word is the program name. In this case ``/usr/local/lib/xbmc/xbmc.bin``. Everything that comes after are the arguments ``–standalone -fs –lircdev /run/lirc/lircd``. pilight will now check for a program that matches these exact parameters. So the protocol looks for processes matching those lines and when a process is found, it updates the pid value accordingly. (The pid is just informative.)
If you omit the arguments value, all matching programs will be processes with or without matching arguments. If there are more than once matches, pilight will use the first.
@@ -0,0 +1,115 @@
.. |yes| image:: ../../../images/yes.png
.. |no| image:: ../../../images/no.png
.. role:: underline
:class: underline
XBMC / Kodi
===========
+------------------+-------------+
| **Feature** | **Support** |
+------------------+-------------+
| Sending | |no| |
+------------------+-------------+
| Receiving | |yes| |
+------------------+-------------+
| Config | |yes| |
+------------------+-------------+
.. rubric:: Supported Brands
*None*
.. rubric:: Sender Arguments
*None*
.. rubric:: Config
.. code-block:: json
:linenos:
{
"devices": {
"xbmc": {
"protocol": [ "xbmc" ],
"id": [{
"server": "127.0.0.1",
"port": 9090
}],
"action": "shutdown",
"media": "none"
}
},
"gui": {
"xbmc": {
"name": "XBMC",
"group": [ "Programs" ],
"media": [ "all" ]
}
}
}
+------------------+-----------------+
| **Option** | **Value** |
+------------------+-----------------+
| server | *valid ip* |
+------------------+-----------------+
| port | 1 - 65535 |
+------------------+-----------------+
| action | | shutdown |
| | | home |
| | | play |
| | | pause |
| | | active |
| | | inactive |
+------------------+-----------------+
| media | | none |
| | | episode |
| | | movie |
| | | movies |
| | | song |
| | | screensaver |
+------------------+-----------------+
.. note::
- The ``shutdown`` and ``home`` actions are only allowed for the ``none`` media.
- The ``play``, ``home``, and ``pause`` actions are only allowed for the ``episode``, ``movie``, ``movies``, or ``song`` media.
- The ``active`` and ``inactive`` actions are only allowed for the ``screensaver`` media.
.. rubric:: Optional Settings
:underline:`GUI Settings`
+------------------+-------------+------------+-----------------------------------------------+
| **Setting** | **Default** | **Format** | **Description** |
+------------------+-------------+------------+-----------------------------------------------+
| show-media | 1 | 1 or 0 | Don't display the media icon |
+------------------+-------------+------------+-----------------------------------------------+
| show-action | 1 | 1 or 0 | Don't display the action icon |
+------------------+-------------+------------+-----------------------------------------------+
.. rubric:: Comment
The XBMC protocol will try to connect to a XBMC instance. However, make sure the JSON-RPC API is `enabled <http://kodi.wiki/view/JSON-RPC_API#Enabling_JSON-RPC>`_ in XBMC. You don't need to do anything more. Whenever a connection to XBMC is lost, the protocol will automatically try to reconnect. The XBMC protocol sends several messages depending on the actions in XBMC.
+-----------+----------------+
| **Media** | **Action** |
+-----------+----------------+
| movie | play, pause |
+-----------+----------------+
| song | play, pause |
+-----------+----------------+
| episode | play, pause |
+-----------+----------------+
| none | shutdown, home |
+-----------+----------------+
The stop event isn't recording, but pilight will interpret as the home action of the none media. So when XBMC is started or when nothing plays, the action will be home. When pilight can't connect to XBMC or when the connection is lost the shutdown action of the none media will be sent.
Important
pilight uses JSON-RPC via TCP-Port 9090. Don't mix it up with JSON-RPC via HTTP which is available over port 8080 by default (http://Kodi:8080/jsonrpc). This setting is hidden in Kodi/XBMC.
@@ -0,0 +1,9 @@
Weather
=======
.. toctree::
:maxdepth: 1
wunderground
openweathermap
sunriseset
@@ -0,0 +1,122 @@
.. |yes| image:: ../../../images/yes.png
.. |no| image:: ../../../images/no.png
.. role:: underline
:class: underline
OpenWeatherMap
==============
+------------------+-------------+
| **Feature** | **Support** |
+------------------+-------------+
| Sending | |no| |
+------------------+-------------+
| Receiving | |yes| |
+------------------+-------------+
| Config | |yes| |
+------------------+-------------+
.. rubric:: Supported Brands
*None*
.. rubric:: Sender Arguments
*None*
.. rubric:: Config
.. code-block:: json
:linenos:
{
"devices": {
"outside": {
"protocol": [ "openweathermap" ],
"id": [{
"location": "amsterdam",
"api": "1234567890",
"country": "nl"
}],
"humidity": 76.00,
"temperature": 7.00,
"sunrise": 7.00,
"sunset": 16.15,
"sun": "set",
"update": 1
}
},
"gui": {
"outside": {
"name": "Temperature",
"group": [ "Outside" ],
"media": [ "all" ]
}
}
}
+------------------+----------------------------------+
| **Option** | **Value** |
+------------------+----------------------------------+
| location | *valid openweathermap location* |
+------------------+----------------------------------+
| country | *valid country abbreviation* |
+------------------+----------------------------------+
| temperature | -100.00 - 100.00 |
+------------------+----------------------------------+
| humitidy | 0.00 - 100.00 |
+------------------+----------------------------------+
| sunrise | 00.00 - 23.59 |
+------------------+----------------------------------+
| sunset | 00.00 - 23.59 |
+------------------+----------------------------------+
| sun | rise / set |
+------------------+----------------------------------+
| update | 0 - 1 |
+------------------+----------------------------------+
.. versionadded:: 8.0.7
+------------------+----------------------------------+
| **Option** | **Value** |
+------------------+----------------------------------+
| api | *valid openweathermap api key* |
+------------------+----------------------------------+
.. rubric:: Optional Settings
:underline:`Device Settings`
+--------------------+-------------+------------+---------------------------------------------+
| **Setting** | **Default** | **Format** | **Description** |
+--------------------+-------------+------------+---------------------------------------------+
| humidity-offset | 0 | number | Correct humidity value |
+--------------------+-------------+------------+---------------------------------------------+
| temperature-offset | 0 | number | Correct temperature value |
+--------------------+-------------+------------+---------------------------------------------+
| poll-interval | 86400 | seconds | What should be the poll interval of the API |
+--------------------+-------------+------------+---------------------------------------------+
:underline:`GUI Settings`
+----------------------+-------------+------------+----------------------------------------------------------------------+
| **Setting** | **Default** | **Format** | **Description** |
+----------------------+-------------+------------+----------------------------------------------------------------------+
| temperature-decimals | 2 | number | How many decimals the GUIs should display for temperature |
+----------------------+-------------+------------+----------------------------------------------------------------------+
| humidity-decimals | 2 | number | How many decimals the GUIs should display for humidity |
+----------------------+-------------+------------+----------------------------------------------------------------------+
| sunriseset-decimals | 2 | number | How many decimals the GUIs should display for sunrise/sunset time |
+----------------------+-------------+------------+----------------------------------------------------------------------+
| show-humidity | 1 | 1 or 0 | Don't display the humidity value |
+----------------------+-------------+------------+----------------------------------------------------------------------+
| show-temperature | 1 | 1 or 0 | Don't display the temperature value |
+----------------------+-------------+------------+----------------------------------------------------------------------+
| show-battery | 0 | 1 or 0 | Don't display the battery value |
+----------------------+-------------+------------+----------------------------------------------------------------------+
.. rubric:: Comment
#. Please notice that the open weather map interval cannot be less than 10 minutes (600 seconds) to respect open weather map traffic and policy
@@ -0,0 +1,138 @@
.. |yes| image:: ../../../images/yes.png
.. |no| image:: ../../../images/no.png
.. role:: underline
:class: underline
Sunriseset
==========
+------------------+-------------+
| **Feature** | **Support** |
+------------------+-------------+
| Sending | |no| |
+------------------+-------------+
| Receiving | |yes| |
+------------------+-------------+
| Config | |yes| |
+------------------+-------------+
.. rubric:: Supported Brands
*None*
.. rubric:: Sender Arguments
*None*
.. rubric:: Config
.. code-block:: json
:linenos:
{
"devices": {
"outside": {
"protocol": [ "sunriseset" ],
"id": [{
"longitude": 1.2345,
"latitude": 50.607080
}],
"sunrise": 7.00,
"sunset": 16.15,
"sun": "set"
}
},
"gui": {
"sun": {
"name": "Sunrise / Sunset",
"group": [ "Outside" ],
"media": [ "all" ]
}
}
}
+------------------+----------------------+
| **Option** | **Value** |
+------------------+----------------------+
| longitude | -180.0000 - 180.0000 |
+------------------+----------------------+
| latitude | -90.0000 - 90.0000 |
+------------------+----------------------+
| sunrise | 00.00 - 23.59 |
+------------------+----------------------+
| sunset | 00.00 - 23.59 |
+------------------+----------------------+
| sun | rise / set |
+------------------+----------------------+
.. rubric:: Optional Settings
:underline:`GUI Settings`
+----------------------+-------------+------------+----------------------------------------------------------------------+
| **Setting** | **Default** | **Format** | **Description** |
+----------------------+-------------+------------+----------------------------------------------------------------------+
| sunriseset-decimals | 2 | number | How many decimals the GUIs should display for sunrise/sunset time |
+----------------------+-------------+------------+----------------------------------------------------------------------+
| show-sunriseset | 0 | 1 or 0 | Don't display the sunrise /sunset |
+----------------------+-------------+------------+----------------------------------------------------------------------+
.. rubric:: Comment
The sunriseset will send three messages:
#. When the sunset time has been arrived.
#. When the sunrise time has been arrived.
#. After midnight so all values can be updated for a new day.
When using sunriseset in eventing, keep in mind of the following; The output of sunriseset.sunset and sunriseset.sunrise is just a number, so the time 17:00 equals 17.00. When using it in eventing make sure you get usable numbers. For example the time for sunriseset.sunset is 16:30
.. code-block:: guess
:linenos:
IF ((sunrisesetdev.sunset == (datetime.hour + (datetime.minute / 100))) AND datetime.second == 0) THEN .."
pilight will see this:
.. code-block:: guess
:linenos:
IF ((16.30 == (16 + (30 / 100))) AND 0 == 0) THEN ..."
The math pilight will use: 16.30 == 16.30
When you look at the result you will see that the datetime.minute 30 will give 0.30 in the used rule (in normal case divide minutes through 100)
Using the sunriseset.
Example
.. code-block:: guess
:linenos:
IF sunrisesetdev.sun IS set THEN ....
IF sunrisesetdev.sun IS rise THEN ....
Please note that with the three messages mentioned above, the first rule fires two times: At sunset, and at midnight (sunrisesetdev.sun is either set or rise, and will be set at midnight). So, it's better to use
.. code-block:: guess
:linenos:
IF (DATE_FORMAT(CurrentDateTime, %H.%M) == sunrisesetdev.sunset AND CurrentDateTime.second == 0) THEN ...
with CurrentDateTime as a ``datetime`` device.
.. rubric:: Notes
ntpserver has been removed from the sunriseset id. Instead, ntp-servers are defined in the settings section of config.json in an array like this:
.. code-block:: json
:linenos:
{
"ntp-servers": [ "0.nl.pool.ntp.org", "1.nl.pool.ntp.org", "..." ],
"ntp-sync": 1
}
Both the datetime and sunriseset protocol will use the ntp time to adjust their time when needed.
@@ -0,0 +1,119 @@
.. |yes| image:: ../../../images/yes.png
.. |no| image:: ../../../images/no.png
.. role:: underline
:class: underline
Weather Underground
===================
+------------------+-------------+
| **Feature** | **Support** |
+------------------+-------------+
| Sending | |no| |
+------------------+-------------+
| Receiving | |yes| |
+------------------+-------------+
| Config | |yes| |
+------------------+-------------+
.. rubric:: Supported Brands
*None*
.. rubric:: Sender Arguments
*None*
.. rubric:: Config
.. code-block:: json
:linenos:
{
"devices": {
"outside": {
"protocol": [ "wunderground" ],
"id": [{
"api": "1ihn472a6ea384jd",
"location": "amsterdam",
"country": "nl"
}],
"humidity": 76.00,
"temperature": 7.00,
"sunrise": 7.00,
"sunset": 16.15,
"sun": "set",
"update": 1
}
},
"gui": {
"outside": {
"name": "Temperature",
"group": [ "Outside" ],
"media": [ "all" ]
}
}
}
+------------------+--------------------------------------+
| **Option** | **Value** |
+------------------+--------------------------------------+
| api | *valid weather underground api key* |
+------------------+--------------------------------------+
| location | *valid weather underground location* |
+------------------+--------------------------------------+
| country | *valid country abbreviation* |
+------------------+--------------------------------------+
| temperature | -100.00 - 100.00 |
+------------------+--------------------------------------+
| humitidy | 0.00 - 100.00 |
+------------------+--------------------------------------+
| sunrise | 00.00 - 23.59 |
+------------------+--------------------------------------+
| sunset | 00.00 - 23.59 |
+------------------+--------------------------------------+
| sun | rise / set |
+------------------+--------------------------------------+
| update | 0 - 1 |
+------------------+--------------------------------------+
.. rubric:: Optional Settings
:underline:`Device Settings`
+--------------------+-------------+------------+---------------------------------------------+
| **Setting** | **Default** | **Format** | **Description** |
+--------------------+-------------+------------+---------------------------------------------+
| humidity-offset | 0 | number | Correct humidity value |
+--------------------+-------------+------------+---------------------------------------------+
| temperature-offset | 0 | number | Correct temperature value |
+--------------------+-------------+------------+---------------------------------------------+
| poll-interval | 86400 | seconds | What should be the poll interval of the API |
+--------------------+-------------+------------+---------------------------------------------+
:underline:`GUI Settings`
+----------------------+-------------+------------+----------------------------------------------------------------------+
| **Setting** | **Default** | **Format** | **Description** |
+----------------------+-------------+------------+----------------------------------------------------------------------+
| temperature-decimals | 2 | number | How many decimals the GUIs should display for temperature |
+----------------------+-------------+------------+----------------------------------------------------------------------+
| humidity-decimals | 2 | number | How many decimals the GUIs should display for humidity |
+----------------------+-------------+------------+----------------------------------------------------------------------+
| sunriseset-decimals | 2 | number | How many decimals the GUIs should display for sunrise/sunset time |
+----------------------+-------------+------------+----------------------------------------------------------------------+
| show-humidity | 1 | 1 or 0 | Don't display the humidity value |
+----------------------+-------------+------------+----------------------------------------------------------------------+
| show-temperature | 1 | 1 or 0 | Don't display the temperature value |
+----------------------+-------------+------------+----------------------------------------------------------------------+
| show-battery | 0 | 1 or 0 | Don't display the battery value |
+----------------------+-------------+------------+----------------------------------------------------------------------+
.. rubric:: Comment
#. Please notice that the weather underground interval cannot be less than 15 minutes due to daily polling restrictions.
#. This restriction also counts for the update button in the webgui. You won't receive updates within the 15 minutes between two updates.
#. This wiki page shows a random API key. Please register yourself at wunderground.com to get your own.