From ae3f8d0535938fcb6bda23ec63e0a464e1d80b80 Mon Sep 17 00:00:00 2001 From: Adrian Scillato <35405447+ascillato@users.noreply.github.com> Date: Tue, 12 Jun 2018 14:17:02 -0300 Subject: [PATCH 1/3] KNX: Support for DS18S20 Temperature sensor --- sonoff/xdrv_11_knx.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sonoff/xdrv_11_knx.ino b/sonoff/xdrv_11_knx.ino index 50c71c625..72102fe99 100644 --- a/sonoff/xdrv_11_knx.ino +++ b/sonoff/xdrv_11_knx.ino @@ -462,6 +462,7 @@ void KNX_INIT() if (GetUsedInModule(GPIO_DHT11, my_module.gp.io)) { device_param[KNX_TEMPERATURE-1].show = true; } if (GetUsedInModule(GPIO_DHT22, my_module.gp.io)) { device_param[KNX_TEMPERATURE-1].show = true; } if (GetUsedInModule(GPIO_SI7021, my_module.gp.io)) { device_param[KNX_TEMPERATURE-1].show = true; } + if (GetUsedInModule(GPIO_DSB, my_module.gp.io)) { device_param[KNX_TEMPERATURE-1].show = true; } if (GetUsedInModule(GPIO_DHT11, my_module.gp.io)) { device_param[KNX_HUMIDITY-1].show = true; } if (GetUsedInModule(GPIO_DHT22, my_module.gp.io)) { device_param[KNX_HUMIDITY-1].show = true; } if (GetUsedInModule(GPIO_SI7021, my_module.gp.io)) { device_param[KNX_HUMIDITY-1].show = true; } @@ -547,7 +548,7 @@ void KNX_CB_Action(message_t const &msg, void *arg) { if (!toggle_inhibit) { char command[25]; - snprintf_P(command, sizeof(command), PSTR("event KNXRX_VAL%d=%d"), ((chan->type) - KNX_SLOT1 + 1 ), msg.data[0]); + snprintf_P(command, sizeof(command), PSTR("event KNXRX_CMND%d=%d"), ((chan->type) - KNX_SLOT1 + 1 ), msg.data[0]); ExecuteCommand(command, SRC_KNX); if (Settings.flag.knx_enable_enhancement) { toggle_inhibit = TOGGLE_INHIBIT_TIME; From 51d09680aa098637115ba7c7036fff412cf1b25e Mon Sep 17 00:00:00 2001 From: Adrian Scillato <35405447+ascillato@users.noreply.github.com> Date: Tue, 12 Jun 2018 14:35:48 -0300 Subject: [PATCH 2/3] Update _releasenotes.ino --- sonoff/_releasenotes.ino | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sonoff/_releasenotes.ino b/sonoff/_releasenotes.ino index 318fff236..b93214e5d 100644 --- a/sonoff/_releasenotes.ino +++ b/sonoff/_releasenotes.ino @@ -1,4 +1,6 @@ /* 6.0.0a + * KNX: Support for DS18S20 Temperature sensor + * KNX: Fixed Bug when doing reply of sensors values * Add CRC to Settings making future upgrades more fail-safe * Add support for uploading Sonoff Bridge firmware found in tools/fw_efm8bb1 folder build by Portisch using Web Gui File Upload (#2886) * Add support for I2C temperature sensor LM75AD (#2909) @@ -17,10 +19,11 @@ where [slot] is any of the 5 slots on the KNX Menu and value is a number example: KnxTx_Val1 35 * Add Slots on the KNX Web Menu to select Group Addess to send data from console commands - * Add Events to trigger rules when received data from KNX - usage on rules as: event#KnxRx_Val[slot] + * Add Events to trigger rules when a command is received from KNX + usage on rules as: event#KnxRx_Cmnd[slot] where [slot] is any of the 5 slots on the KNX Menu - example: rule on event#KnxRx_Val1 do VAR1 %value% endon + example: rule on event#KnxRx_Cmnd1 do VAR1 %value% endon + (where %value% can be 0 or 1) * Add Events to trigger rules when received read requests from KNX usage on rules as: event#KnxRx_Req[slot] where [slot] is any of the 5 slots on the KNX Menu From d80e3a928d72faa3cafea505638cae1a7ab507a6 Mon Sep 17 00:00:00 2001 From: ascillato Date: Tue, 12 Jun 2018 14:46:52 -0300 Subject: [PATCH 3/3] KNX: Support for DS18S20 Temperature sensor --- sonoff/xsns_05_ds18b20.ino | 5 +++++ sonoff/xsns_05_ds18x20.ino | 5 +++++ sonoff/xsns_05_ds18x20_legacy.ino | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/sonoff/xsns_05_ds18b20.ino b/sonoff/xsns_05_ds18b20.ino index 753fafeca..dabaf25d4 100644 --- a/sonoff/xsns_05_ds18b20.ino +++ b/sonoff/xsns_05_ds18b20.ino @@ -199,6 +199,11 @@ void Ds18b20Show(boolean json) #ifdef USE_DOMOTICZ if (0 == tele_period) DomoticzSensor(DZ_TEMP, temperature); #endif // USE_DOMOTICZ +#ifdef USE_KNX + if (0 == tele_period) { + KnxSensor(KNX_TEMPERATURE, t); + } +#endif // USE_KNX #ifdef USE_WEBSERVER } else { snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, "DS18B20", temperature, TempUnit()); diff --git a/sonoff/xsns_05_ds18x20.ino b/sonoff/xsns_05_ds18x20.ino index b99c71298..292191b18 100644 --- a/sonoff/xsns_05_ds18x20.ino +++ b/sonoff/xsns_05_ds18x20.ino @@ -385,6 +385,11 @@ void Ds18x20Show(boolean json) domoticz_flag = false; } #endif // USE_DOMOTICZ +#ifdef USE_KNX + if ((0 == tele_period) && (0 == i)) { + KnxSensor(KNX_TEMPERATURE, t); + } +#endif // USE_KNX #ifdef USE_WEBSERVER } else { snprintf_P(mqtt_data, sizeof(mqtt_data), HTTP_SNS_TEMP, mqtt_data, (1 == ds18x20_sensors) ? ds18x20_types : stemp, temperature, TempUnit()); diff --git a/sonoff/xsns_05_ds18x20_legacy.ino b/sonoff/xsns_05_ds18x20_legacy.ino index 885ce7540..156312104 100644 --- a/sonoff/xsns_05_ds18x20_legacy.ino +++ b/sonoff/xsns_05_ds18x20_legacy.ino @@ -192,6 +192,11 @@ void Ds18x20Show(boolean json) DomoticzSensor(DZ_TEMP, temperature); } #endif // USE_DOMOTICZ +#ifdef USE_KNX + if ((0 == tele_period) && (1 == dsxflg)) { + KnxSensor(KNX_TEMPERATURE, t); + } +#endif // USE_KNX #ifdef USE_WEBSERVER } else { snprintf_P(stemp, sizeof(stemp), PSTR("%s-%d"), ds18x20_types, i +1);