ascillato / Tasmota_KNX

Alternative Firmware for 'ESP8266, ESP8285 and ESP32 based devices' like Itead Sonoff, Shelly or NodeMCU, with Web, Timers, OTA, MQTT, KNX, Rules and Sensors' Support, to be used on Smart Home Systems. Written for PlatformIO. Documentation at
http://tasmota.com
GNU General Public License v3.0
44 stars 11 forks source link
arduino automation esp32 esp8266 firmware hacktoberfest iot knx mqtt ota platformio shelly smart-home sonoff tasmota

Tasmota KNX Tasmota Build Gitpod Ready-to-Code

Logo

Tasmota_KNX was a modification for Tasmota to add a basic functionality of the KNX IP Protocol (Multicast). Now it is integrated in Tasmota!

GitHub version GitHub download License donate

This repository is for developing new KNX features for Tasmota.

If you like Tasmota KNX, give it a star or fork it and contribute! GitHub stars

Any help or comment is very welcome.

Table of Contents

KNX Explanation

The KNX IP Protocol is an international open standard for smart homes and smart buildings automation. It is a decentralized system. Each device can talk directly to each other without the need of a central controller or server. Any panel or server is just for telesupervision and for sending requests. KNX IP Protocol uses a UDP multicast on 224.0.23.12 : 3671, so there is no need for a KNX Router unless you want to communicate to KNX Devices that are not in the WIFI Network (Twisted Pair, RF, Powerline).

Each device has a physical address (like a fixed IP) as 1 . 1 . 0 and that address is used for configuration purposes.

Each device can be configured with group addresses as 2 / 2 / 1 and that address can be used for sending/receiving commands. So, for example, if 2 devices that are configured with the 2 / 2 / 1 for turning on/off their outputs, and other device send Turn ON command to 2 / 2 / 1, both devices will turn on their outputs.

Integration

Several home automation systems have KNX support. For example, Home Assistant has a XKNX Python Library to connect to KNX devices using a KNX Router. If you don't have a KNX Router, you can use a Software KNX Router like KNXd on the same Raspberry Pi than Home Assistant. KNXd is used by Home Assistant for reading this UDP Multicast, although KNXd has other cool features that need extra hardware like connect to KNX devices by Twister Pair, Power Line or RF.

If using the Home Assistant distribution called Hassio, everything for KNX is already included by default.

If you use the ETS (KNX Configurator Software) you can add any Tasmota KNX as a dummy device.

Requirements

All the libraries required for Tasmota are here along with the extra required for the KNX Driver:

Esp8266 board libraries:

Esp32 board libraries:

Firmware

You can download the precompiled binaries for flashing ESP8266, ESP8285 and ESP32 devices from:

Implemented Features

The implemented features (up to now) in KNX for Tasmota are:

General:

Sensor lists that you can use in KNX is (only one sensor per type):

Features that can be used with Tasmota's rules:

Usage Examples

There are multiple possible configurations. Here are explained just a few as example. The options for selecting relays, buttons, sensors, etc. are only available if were configured on Configure Module Menu.

To configure KNX, enter on the Configuration Menu of Tasmota and select Configure KNX.

Note on KNX communication enhancement option: As Wifi Multicast communication is not reliable in some wifi router due to IGMP problems or Snooping, an enhancement was implemented. This option increase the reliability by reducing the chances of losing telegrams, sending the same telegram 3 times. In practice it works really good and it is enough for normal home use. When this option is on, Tasmota will ignore toggle commands by KNX if those are sent more than 1 toggle per second. Just 1 toggle per second is working fine.

1) Setting Several Tasmotas to be controlled as one by a Home Automation System:

We can set one of the group address to be the same in all the devices so as to turn them on or off at the same time. In this case, so as to inform the status of all the relays to the Automation System, just one of the devices have to be configured as the responder. If you use the same Group Address for sending and receiving, you have to take into account not to make loops.

DEVICE 1

DEVICE 2

2) Setting 2 Tasmotas to be linked as stair lights:

We can set one device to send the status of its output and another to read that and follow. And the second device can send the status of its button and the first device will toggle. With this configuration we can avoid to make a loop.

DEVICE 1

