From 69c7b017f89993e088fa8cc6ea08620d3888d9cf Mon Sep 17 00:00:00 2001 From: Jens Maus Date: Wed, 13 Nov 2024 14:40:54 +0100 Subject: [PATCH] add new 0192-WebUI-Fix-IncorrectTagClosure WebUI bugfix patch fixing certain tag closure typos (fixes #2913). --- .../0192-WebUI-Fix-IncorrectTagClosure.patch | 173 + .../www/config/easymodes/etc/hmip_helper.tcl | 2970 +++++++++++++++++ .../config/easymodes/etc/hmip_helper.tcl.orig | 2970 +++++++++++++++++ 3 files changed, 6113 insertions(+) create mode 100644 buildroot-external/patches/occu/0192-WebUI-Fix-IncorrectTagClosure.patch create mode 100755 buildroot-external/patches/occu/0192-WebUI-Fix-IncorrectTagClosure/occu/WebUI/www/config/easymodes/etc/hmip_helper.tcl create mode 100755 buildroot-external/patches/occu/0192-WebUI-Fix-IncorrectTagClosure/occu/WebUI/www/config/easymodes/etc/hmip_helper.tcl.orig diff --git a/buildroot-external/patches/occu/0192-WebUI-Fix-IncorrectTagClosure.patch b/buildroot-external/patches/occu/0192-WebUI-Fix-IncorrectTagClosure.patch new file mode 100644 index 0000000000..0581a7eb2a --- /dev/null +++ b/buildroot-external/patches/occu/0192-WebUI-Fix-IncorrectTagClosure.patch @@ -0,0 +1,173 @@ +--- occu/WebUI/www/config/easymodes/etc/hmip_helper.tcl.orig ++++ occu/WebUI/www/config/easymodes/etc/hmip_helper.tcl +@@ -117,7 +117,7 @@ + append s "" + append s "" + append s "" +- append s "/" + + if {$paramType == "eventDelay"} { + append s " [getHelpIcon EVENT_DELAY 450 75]" +@@ -282,7 +282,7 @@ + append s "" + append s "" + append s "" +- append s "/" + + if {$paramType == "eventDelay"} { + append s " [getHelpIcon EVENT_DELAY 450 75]" +@@ -442,7 +442,7 @@ + append s "" + append s "" + append s "" +- append s "/" + append s "" + + append s "" + + return $s +} + +proc getPanelB {prn pref specialElement {paramType ""}} { + set s "" + append s "" + append s "" + + if {$paramType == "eventDelay"} { + append s " [getHelpIcon EVENT_DELAY 450 75]" + } + + if {$paramType == "eventRandomTime"} { + append s " [getHelpIcon EVENT_RANDOMTIME 450 75]" + } + + append s "" + + append s "" + + return $s +} + + + +proc getDelayShort {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s +} + +proc getDelayShortA {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s +} + +proc getEventFilterTime {prn pref specialElement} { + set helpEvemtFilterTime EVENT_FILTER_TIME + set s "" + append s "" + append s "  " + + append s [getHelpIcon $helpEvemtFilterTime] + + append s "" + + append s "" + + return $s +} + +proc getDelay0to20M_step2M {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s +} + +proc getDelay {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s + +} + +proc getTimeOnOffShort {prn pref specialElement {extraparam ""}} { + set s "" + append s "" + append s "" + append s "" + + append s "" + return $s +} + +# Returns a option list with values for the ontime delay, offtime delay and so on +proc getTimeOnOff {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + return $s +} + +proc getRampOnOff {prn pref specialElement {extraparam ""}} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s +} + +proc getSwitchingInterval {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s +} + +proc getInterval_1D_7D_14D_28D {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s +} + +proc getSwitchingIntervalOnTime {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s +} + +## START ## + +proc getAutoInterval {prn pref specialElement} { + set s "" + append s "" + append s "" + + append s " [getHelpIcon AUTO_SENSOR_CLEANING 600 150]" + + append s "" + + append s "" + + return $s +} + +## END ## + +proc getBlindRunningTime {prn pref specialElement} { + set helpRunningTime BLIND_REFERENCE_RUNNING_TIME + + set s "" + append s "" + append s " " + append s [getHelpIcon $helpRunningTime] + append s "" + + append s "" + + return $s +} + +proc getSlatRunningTime {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s +} + +proc getMin_10_15_20_25_30 {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s +} + +proc getAlarmTimeMax10Min {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s +} + +proc getBlink {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s +} + +## + +proc trimParam {param} { + set s [string trimleft $param '] + set s [string trimright $s '] + return $s +} + +proc getEventFilterNumber {param value chn prn special_input_id {extraparam ""}} { + set param [trimParam $param] + set elemId 'separate_$special_input_id\_$prn' + set j_elemId '#separate_$special_input_id\_$prn' + set s "" + append s "\${[getDescription $param\_A $extraparam]}" + append s "" + append s "" + append s "" + append s "" + append s "" + return $s +} + +proc getTimeUnitComboBox {param value chn prn special_input_id {extraparam ""}} { + set param [trimParam $param] + set elemId 'separate_$special_input_id\_$prn' + set j_elemId '#separate_$special_input_id\_$prn' + + set s "" + append s "\${[getDescription $param $extraparam]}" + append s "" + append s "" + append s "" + append s "" + append s "" + return $s +} + +proc getTimeUnitComboBoxB {param value chn prn special_input_id {extraparam ""}} { + set param [trimParam $param] + set elemId 'separate_$special_input_id\_$prn' + set j_elemId '#separate_$special_input_id\_$prn' + + set s "" + append s "\${[getDescription $param $extraparam]}" + append s "" + append s "" + append s "" + append s "" + append s "" + return $s +} + +proc getTimeUnitComboBoxC {param value chn prn special_input_id {extraparam ""}} { + set param [trimParam $param] + set elemId 'separate_$special_input_id\_$prn' + set j_elemId '#separate_$special_input_id\_$prn' + + set s "" + append s "\${[getDescription $param $extraparam]}" + append s "" + append s "" + append s "" + append s "" + append s "" + return $s +} + +proc getTimeUnitComboBoxD {param value chn prn special_input_id {extraparam ""}} { + set param [trimParam $param] + set elemId 'separate_$special_input_id\_$prn' + set j_elemId '#separate_$special_input_id\_$prn' + + set s "" + append s "\${[getDescription $param $extraparam]}" + append s "" + append s "" + append s "" + append s "" + append s "" + return $s +} + +proc getTimeUnitComboBoxShort {param value chn prn special_input_id {extraparam ""}} { + set param [trimParam $param] + set elemId 'separate_$special_input_id\_$prn' + set j_elemId '#separate_$special_input_id\_$prn' + + set trName "" + set specialVal0 "" + set specialVal1 "" + + if {[string equal $extraparam ""] != 1} { + set specialVal0 [lindex [split $extraparam =] 0] + set specialVal1 [lindex [split $extraparam =] 1] + + if {[string equal $specialVal0 "trNAME"] != -1 } { + set trName name=$specialVal1 + } + } + + set s "" + append s "\${[getDescription $param $extraparam]}" + append s "" + append s "" + append s "" + append s "" + append s "" + return $s +} + +proc getTimeUnitComboBoxShortwoHour {param value chn prn special_input_id {extraparam ""}} { + set param [trimParam $param] + set elemId 'separate_$special_input_id\_$prn' + set j_elemId '#separate_$special_input_id\_$prn' + + set trName "" + set specialVal0 "" + set specialVal1 "" + + if {[string equal $extraparam ""] != 1} { + set specialVal0 [lindex [split $extraparam =] 0] + set specialVal1 [lindex [split $extraparam =] 1] + + if {[string equal $specialVal0 "trNAME"] != -1 } { + set trName name=$specialVal1 + } + } + + set s "" + append s "\${[getDescription $param $extraparam]}" + append s "" + append s "" + append s "" + append s "" + append s "" + return $s +} + +proc getTimeUnit10ms_100ms_1s_10s {param value chn prn special_input_id {extraparam ""}} { + set param [trimParam $param] + set elemId 'separate_$special_input_id\_$prn' + set j_elemId '#separate_$special_input_id\_$prn' + + set s "" + append s "\${[getDescription $param $extraparam]}" + append s "" + append s "" + append s "" + append s "" + append s "" + return $s +} + +proc getDescription {param {extraparam ""}} { + set result $param + set desc(REPEATED_LONG_PRESS_TIMEOUT_UNIT) "stringTableKeyLongPressTimeOutUnit" + set desc(EVENT_DELAY_UNIT) "stringTableEventDelayUnit" + set desc(EVENT_RANDOMTIME_UNIT) "stringTableEventRandomTimeUnit" + set desc(POWER_OFFDELAY_UNIT) "stringTableOffDelayUnit" + set desc(POWERUP_ONDELAY_UNIT) "stringTableOnDelayUnit" + set desc(POWERUP_OFFDELAY_UNIT) "stringTableOffDelayUnit" + set desc(POWERUP_ONTIME_UNIT) "stringTableOnTimeUnit" + set desc(POWERUP_OFFTIME_UNIT) "stringTableOffTimeUnit" + set desc(ON_TIME_BASE) "stringTableOnTimeUnit" + + set desc(OFFDELAY_TIME_BASE) "stringTableOffDelayUnit" + set desc(ONDELAY_TIME_BASE) "stringTableOnDelayUnit" + + set desc(SWITCHING_INTERVAL_BASE) "stringTableSwitchingIntervalBase" + set desc(TX_MINDELAY_UNIT) "stringTableTxMinDelayUnit" + set desc(REFERENCE_RUNNING_TIME_BOTTOM_TOP_UNIT) "stringTableTimeBottomTopUnit" + set desc(REFERENCE_RUNNING_TIME_TOP_BOTTOM_UNIT) "stringTableTimeTopBottomUnit" + set desc(REFERENCE_RUNNING_TIME_SLATS_UNIT) "stringTableTimeSlatsUnit" + set desc(BLOCKING_PERIOD_UNIT) "stringTableBlockingPeriodUnit" + set desc(EVENT_FILTER_NUMBER) "stringTableEventFilterNumber" + set desc(EVENT_FILTER_NUMBER_A) "stringTableEventFilterNumberA" + set desc(INTERVAL_UNIT) "stringTableCalibrationIntervalUnit" + + # Special handling of parameters + if {[string equal $extraparam 'rainDrop'] != 1} { + set desc(EVENT_BLINDTIME_BASE) "stringTableEventBlindTimeBase" + } else { + # special for rain recognition + set desc(EVENT_BLINDTIME_BASE) "eventTimeoutBaseRainDrop" + } + + if {[string equal $extraparam 'rainCounter'] != 1} { + set desc(EVENT_TIMEOUT_BASE) "stringTableEventTimeoutBase" + } else { + # special for rain counter + set desc(EVENT_TIMEOUT_BASE) "eventTimeoutBaseRainCounter" + } + + if {[catch {set result $desc($param)}]} { + return $result + } + return $result +} + +proc getMaintenanceAddress {channelAddress} { + set parentAddress [lindex [split $channelAddress :] 0] + return "$parentAddress:0" +} + +proc getChannel {special_input_id} { + return [lindex [split $special_input_id _] 1] +} + +proc getSpecialID {special_input_id} { + return "[lindex [split $special_input_id _] 0]" +} + +proc isLongKeypressAvailable {sender sender_address url} { + + # Here we check for certain device types without a long keypress. + set devWithoutLongKeyPress { + HmIP-ASIR + } + + foreach item $devWithoutLongKeyPress { + if {$item == $sender} {return false} + } + + # Here we test for all devices with a long keypress available, if the config parameter LONG_PRESS_TIME is set to a value == 0. + # If true, the long keypress doesn't work and should not be available for easymode profiles. + set result true + catch { + array set sender_ch_ps [xmlrpc $url getParamset $sender_address MASTER] + if {$sender_ch_ps(LONG_PRESS_TIME) == 0.000000} { + set result false + } + } + return $result +} + +proc devIsPowerMeter {devType} { + # puts "devType: $devType
" + + switch [string tolower $devType] { + hmip-bsm {return true} + hmip-fsm {return true} + hmip-fsm16 {return true} + hmip-psm {return true} + hmip-psm-2 {return true} + "hmip-psm-2 qhj" {return true} + hmip-usbsm {return true} + default {return false} + } +} + +proc getDevFirmware {} { + global dev_descr + return $dev_descr(FIRMWARE) +} + +proc getDevFwMajorMinorPatch {} { + global dev_descr + + # Firmware = x.y.z + set firmWare $dev_descr(FIRMWARE) + set fwMajorMinorPatch [split $firmWare .] + + set fw {} + + lappend fw [expr [lindex $fwMajorMinorPatch 0] * 1] + lappend fw [expr [lindex $fwMajorMinorPatch 1] * 1] + lappend fw [expr [lindex $fwMajorMinorPatch 2] * 1] + + return $fw +} + +proc getReceiverFw {} { + global url receiver_address dev_descr_receiver + array set dev_descr [xmlrpc $url getDeviceDescription $dev_descr_receiver(PARENT)] + + # Firmware (wthFw) = x.y.z + set wthFw $dev_descr(FIRMWARE) + set fwMajorMinorPatch [split $wthFw .] + + set fw {} + + lappend fw [expr [lindex $fwMajorMinorPatch 0] * 1] + lappend fw [expr [lindex $fwMajorMinorPatch 1] * 1] + lappend fw [expr [lindex $fwMajorMinorPatch 2] * 1] + + return $fw +} + + +# This can be used to return the original parameter name of a translation key +proc extractParamFromTranslationKey {key} { + + # A parameter key looks like ${thisIsTheKey} + # Here we remove the leading '${' and the trailing '}' so that we have the clean key + set key [string trim [string trim $key "\$\{"] "\}"] + + set ret "" + switch $key { + "channelModeTactileSwitch" {set ret TACTILE_SWITCH_INPUT} + } + return $ret +} + +# Some wall thermostats don't have a humidity sensor. +# We have to consider this in some easymodes. +# With this function you can maintain a list of such devices. +proc hasSenderHumiditySensor {} { + global dev_descr_sender + set senderType $dev_descr_sender(PARENT_TYPE) + set result true + + # List with thermostats without a humidity sensor + set devHasNoHumiditySensor {ALPHA-IP-RBGa} + + foreach val $devHasNoHumiditySensor { + if {$val == $senderType} { + set result false + } + } + return $result +} diff --git a/buildroot-external/patches/occu/0192-WebUI-Fix-IncorrectTagClosure/occu/WebUI/www/config/easymodes/etc/hmip_helper.tcl.orig b/buildroot-external/patches/occu/0192-WebUI-Fix-IncorrectTagClosure/occu/WebUI/www/config/easymodes/etc/hmip_helper.tcl.orig new file mode 100755 index 0000000000..fec020959a --- /dev/null +++ b/buildroot-external/patches/occu/0192-WebUI-Fix-IncorrectTagClosure/occu/WebUI/www/config/easymodes/etc/hmip_helper.tcl.orig @@ -0,0 +1,2970 @@ +#!/bin/tclsh + + +# type = 'delay' or 'timeOnOff' +# base = Unit, factor = value +proc getComboBox {prn pref specialElement type {extraparam ""}} { + global psDescr + upvar ps ps + set s "" + + switch $type { + + "autoInterval" { + append s [getAutoInterval $prn $pref $specialElement] + } + + "delay" { + append s [getDelay $prn $pref $specialElement] + } + + "delayShort" { + append s [getDelayShort $prn $pref $specialElement] + } + + "delayShortA" { + append s [getDelayShortA $prn $pref $specialElement] + } + + "eventDelay" { + append s [getPanelB $prn $pref $specialElement "eventDelay"] + } + + "eventFilterTime" { + append s [getEventFilterTime $prn $pref $specialElement] + } + + "eventRandomTime" { + append s [getPanelA $prn $pref $specialElement "eventRandomTime"] + } + + "txMinDelay" { + append s [getPanelA $prn $pref $specialElement] + } + "delay0To20M_step2M" { + append s [getDelay0to20M_step2M $prn $pref $specialElement] + } + + "timeMin_10_15_20_25_30" { + append s [getMin_10_15_20_25_30 $prn $pref $specialElement] + } + + "timeOnOff" { + append s [getTimeOnOff $prn $pref $specialElement] + } + + "timeOnOffShort" { + append s [getTimeOnOffShort $prn $pref $specialElement] + } + + + "rampOnOff" { + append s [getRampOnOff $prn $pref $specialElement $extraparam] + } + + "switchingInterval" { + append s [getSwitchingInterval $prn $pref $specialElement] + } + + "switchingIntervalOnTime" { + append s [getSwitchingIntervalOnTime $prn $pref $specialElement] + } + + "blindRunningTime" { + append s [getBlindRunningTime $prn $pref $specialElement] + } + + "slatRunningTime" { + append s [getSlatRunningTime $prn $pref $specialElement] + } + + "alarmTimeMax10Min" { + append s [getAlarmTimeMax10Min $prn $pref $specialElement] + } + + "blink" { + append s [getBlink $prn $pref $specialElement] + } + + "blink0" { + append s [getBlink $prn $pref $specialElement] + } + + "interval_1D_7D_14D_28D" { + append s [getInterval_1D_7D_14D_28D $prn $pref $specialElement] + } + + } + + return $s +} + +proc getPanelA {prn pref specialElement {paramType ""}} { + set s "" + append s "" + append s "" + + if {$paramType == "eventDelay"} { + append s " [getHelpIcon EVENT_DELAY 450 75]" + } + + if {$paramType == "eventRandomTime"} { + append s " [getHelpIcon EVENT_RANDOMTIME 450 75]" + } + + append s "" + + append s "" + + return $s +} + +proc getPanelB {prn pref specialElement {paramType ""}} { + set s "" + append s "" + append s "" + + if {$paramType == "eventDelay"} { + append s " [getHelpIcon EVENT_DELAY 450 75]" + } + + if {$paramType == "eventRandomTime"} { + append s " [getHelpIcon EVENT_RANDOMTIME 450 75]" + } + + append s "" + + append s "" + + return $s +} + + + +proc getDelayShort {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s +} + +proc getDelayShortA {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s +} + +proc getEventFilterTime {prn pref specialElement} { + set helpEvemtFilterTime EVENT_FILTER_TIME + set s "" + append s "" + append s "  " + + append s [getHelpIcon $helpEvemtFilterTime] + + append s "" + + append s "" + + return $s +} + +proc getDelay0to20M_step2M {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s +} + +proc getDelay {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s + +} + +proc getTimeOnOffShort {prn pref specialElement {extraparam ""}} { + set s "" + append s "" + append s "" + append s "" + + append s "" + return $s +} + +# Returns a option list with values for the ontime delay, offtime delay and so on +proc getTimeOnOff {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + return $s +} + +proc getRampOnOff {prn pref specialElement {extraparam ""}} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s +} + +proc getSwitchingInterval {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s +} + +proc getInterval_1D_7D_14D_28D {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s +} + +proc getSwitchingIntervalOnTime {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s +} + +## START ## + +proc getAutoInterval {prn pref specialElement} { + set s "" + append s "" + append s "" + + append s " [getHelpIcon AUTO_SENSOR_CLEANING 600 150]" + + append s "" + + append s "" + + return $s +} + +## END ## + +proc getBlindRunningTime {prn pref specialElement} { + set helpRunningTime BLIND_REFERENCE_RUNNING_TIME + + set s "" + append s "" + append s " " + append s [getHelpIcon $helpRunningTime] + append s "" + + append s "" + + return $s +} + +proc getSlatRunningTime {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s +} + +proc getMin_10_15_20_25_30 {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s +} + +proc getAlarmTimeMax10Min {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s +} + +proc getBlink {prn pref specialElement} { + set s "" + append s "" + append s "" + append s "" + + append s "" + + return $s +} + +## + +proc trimParam {param} { + set s [string trimleft $param '] + set s [string trimright $s '] + return $s +} + +proc getEventFilterNumber {param value chn prn special_input_id {extraparam ""}} { + set param [trimParam $param] + set elemId 'separate_$special_input_id\_$prn' + set j_elemId '#separate_$special_input_id\_$prn' + set s "" + append s "\${[getDescription $param\_A $extraparam]}" + append s "" + append s "" + append s "" + append s "" + append s "" + return $s +} + +proc getTimeUnitComboBox {param value chn prn special_input_id {extraparam ""}} { + set param [trimParam $param] + set elemId 'separate_$special_input_id\_$prn' + set j_elemId '#separate_$special_input_id\_$prn' + + set s "" + append s "\${[getDescription $param $extraparam]}" + append s "" + append s "" + append s "" + append s "" + append s "" + return $s +} + +proc getTimeUnitComboBoxB {param value chn prn special_input_id {extraparam ""}} { + set param [trimParam $param] + set elemId 'separate_$special_input_id\_$prn' + set j_elemId '#separate_$special_input_id\_$prn' + + set s "" + append s "\${[getDescription $param $extraparam]}" + append s "" + append s "" + append s "" + append s "" + append s "" + return $s +} + +proc getTimeUnitComboBoxC {param value chn prn special_input_id {extraparam ""}} { + set param [trimParam $param] + set elemId 'separate_$special_input_id\_$prn' + set j_elemId '#separate_$special_input_id\_$prn' + + set s "" + append s "\${[getDescription $param $extraparam]}" + append s "" + append s "" + append s "" + append s "" + append s "" + return $s +} + +proc getTimeUnitComboBoxD {param value chn prn special_input_id {extraparam ""}} { + set param [trimParam $param] + set elemId 'separate_$special_input_id\_$prn' + set j_elemId '#separate_$special_input_id\_$prn' + + set s "" + append s "\${[getDescription $param $extraparam]}" + append s "" + append s "" + append s "" + append s "" + append s "" + return $s +} + +proc getTimeUnitComboBoxShort {param value chn prn special_input_id {extraparam ""}} { + set param [trimParam $param] + set elemId 'separate_$special_input_id\_$prn' + set j_elemId '#separate_$special_input_id\_$prn' + + set trName "" + set specialVal0 "" + set specialVal1 "" + + if {[string equal $extraparam ""] != 1} { + set specialVal0 [lindex [split $extraparam =] 0] + set specialVal1 [lindex [split $extraparam =] 1] + + if {[string equal $specialVal0 "trNAME"] != -1 } { + set trName name=$specialVal1 + } + } + + set s "" + append s "\${[getDescription $param $extraparam]}" + append s "" + append s "" + append s "" + append s "" + append s "" + return $s +} + +proc getTimeUnitComboBoxShortwoHour {param value chn prn special_input_id {extraparam ""}} { + set param [trimParam $param] + set elemId 'separate_$special_input_id\_$prn' + set j_elemId '#separate_$special_input_id\_$prn' + + set trName "" + set specialVal0 "" + set specialVal1 "" + + if {[string equal $extraparam ""] != 1} { + set specialVal0 [lindex [split $extraparam =] 0] + set specialVal1 [lindex [split $extraparam =] 1] + + if {[string equal $specialVal0 "trNAME"] != -1 } { + set trName name=$specialVal1 + } + } + + set s "" + append s "\${[getDescription $param $extraparam]}" + append s "" + append s "" + append s "" + append s "" + append s "" + return $s +} + +proc getTimeUnit10ms_100ms_1s_10s {param value chn prn special_input_id {extraparam ""}} { + set param [trimParam $param] + set elemId 'separate_$special_input_id\_$prn' + set j_elemId '#separate_$special_input_id\_$prn' + + set s "" + append s "\${[getDescription $param $extraparam]}" + append s "" + append s "" + append s "" + append s "" + append s "" + return $s +} + +proc getDescription {param {extraparam ""}} { + set result $param + set desc(REPEATED_LONG_PRESS_TIMEOUT_UNIT) "stringTableKeyLongPressTimeOutUnit" + set desc(EVENT_DELAY_UNIT) "stringTableEventDelayUnit" + set desc(EVENT_RANDOMTIME_UNIT) "stringTableEventRandomTimeUnit" + set desc(POWER_OFFDELAY_UNIT) "stringTableOffDelayUnit" + set desc(POWERUP_ONDELAY_UNIT) "stringTableOnDelayUnit" + set desc(POWERUP_OFFDELAY_UNIT) "stringTableOffDelayUnit" + set desc(POWERUP_ONTIME_UNIT) "stringTableOnTimeUnit" + set desc(POWERUP_OFFTIME_UNIT) "stringTableOffTimeUnit" + set desc(ON_TIME_BASE) "stringTableOnTimeUnit" + + set desc(OFFDELAY_TIME_BASE) "stringTableOffDelayUnit" + set desc(ONDELAY_TIME_BASE) "stringTableOnDelayUnit" + + set desc(SWITCHING_INTERVAL_BASE) "stringTableSwitchingIntervalBase" + set desc(TX_MINDELAY_UNIT) "stringTableTxMinDelayUnit" + set desc(REFERENCE_RUNNING_TIME_BOTTOM_TOP_UNIT) "stringTableTimeBottomTopUnit" + set desc(REFERENCE_RUNNING_TIME_TOP_BOTTOM_UNIT) "stringTableTimeTopBottomUnit" + set desc(REFERENCE_RUNNING_TIME_SLATS_UNIT) "stringTableTimeSlatsUnit" + set desc(BLOCKING_PERIOD_UNIT) "stringTableBlockingPeriodUnit" + set desc(EVENT_FILTER_NUMBER) "stringTableEventFilterNumber" + set desc(EVENT_FILTER_NUMBER_A) "stringTableEventFilterNumberA" + set desc(INTERVAL_UNIT) "stringTableCalibrationIntervalUnit" + + # Special handling of parameters + if {[string equal $extraparam 'rainDrop'] != 1} { + set desc(EVENT_BLINDTIME_BASE) "stringTableEventBlindTimeBase" + } else { + # special for rain recognition + set desc(EVENT_BLINDTIME_BASE) "eventTimeoutBaseRainDrop" + } + + if {[string equal $extraparam 'rainCounter'] != 1} { + set desc(EVENT_TIMEOUT_BASE) "stringTableEventTimeoutBase" + } else { + # special for rain counter + set desc(EVENT_TIMEOUT_BASE) "eventTimeoutBaseRainCounter" + } + + if {[catch {set result $desc($param)}]} { + return $result + } + return $result +} + +proc getMaintenanceAddress {channelAddress} { + set parentAddress [lindex [split $channelAddress :] 0] + return "$parentAddress:0" +} + +proc getChannel {special_input_id} { + return [lindex [split $special_input_id _] 1] +} + +proc getSpecialID {special_input_id} { + return "[lindex [split $special_input_id _] 0]" +} + +proc isLongKeypressAvailable {sender sender_address url} { + + # Here we check for certain device types without a long keypress. + set devWithoutLongKeyPress { + HmIP-ASIR + } + + foreach item $devWithoutLongKeyPress { + if {$item == $sender} {return false} + } + + # Here we test for all devices with a long keypress available, if the config parameter LONG_PRESS_TIME is set to a value == 0. + # If true, the long keypress doesn't work and should not be available for easymode profiles. + set result true + catch { + array set sender_ch_ps [xmlrpc $url getParamset $sender_address MASTER] + if {$sender_ch_ps(LONG_PRESS_TIME) == 0.000000} { + set result false + } + } + return $result +} + +proc devIsPowerMeter {devType} { + # puts "devType: $devType
" + + switch [string tolower $devType] { + hmip-bsm {return true} + hmip-fsm {return true} + hmip-fsm16 {return true} + hmip-psm {return true} + hmip-psm-2 {return true} + "hmip-psm-2 qhj" {return true} + hmip-usbsm {return true} + default {return false} + } +} + +proc getDevFirmware {} { + global dev_descr + return $dev_descr(FIRMWARE) +} + +proc getDevFwMajorMinorPatch {} { + global dev_descr + + # Firmware = x.y.z + set firmWare $dev_descr(FIRMWARE) + set fwMajorMinorPatch [split $firmWare .] + + set fw {} + + lappend fw [expr [lindex $fwMajorMinorPatch 0] * 1] + lappend fw [expr [lindex $fwMajorMinorPatch 1] * 1] + lappend fw [expr [lindex $fwMajorMinorPatch 2] * 1] + + return $fw +} + +proc getReceiverFw {} { + global url receiver_address dev_descr_receiver + array set dev_descr [xmlrpc $url getDeviceDescription $dev_descr_receiver(PARENT)] + + # Firmware (wthFw) = x.y.z + set wthFw $dev_descr(FIRMWARE) + set fwMajorMinorPatch [split $wthFw .] + + set fw {} + + lappend fw [expr [lindex $fwMajorMinorPatch 0] * 1] + lappend fw [expr [lindex $fwMajorMinorPatch 1] * 1] + lappend fw [expr [lindex $fwMajorMinorPatch 2] * 1] + + return $fw +} + + +# This can be used to return the original parameter name of a translation key +proc extractParamFromTranslationKey {key} { + + # A parameter key looks like ${thisIsTheKey} + # Here we remove the leading '${' and the trailing '}' so that we have the clean key + set key [string trim [string trim $key "\$\{"] "\}"] + + set ret "" + switch $key { + "channelModeTactileSwitch" {set ret TACTILE_SWITCH_INPUT} + } + return $ret +} + +# Some wall thermostats don't have a humidity sensor. +# We have to consider this in some easymodes. +# With this function you can maintain a list of such devices. +proc hasSenderHumiditySensor {} { + global dev_descr_sender + set senderType $dev_descr_sender(PARENT_TYPE) + set result true + + # List with thermostats without a humidity sensor + set devHasNoHumiditySensor {ALPHA-IP-RBGa} + + foreach val $devHasNoHumiditySensor { + if {$val == $senderType} { + set result false + } + } + return $result +}