Skip to content

Commit 8133e71

Browse files
committed
Merge remote-tracking branch 'origin/develop'
# Conflicts: # bin/shngversion.py
2 parents 985af52 + 57a9ae4 commit 8133e71

File tree

94 files changed

+4179
-2273
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+4179
-2273
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ Thumbs.db
2929
# Don't check in built documentation
3030
/doc/user/build
3131
/doc/user/source/plugins_doc
32+
!/doc/user/source/plugins_doc/plugins_footer.rst
33+
!/doc/user/source/plugins_doc/plugins_gateway_header.rst
34+
!/doc/user/source/plugins_doc/plugins_interface_header.rst
35+
!/doc/user/source/plugins_doc/plugins_protocol_header.rst
36+
!/doc/user/source/plugins_doc/plugins_system_header.rst
37+
!/doc/user/source/plugins_doc/plugins_unclassified_header.rst
38+
!/doc/user/source/plugins_doc/plugins_all_header.rst
39+
3240
/doc/developer/build
3341
/doc/developer/source/plugins_doc
3442

bin/shngversion.py

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
sys.path.append('..')
2828

2929
import plugins.__init__ as plugin_vers
30-
30+
from lib.utils import Version
3131

3232
# Update auf 1.3d wg. neuer item features on_update, on_change
3333
# Update auf 1.3e wg. neuer logic features for visu_websocket
@@ -72,11 +72,14 @@
7272
# Update auf 1.8.2a wg. Kennzeichnung des Stands als "nach dem v1.8.2 Release"
7373
# Update auf 1.8.2b wg. Erweiterung des Item Loggings"
7474
# Update auf 1.8.2c wg. Wegen Anpassungen an mem-logging / lib.log
75-
# Update auf 1.8.2d Unterstützung für User-Functions
75+
# Update auf 1.8.2d wg. Unterstützung für User-Functions
7676

7777
# Update auf 1.9.0 wg. Release
78+
# Update auf 1.9a wg. Kennzeichnung des Stands als "nach dem v1.9.0 Release"
79+
80+
# Update auf 1.9.1 wg. Release
7881

79-
shNG_version = '1.9.0'
82+
shNG_version = '1.9.1'
8083
shNG_branch = 'master'
8184

8285
# ---------------------------------------------------------------------------------
@@ -115,17 +118,21 @@ def _get_git_data(sub='', printout=False):
115118
# ---------------------------------------------------------------------------------
116119

117120
def get_shng_main_version():
118-
return shNG_version
121+
return Version.format( shNG_version )
122+
123+
def get_shng_plugins_version():
124+
plgversion = get_plugins_version().split('-')[0]
125+
return Version.format( plgversion )
119126

120127
def get_shng_version():
121128
commit, commit_short, branch, describe = _get_git_data()
122129
VERSION = get_shng_main_version()
123130
if branch == 'master':
124-
VERSION += '.'+branch+' ('+commit_short+')'
131+
VERSION += '-'+branch+' ('+commit_short+')'
125132
elif branch == 'manual':
126-
VERSION += '.'+shNG_branch+' ('+branch+')'
133+
VERSION += '-'+shNG_branch+' ('+branch+')'
127134
else:
128-
VERSION += '.'+commit_short+'.'+branch
135+
VERSION += '-'+commit_short+'.'+branch
129136
return VERSION
130137

131138
def get_shng_branch():
@@ -139,7 +146,7 @@ def get_shng_description():
139146

140147
def get_plugins_version():
141148
commit, commit_short, branch, describe = _get_git_data('plugins')
142-
VERSION = get_shng_main_version()
149+
VERSION = Version.format( get_shng_main_version() )
143150
try:
144151
PLUGINS_VERSION = plugin_vers.plugin_release()
145152
except:
@@ -150,16 +157,16 @@ def get_plugins_version():
150157
PLUGINS_SOURCE_BRANCH = ''
151158

152159
if branch == 'master':
153-
VERSION = PLUGINS_VERSION
154-
VERSION += '.'+branch+' ('+commit_short+')'
160+
VERSION = Version.format( PLUGINS_VERSION )
161+
VERSION += '-'+branch+' ('+commit_short+')'
155162
elif branch == 'manual':
156-
VERSION = PLUGINS_VERSION
163+
VERSION = Version.format( PLUGINS_VERSION )
157164
if PLUGINS_SOURCE_BRANCH != '':
158-
VERSION += '.'+PLUGINS_SOURCE_BRANCH
165+
VERSION += '-'+PLUGINS_SOURCE_BRANCH
159166
VERSION += ' ('+branch+')'
160167
else:
161-
VERSION = PLUGINS_VERSION
162-
VERSION += '.'+commit_short+'.'+branch
168+
VERSION = Version.format( PLUGINS_VERSION )
169+
VERSION += '-'+commit_short+'.'+branch
163170
return VERSION
164171