DEVICE 2

3) Setting a button as initiator of a scene:

Just setting one device to send the push of a button, and the rest just use that value to turn them on. In this case, there is no toggle. Every time the button is pushed, the turn on command is sent.

DEVICE 1

DEVICE 2

4) Setting a Temperature sensor:

We can configure to send the value of temperature or humidity every teleperiod. This teleperiod can be configured. See Tasmota wiki. It is recommended also to set the reply temperature address.

5) Using rules:

More functionality can be added to Tasmota using rules.

In rules we can use the command KnxTx_Cmnd1 1 to send an ON state command to the group address set in KNX TX1 slot of the KNX menu. Also, we can use the command KnxTx_Val1 15 to send a 15 value to the group address set in KNX TX1 slot of the KNX menu.

In rules we can use the events to catch the reception of COMMANDS from KNX to those RX Slots.

Example: rule on event#knxrx_cmnd1 do var1 %value% endon to store the command received in the variable VAR1

In rules we can use the events to catch the reception of VALUES from KNX to those RX Slots.

Example: rule on event#knxrx_val1 do var1 %value% endon to store the value received in the variable VAR1

Also, if a Read request is received from KNX Network, we can use that in a rule as for example: rule on event#knxrx_req1 do knxtx_val1 %var3% endon

Console Commands

Command Payload Description
KnxTx_Cmnd\<x> 0 / 1 Send KNX Commands using the Group Address set on KNX Menu at KNX_TX\<x> slot
KnxTx_Val\<x> value Send KNX float values using the Group Address set on KNX Menu at KNX_TX\<x> slot
KNX_ENABLED View Status of KNX Communications
0 / 1 0 - Set Disable to KNX Communications / 1 - Set Enable to KNX Communications
KNX_ENHANCED View Status of Enhanced mode for KNX Communications
0 / 1 0 - Set to Disable / 1 - Set to Enable Enhanced KNX Communications Mode
KNX_PA View the device KNX Physical Address (0.0.0 means not set)
\<x>.\<x>.\<x> Set the device KNX Physical Address (like 1.1.0)
KNX_GA View the number of Group Address Configured to Send Data/Commands
\<x> View the configuration for the Group Address number x Send Data/Commands
KNX_GA\<x> \<y>,\<z>,\<z>,\<z> Set the Group Address number \<x> to Send Data/Commands
\<y> is the parameter OPTION to send its status to the Group Address
\<z>,\<z>,\<z> is the Group Address number to Send Data/Commands
KNX_CB View the number of Group Address Configured to Receive Data/Commands
\<x> View the configuration for the Group Address number x to Receive Data/Commands
KNX_CB\<x> \<y>,\<z>,\<z>,\<z> Set the Group Address number \<x> to ReceiveData/Commands
\<y> is the parameter OPTION to Receive its status from the Group Address
\<z>,\<z>,\<z> is the Group Address number to Receive Data/Commands

Posible values for the parameter OPTION:

OPTION Value Device Parameter
1 Relay 1
2 Relay 2
3 Relay 3
4 Relay 4
5 Relay 5
6 Relay 6
7 Relay 7
8 Relay 8
9 Button 1
10 Button 2
11 Button 3
12 Button 4
13 Button 5
14 Button 6
15 Button 7
16 Button 8
17 TEMPERATURE
18 HUMIDITY
19 ENERGY_VOLTAGE
20 ENERGY_CURRENT
21 ENERGY_POWER
22 ENERGY_POWERFACTOR
23 ENERGY_DAILY
24 ENERGY_START
25 ENERGY_TOTAL
26 KNX_SLOT1
27 KNX_SLOT2
28 KNX_SLOT3
29 KNX_SLOT4
30 KNX_SLOT5
31 KNX_SCENE
255 EMPTY

Development Road Map

For Tasmota_KNX:

Modifications to Tasmota

Up to now, enabling KNX uses +9.4 KB of code and +3.7 KB of memory for Tasmota. If it is enabled also the KNX Web Menu, it adds +8.3 KB more of code and +144 Bytes more of memory.

There is NO CONFLICT with MQTT, Home Assistant, Web, etc. Tests show fast response of all features running at same time.

