Skip to content

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

License

ascillato/Tasmota_KNX

 
 

Repository files navigation

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:

  • v2.7.4.7 Works fine. No known issues. (RECOMMENDED) (Support for old libraries have been dropped)

Esp32 board libraries:

  • v1.0.4.2 Works fine. No known issues. (RECOMMENDED) (Support for old libraries have been dropped)

Firmware

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

  • Latest Release
  • Latest development version from Build_Output folder.
  • Or if you need any other feature enabled or disabled, or a different Arduino core, you can use TasmoCompiler (readme) or you can modify the my_user_config.h file and build your firmware as explained in the docs.

Implemented Features

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

General:

  • Buttons (just push)
  • Relays (on/off/toggle)
  • Lights (led strips, etc. but just on/off)

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

  • Temperature
  • Humidity
  • Energy (v, i, power)

Features that can be used with Tasmota's rules:

  • Send KNX command (on/off)
  • Receive KNX command (on/off)
  • Send values by KNX (any float type, temperature for example)
  • Receive values by KNX (any float type, temperature for example)
  • Send KNX Scenes (on/off)
  • Receive KNX Scenes (on/off)
  • Receive a KNX read request
  • View/Set the Physical Address
  • View/Set Group Address to send data
  • View/Set Group Address to receive data

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 the KNX Menu, can be set a Group Address to send data or commands by rules, as KNX TX1 to KNX TX5

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 the KNX Menu can be set a Group Address to receive commands by rules as KNX RX1 to KNX RX5

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:

  • Add Web Menu
  • Add Feature to Receive telegrams and modify Relay Status
  • Add Feature to Receive telegrams from multiple Group Addresses to modify just one relay status (useful for scenes)
  • Add Feature to Send telegrams of relay status change
  • Add Feature to Send telegrams of one relay status to multiple Group Addresses (useful for scenes)
  • Add Feature to Send telegrams of button pressed
  • Add Feature to receive telegrams to toggle relay status
  • Add Feature to read Temperature, Humidity from Tasmota
  • Add Feature to send Temperature, Humidity by a set interval (tasmota teleperiod)
  • Add Feature to receive command to read temperature, Humidity
  • Add Feature to recognize Tasmota config to show the same number of relays, buttons, etc.
  • Add Feature to Save Config
  • Add Feature to Load Config
  • Add Log Info
  • Complete all the language files with keys
  • Add support for other output devices supported by Tasmota
  • Add support for other sensors supported by Tasmota (TEMP, HUM, ENERGY)
  • Add commands for rules to send values and commands by KNX
  • Add commands for rules to set KNX Configurations
  • Add events for rules when receiving data from KNX and read requests
  • Add option for increase communication reliability (re send telegrams)
  • Add Scenes support
  • Add Dimmer support
  • Add Color support
  • Add Shutters support
  • Optimize code to reduce Flash and RAM - Refactor Driver and Library
  • Add option to support ETS Programming
  • Add option for KNXnet/IP Tunneling

Modifications to Tasmota

  • Added the file /tasmota/xdrv_11_KNX.ino
  • Added the entries #define USE_KNX and #define USE_KNX_WEB_MENU on /tasmota/my_user_config.h
  • Added entries to the file /tasmota/xdrv_01_webserver.ino
  • Added entries to the file /tasmota/tasmota.ino
  • Added entries to the file /tasmota/tasmota.h
  • Added entries to the file /tasmota/settings.h
  • Added entries to the file /tasmota/support.ino
  • Added entries to sensor files
  • Added entries to language files

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

  • ascillato ( Adrian Scillato )
  • sisamiwe - Thanks for the guide on using KNX and software testing and support
  • envy ( Nico Weichbrodt ) - Thanks for the patience and help with the modifications to ESP_KNX_IP.
  • arendst ( Theo Arends ) - Thanks for the guide on Tasmota and for the ideas.
  • johannesbonn - Thanks for the patience on bug resolutions
  • RocketSience - Thanks for the patience on bug resolutions
  • jeylites - Thanks for the patience on bug resolutions
  • Winni66 - Thanks for the patience on bug resolutions
  • misc2000 - Thanks for the testing on bug resolutions
  • mizrachiran ( Ran Mizrachi ) - Thanks for the testing on bug resolutions
  • smurfix ( Matthias Urlichs ) - Thanks for the KNX guiding and KNXd use.
  • And many others providing testing, bug reporting and feature requests.

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