165172

bin/smarthome.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,29 @@
112112
from lib.shpypi import Shpypi
113113
shpypi = Shpypi.get_instance()
114114
if shpypi is None:
115-
shpypi = Shpypi(base=BASE)
115+
shpypi = Shpypi(base=BASE, version=VERSION)
116116

117117
core_reqs = shpypi.test_core_requirements(logging=False, pip3_command=args.pip3_command)
118118
if core_reqs == 0:
119119
print("Starting SmartHomeNG again...")
120120
python_bin = sys.executable
121121
if ' ' in python_bin:
122122
python_bin = '"'+python_bin+'"'
123-
command = python_bin + ' ' + os.path.join(BASE, 'bin', 'smarthome.py')
123+
# if we didn't change the working dir (yet), for example...
124+
# command = [python_bin] + sys.argv
125+
command = [python_bin, os.path.join(BASE, 'bin', 'smarthome.py')]
126+
127+
# if started with parameter to stay in foreground, don't fork
128+
if args.foreground or args.interactive or args.debug:
129+
try:
130+
# function call doesn't return; this process is replaced by the new one
131+
os.execv(python_bin, [python_bin] + sys.argv)
132+
except OSError as e:
133+
print(f'Restart command {command} failed with error {e}')
134+
exit(0)
135+
124136
try:
137+
command.append('-r')
125138
p = subprocess.Popen(command, shell=True)
126139
except subprocess.SubprocessError as e:
127140
print("Restart command '{}' failed with error {}".format(command,e))
@@ -199,7 +212,10 @@ def _reload_logics():
199212

200213
lib.backup.make_backup_directories(BASE)
201214

202-
if args.interactive:
215+
if args.restart:
216+
time.sleep(5)
217+
lib.daemon.kill(PIDFILE, 30)
218+
elif args.interactive:
203219
MODE = 'interactive'
204220
import code
205221
import rlcompleter # noqa
@@ -234,10 +250,6 @@ def _reload_logics():
234250
elif args.stop:
235251
lib.daemon.kill(PIDFILE, 30)
236252
exit(0)
237-
elif args.restart:
238-
time.sleep(5)
239-
lib.daemon.kill(PIDFILE, 30)
240-
pass
241253
elif args.debug:
242254
MODE = 'debug'
243255
elif args.quiet:

dev/sample_plugin/webif/templates/index.html

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@
55
<!-- set update_interval to a value > 0 (in milliseconds) to enable periodic data updates -->
66
{% set update_interval = 0 %}
77

8+
<!--
9+
Additional styles go into this block
10+
-->
11+
{% block pluginstyles %}
12+
<style>
13+
table th.value {
14+
width: 100px;
15+
}
16+
</style>
17+
{% endblock pluginstyles %}
18+
819
<!--
920
Additional script tag for plugin specific javascript code go into this block
1021
-->
@@ -14,10 +25,9 @@
1425
if (dataSet === 'devices_info' || dataSet === null) {
1526
var objResponse = JSON.parse(response);
1627
myProto = document.getElementById(dataSet);
17-
for (var device in objResponse) {
28+
for (item in objResponse) {
1829
/*
19-
shngInsertText (device+'_source', objResponse[device]['source']);
20-
shngInsertText (device+'_powerState', objResponse[device]['powerState']);
30+
shngInsertText (item+'_value', objResponse[item]['value'], 'maintable');
2131
*/
2232
}
2333
}
@@ -29,22 +39,23 @@
2939
-->
3040
<script>
3141
$(document).ready( function () {
32-
try
33-
{
34-
$('#<table_id>').DataTable( {
35-
"paging": false,
36-
fixedHeader: true
37-
} );
38-
$('#maintable').DataTable( {
39-
"paging": false,
40-
fixedHeader: true
41-
} );
42-
}
43-
catch (e)
44-
{
45-
console.log("Datatable JS not loaded, showing standard table without reorder option")
46-
}
47-
});
42+
/*
43+
loading defaults from /modules/http/webif/gstatic/datatables/datatables.defaults.js
44+
You can copy that file, put it in your plugin directory, rename the "bind" function and
45+
trigger that function here instead of datatables_defaults if you want to change the behaviour.
46+
Of course you can also overwrite defaults by putting the option declarations in {} below.
47+
*/
48+
$(window).trigger('datatables_defaults');
49+
try
50+
{
51+
$('#maintable').DataTable( {} ); // put options into {} if needed
52+
$('#<table_id>').DataTable( {} ); // delete or change name
53+
}
54+
catch (e)
55+
{
56+
console.log("Datatable JS not loaded, showing standard table without reorder option " + e)
57+
}
58+
});
4859
</script>
4960
{% endblock pluginscripts %}
5061