Contributors


Tasmota Readme

Tasmota logo

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Written for PlatformIO with limited support for Arduino IDE.

GitHub version GitHub download License Chat Gitpod Ready-to-Code

If you like Tasmota, give it a star, or fork it and contribute!

GitHub stars GitHub forks donate

See RELEASENOTES.md for release information.

In addition to the release webpage the binaries can also be downloaded from http://ota.tasmota.com/tasmota/release/

Development

Dev Version Download Dev Tasmota CI Tasmota ESP32 CI Build_firmware

See CHANGELOG.md for detailed change information.

Unless your Tasmota powered device exhibits a problem or you need to make use of a feature that is not available in the Tasmota version currently installed on your device, leave your device alone - it works so don't make unnecessary changes! If the release version (i.e., the master branch) exhibits unexpected behaviour for your device and configuration, you should upgrade to the latest development version instead to see if your problem is resolved as some bugs in previous releases or development builds may already have been resolved.

Every commit made to the development branch, which is compiling successfuly, will post new binary files at http://ota.tasmota.com/tasmota/ (this web address can be used for OTA updates too). It is important to note that these binaries are based on the current development codebase. These commits are tested as much as is possible and are typically quite stable. However, it is infeasible to test on the hundreds of different types of devices with all the available configuration options permitted.

Note that there is a chance, as with any upgrade, that the device may not function as expected. You must always account for the possibility that you may need to flash the device via the serial programming interface if the OTA upgrade fails. Even with the master release, you should always attempt to test the device or a similar prototype before upgrading a device which is in production or is hard to reach. And, as always, make a backup of the device configuration before beginning any firmware update.

Disclaimer

:warning: DANGER OF ELECTROCUTION :warning:

If your device connects to mains electricity (AC power) there is danger of electrocution if not installed properly. If you don't know how to install it, please call an electrician (Beware: certain countries prohibit installation without a licensed electrician present). Remember: SAFETY FIRST. It is not worth the risk to yourself, your family and your home if you don't know exactly what you are doing. Never tinker or try to flash a device using the serial programming interface while it is connected to MAINS ELECTRICITY (AC power).

We don't take any responsibility nor liability for using this software nor for the installation or any tips, advice, videos, etc. given by any member of this site or any related site.

Note

Please do not ask to add new devices unless it requires additional code for new features. If the device is not listed as a module, try using Templates first. If it is not listed in the Tasmota Device Templates Repository create your own Template.

Quick Install

Download one of the released binaries from https://github.com/arendst/Tasmota/releases and flash it to your hardware using our installation guide.

Important User Compilation Information

If you want to compile Tasmota yourself keep in mind the following:

Configuration Information

Please refer to the installation and configuration articles in our documentation.

Migration Information

See wiki migration path for instructions how to migrate to a major version. Pay attention to the following version breaks due to dynamic settings updates:

  1. Migrate to Sonoff-Tasmota 3.9.x
  2. Migrate to Sonoff-Tasmota 4.x
  3. Migrate to Sonoff-Tasmota 5.14
  4. Migrate to Sonoff-Tasmota 6.7.1 (http://ota.tasmota.com/tasmota/release-6.7.1/)
  5. Migrate to Tasmota 7.2.0 (http://ota.tasmota.com/tasmota/release-7.2.0/)

--- Major change in parameter storage layout ---

  1. Migrate to Tasmota 8.5.1 (http://ota.tasmota.com/tasmota/release-8.5.1/)

--- Major change in internal GPIO function representation ---

  1. Migrate to Tasmota 9.1 (http://ota.tasmota.com/tasmota/release-9.1.0/)

While fallback or downgrading is common practice it was never supported due to Settings additions or changes in newer releases. Starting with version v9.0.0.1 the internal GPIO function representation has changed in such a way that fallback is only possible to the latest GPIO configuration before installing v9.0.0.1.

Support Information

For a database of supported devices see Tasmota Device Templates Repository

If you're looking for support on Tasmota there are some options available:

Documentation

Support's Community

Contribute

You can contribute to Tasmota by

donate

Credits

People helping to keep the show on the road:

License

This program is licensed under GPL-3.0