⚠️ DANGER OF ELECTROCUTION ⚠️

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:

  • For ESP8285 based devices only Flash Mode DOUT is supported. Do not use Flash Mode DIO / QIO / QOUT as it might seem to brick your device.
  • For ESP8285 based devices Tasmota uses a 1M linker script WITHOUT spiffs 1M (no SPIFFS) for optimal code space.
  • To make compile time changes to Tasmota use the user_config_override.h file. It assures keeping your custom settings when you download and compile a new version. You have to make a copy from the provided user_config_override_sample.h file and add your setting overrides.

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

  • Tasmota Discussions: For Tasmota usage questions, Feature Requests and Projects.
  • Tasmota Users Chat: For support, troubleshooting and general questions. You have better chances to get fast answers from members of the Tasmota Community.
  • Search in Issues: You might find an answer to your question by searching current or closed issues.
  • Software Problem Report: For reporting problems of Tasmota Software.

Contribute

You can contribute to Tasmota by

  • Providing Pull Requests (Features, Proof of Concepts, Language files or Fixes)
  • Testing new released features and report issues
  • Donating to acquire hardware for testing and implementing or out of gratitude
  • Contributing missing documentation for features and devices

donate

Credits

People helping to keep the show on the road:

  • David Lang providing initial issue resolution and code optimizations
  • Heiko Krupp for his IRSend, HTU21, SI70xx and Wemo/Hue emulation drivers
  • Wiktor Schmidt for Travis CI implementation
  • Thom Dietrich for PlatformIO optimizations
  • Marinus van den Broek for his EspEasy groundwork
  • Pete Ba for more user friendly energy monitor calibration
  • Lobradov providing compile optimization tips
  • Flexiti for his initial timer implementation
  • reloxx13 for his TasmoAdmin management tool
  • Joachim Banzhaf for his TSL2561 library and driver
  • Andre Thomas for providing many drivers
  • Gijs Noorlander for his MHZ19, SenseAir and updated PubSubClient drivers
  • Erik Montnemery for his HomeAssistant Discovery concept and many code tuning tips
  • Federico Leoni for continued HomeAssistant Discovery support
  • Aidan Mountford for his HSB support
  • Daniel Ztolnai for his Serial Bridge implementation
  • Gerhard Mutz for multiple sensor & display drivers, Sunrise/Sunset, and scripting
  • Nuno Ferreira for his HC-SR04 driver
  • Adrian Scillato for his (security)fixes and implementing and maintaining KNX
  • Gennaro Tortone for implementing and maintaining Eastron drivers
  • Raymond Mouthaan for managing Wemos Wiki information
  • Norbert Richter for his decode-config.py tool
  • Joel Stein, digiblur and Shantur Rathore for their Tuya research and driver
  • Frogmore42 for providing many issue answers
  • Jason2866 for platformio support and providing many issue answers
  • Blakadder for managing the new document site and providing template management
  • Stephan Hadinger for refactoring light driver, enhancing HueEmulation and Zigbee support
  • tmo for designing the official Tasmota logo
  • Stefan Bode for his Shutter and Deep sleep drivers
  • Jacek Ziółkowski for his TDM management tool and Tasmotizer flashing tool
  • Christian Staars for NRF24L01 and HM-10 Bluetooth sensor support
  • Paul Diem for UDP Group communication support
  • Jörg Schüler-Maroldt for his initial ESP32 port
  • Javier Arigita for his thermostat driver
  • Many more providing Tips, Wips, Pocs, PRs and Donations

License

This program is licensed under GPL-3.0

About

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

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages

  • C 65.4%
  • HTML 17.6%
  • C++ 16.1%
  • Python 0.4%
  • TeX 0.2%
  • JavaScript 0.1%
  • Other 0.2%