@@ -113,30 +124,21 @@
113124
{% block bodytab1 %}
114125
<div class="container-fluid m-2">
115126
{{ _('Hier kommt der Inhalt des Webinterfaces hin.') }}
116-
<!--
117-
Example table using datatables JS. Always use well-formed table formatting like
118-
<table>
119-
<thead>
120-
<tr> <th></th><th></th>...</tr>
121-
</thead>
122-
<tbody>
123-
<tr> <td></td><td></td>...</tr>
124-
</tbody>
125-
</table>
126-
-->
127-
<table id="maintable" class="table table-striped table-hover pluginList">
127+
128+
<!-- set id accordingly -->
129+
<table id="maintable" class="table table-striped table-hover pluginList display">
128130
<thead>
129131
<tr>
130132
<th>{{ _('Item') }}</th>
131-
<th>{{ _('Wert') }}</th>
133+
<th class="value">{{ _('Wert') }}</th>
132134
</tr>
133135
</thead>
134136
<tbody>
135137
{% for item in p.get_items() %}
136138
{% if p.has_iattr(item.conf, '<plugin_attribute>') %}
137139
<tr>
138-
<td class="py-1">{{ item._path }}</td>
139-
<td class="py-1">{{ item() }}</td>
140+
<td class="py-1" id="{{ item._path }}">{{ item._path }}</td>
141+
<td class="py-1" id="{{ item._path }}_value">{{ item() }}</td>
140142
</tr>
141143
{% endif %}
142144
{% endfor %}

doc/build_doc_local.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ if [ "${KEEP_REPO,,}" != "true" ]; then
102102
fi
103103
echo
104104
echo Sollten die build Verzeichnisse bereits existieren, werden die alten
105-
echo gebauten Versionen während des Skriptes gelöscht. Der Account unter dem s
106-
echo diese Skript ausgeführt wird, muss Rechte zum anlegen von Verzeichnissen
105+
echo gebauten Versionen während des Skriptes gelöscht. Der Account unter dem
106+
echo dieses Skript ausgeführt wird, muss Rechte zum anlegen von Verzeichnissen
107107
echo in \'$DIR\' haben.
108108
echo
109109
if [ "${GIT_CHECKOUT,,}" == "true" ]; then
@@ -171,6 +171,8 @@ if [ "${DOC,,}" == "developer" ] || [ "${DOC,,}" == "all" ]; then
171171
make html || exit
172172
echo
173173
echo Bau der Entwickler-Dokumentation ist abgeschlossen!
174+
echo
175+
echo Die Startseite ist: \'${DIR}/user/build/html/index.html\'
174176
fi
175177

176178
if [ "${DOC,,}" == "user" ] || [ "${DOC,,}" == "all" ]; then
@@ -185,6 +187,8 @@ if [ "${DOC,,}" == "user" ] || [ "${DOC,,}" == "all" ]; then
185187
make html || exit
186188
echo
187189
echo Bau der Anwender-Dokumentation ist abgeschlossen!
190+
echo
191+
echo Die Startseite ist: \'${DIR}/user/build/html/index.html\'
188192
fi
189193

190194

doc/build_plugin_config_files.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,7 @@ def write_configfile(plg, configfile_dir, language='de'):
736736
global docu_type
737737
docu_type = start_dir.split('/')[-1:][0] # developer / user
738738

739+
print('Creating the configuration documentation pages for the plugins')
739740
print('Start directory = '+start_dir)
740741
print('Documentation type = '+docu_type)
741742
print('Documentation language = '+language)

0 commit comments

Comments
 (0)