From bdcc945450038f9f5748c930973fb21cafb08dee Mon Sep 17 00:00:00 2001 From: openhabian configurator Date: Sat, 10 Oct 2020 21:49:00 +0200 Subject: [PATCH] minor fixes for Openhab v2.5.x --- misc/exec.whitelist | 2 + rules/level2.rules | 6 ++ services/addons.cfg | 4 +- services/runtime.cfg.dpkg-dist | 86 ++++++++++++++++++++++++++ syn2cat/spaceapi-set-status.sh | 2 +- syn2cat/spaceapi-update-peoplecount.sh | 2 +- 6 files changed, 98 insertions(+), 4 deletions(-) create mode 100644 misc/exec.whitelist create mode 100644 services/runtime.cfg.dpkg-dist diff --git a/misc/exec.whitelist b/misc/exec.whitelist new file mode 100644 index 0000000..93a2960 --- /dev/null +++ b/misc/exec.whitelist @@ -0,0 +1,2 @@ +# For security reasons all commands that are used by the exec binding or transformation need to be whitelisted. +# Every command needs to be listed on a separate line below. diff --git a/rules/level2.rules b/rules/level2.rules index ee68cb9..bd925b4 100644 --- a/rules/level2.rules +++ b/rules/level2.rules @@ -7,11 +7,13 @@ rule "Startup" when System started then + logInfo("door", "Startup space status button "+ entrance_door_status.state.toString) if (entrance_door_status.state.toString == 'OFF') { SpaceStatus = 'open' } else { SpaceStatus = 'closed' } + logInfo("door", "Startup space status set to "+ SpaceStatus) end rule "Door Status" @@ -87,11 +89,15 @@ then val count = java.lang.Integer.parseInt( transform("XPATH", "/table/tr[4]/td[2]/text()", response).trim() ) + // logInfo("door", "People counter raw value is "+ count + " previous is "+ Integer.parseInt(entrance_people_counter.previousState().state.toString)) + // logInfo("door", "People counter space status "+ SpaceStatus) + if ( SpaceStatus == 'closed' ) { count=0 } if ( count != Integer.parseInt(entrance_people_counter.previousState().state.toString)) { entrance_people_counter.postUpdate(count) + logInfo("door", "People counter set to "+ count) // fresh run needs a max init, later we use persistence to init if (entrance_people_counter_max.state == NULL) {entrance_people_counter_max.postUpdate(count) } // count is bigger, so we got a new maximum diff --git a/services/addons.cfg b/services/addons.cfg index c976f81..40380aa 100644 --- a/services/addons.cfg +++ b/services/addons.cfg @@ -38,7 +38,7 @@ ui = basic,habmin,habpanel,paper persistence = mapdb # A comma-separated list of actions to install (e.g. "action = mail,pushover") -action = mail,twitter +action = twitter # A comma-separated list of transformation services to install (e.g. "transformation = map,jsonpath") transformation = jsonpath,map,regex,scale,xpath @@ -47,5 +47,5 @@ transformation = jsonpath,map,regex,scale,xpath #voice = # A comma-separated list of miscellaneous services to install (e.g. "misc = myopenhab") -misc = #restdocs +misc = diff --git a/services/runtime.cfg.dpkg-dist b/services/runtime.cfg.dpkg-dist new file mode 100644 index 0000000..7c09845 --- /dev/null +++ b/services/runtime.cfg.dpkg-dist @@ -0,0 +1,86 @@ +##################### LOCALE #################### + +# The default language that should be used. If not specified, the system default locale is used. +# The ISO 639 alpha-2 or alpha-3 language code (if there is no alpha-2 one). +# Example: "en" (English), "de" (German), "ja" (Japanese), "kok" (Konkani) +# +#org.eclipse.smarthome.i18n:language= + +# The region that should be used. +# ISO 3166 alpha-2 country code or UN M.49 numeric-3 area code. +# Example: "US" (United States), "DE" (Germany), "FR" (France), "029" (Caribbean) +# +#org.eclipse.smarthome.i18n:region= + +################ PERSISTENCE #################### + +# The persistence service to use if no other is specified. +# +#org.eclipse.smarthome.persistence:default= + +################### AUDIO ####################### + +# This parameter defines the default audio source to use (if not set, the first available one will be used. +# +#org.eclipse.smarthome.audio:defaultSource= + +# This parameter defines the default audio sink to use (if not set, the first available one will be used. +# +#org.eclipse.smarthome.audio:defaultSink= + +##################### VOICE ##################### + +# This parameter defines the default text-to-speech service to use (if not set, the first available one will be used. +# +#org.eclipse.smarthome.voice:defaultTTS= + +# This parameter defines the default speech-to-text service to use (if not set, the first available one will be used. +# +#org.eclipse.smarthome.voice:defaultSTT= + +# The default voice to use if no specific TTS service or voice is specified. +# +#org.eclipse.smarthome.voice:defaultVoice= + +# The default human language interpreter to use if no other is specified. +# +#org.eclipse.smarthome.voice:defaultHLI= + +################### EPHEMERIS ################### + +# This parameter defines the default list of usual non workable days for the Ephemeris service. +# The value has to be surrounded by square brackets ('[' and ']') and optionally contain value delimiters - a comma ',' to be interpreted as a list of values. +# Example: [SATURDAY,SUNDAY] +# +org.openhab.ephemeris:dayset-weekend=[SATURDAY,SUNDAY] + +# This parameter defines the default list of usual workable days for the Ephemeris service. +# The value has to be surrounded by square brackets ('[' and ']') and optionally contain value delimiters - a comma ',' to be interpreted as a list of values. +# +org.openhab.ephemeris:dayset-school=[MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY] + +################ MISCELLANOUS ################### + +# The karaf sshHost parameter configures the bind address for the ssh login to karaf. +# Default is 127.0.0.1 (localhost), so it is only possible to login from the local machine. +# +# Setting this to the address of another network interfaces will allow login from this network. +# Setting this to 0.0.0.0 will allow login from all network interfaces. +# +# !!! Security warning !!! +# Remember to change default login/password, if you allow external login. +# See https://www.openhab.org/docs/administration/console.html for details. +# +#org.apache.karaf.shell:sshHost = 0.0.0.0 + +# Setting this to true will automatically approve all inbox entries and create Things for them, +# so that they are immediately available in the system (default is false) +# +#org.eclipse.smarthome.inbox:autoApprove=true + +# This setting allows to switch between a "simple" and an "advanced" mode for item management. +# In simple mode (autoLinks=true), links and their according items are automatically created for new Things. +# In advanced mode (autoLinks=false), the user has the full control about which items channels are linked to. +# Existing links will remain untouched. (default is true) +# +#org.eclipse.smarthome.links:autoLinks=false diff --git a/syn2cat/spaceapi-set-status.sh b/syn2cat/spaceapi-set-status.sh index 080974d..10cc514 100755 --- a/syn2cat/spaceapi-set-status.sh +++ b/syn2cat/spaceapi-set-status.sh @@ -20,5 +20,5 @@ case "$1" in exit ;; esac -/usr/bin/curl --max-time 1 --silent --data key="$spaceapikey" --data-urlencode sensors='{"state":{"open":'"$openstate"',"lastchange":'"$nai"'}}' https://spaceapi.syn2cat.lu/sensor/set +/usr/bin/curl --max-time 3 --silent --data key="$spaceapikey" --data-urlencode sensors='{"state":{"open":'"$openstate"',"lastchange":'"$nai"'}}' https://spaceapi.syn2cat.lu/sensor/set diff --git a/syn2cat/spaceapi-update-peoplecount.sh b/syn2cat/spaceapi-update-peoplecount.sh index b575cc6..7394eb3 100755 --- a/syn2cat/spaceapi-update-peoplecount.sh +++ b/syn2cat/spaceapi-update-peoplecount.sh @@ -9,5 +9,5 @@ then fi spaceapikey="$(cat "$(dirname $0)"/spaceapikey.txt)" presency="$1" -/usr/bin/curl --max-time 1 --silent --data key="$spaceapikey" --data-urlencode sensors='{"sensors":{"people_now_present":[{"value":'"$presency"'}]}}' https://spaceapi.syn2cat.lu/sensor/set +/usr/bin/curl --max-time 3 --silent --data key="$spaceapikey" --data-urlencode sensors='{"sensors":{"people_now_present":[{"value":'"$presency"'}]}}' https://spaceapi.syn2cat.lu/sensor/set