├── .gitignore
├── LICENSE
├── VERSION
├── generate_img.sh
├── hm-iobroker-0.0.8.tar.gz
├── iob
├── README.md
├── hm-iobroker-addon.cfg
├── iodata.tar.gz
└── update_addon
├── modified_iodata_files
├── iobroker
├── iobroker_update.txt
└── npm_io
│ └── readme_folder
├── rc.d
└── hm-iobroker
├── update_script
└── www
├── index.html
└── update-check.cgi
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 ioBroker CCU Addon Contributors
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/VERSION:
--------------------------------------------------------------------------------
1 | 1.5.14-zigbee
2 |
--------------------------------------------------------------------------------
/generate_img.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # script to generate the CCU addon package.
4 |
5 | # generate tempdir
6 | mkdir -p tmp
7 | rm -rf tmp/*
8 |
9 | # copy all relevant stuff
10 | cp -a update_script tmp/
11 | cp -a rc.d tmp/
12 | cp -a www tmp/
13 | cp -a VERSION tmp/www/
14 | cp -a iob tmp/
15 | cp -a modified_iodata_files tmp/
16 | cp -a VERSION tmp/iob/
17 | cp -a VERSION tmp/modified_iodata_files/
18 |
19 |
20 |
21 | # generate archive
22 | cd tmp
23 | tar --owner=root --group=root --exclude=.DS_Store -czvf ../hm-iobroker-$(cat ../VERSION).tar.gz *
24 | cd ..
25 | rm -rf tmp
26 |
--------------------------------------------------------------------------------
/hm-iobroker-0.0.8.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zautrix/hm-iobroker/8ad000a465f24f8fcf06bf27a2f05988da1b598d/hm-iobroker-0.0.8.tar.gz
--------------------------------------------------------------------------------
/iob/README.md:
--------------------------------------------------------------------------------
1 | # HomeMatic iobroker addon
--------------------------------------------------------------------------------
/iob/hm-iobroker-addon.cfg:
--------------------------------------------------------------------------------
1 | {
2 | CONFIG_URL /addons/hm-iobroker
3 | CONFIG_DESCRIPTION {
4 | de {ioBroker Smarthome Automation
5 | Drei Systeme den Anwendern der Heimautomation,
6 | Sieben den Herren in ihren Haeusern aus Stein,
7 | Den Normalsterblichen, neun,
8 | Eines dem Herrscher auf seinem Thron,
9 | im Lande ioBroker, wo die smarten User wohn,
10 | Ein System sie zu beherrschen, sie alle zu finden,
11 | Ein System sie zu steuern und einzubinden,
12 | im Lande ioBroker, wo die smarten User wohn.
13 | }
14 | en {ioBroker smarthome automation}
15 | }
16 | ID hm-iobroker
17 | CONFIG_NAME "ioBroker"
18 | }
19 |
--------------------------------------------------------------------------------
/iob/iodata.tar.gz:
--------------------------------------------------------------------------------
1 |
2 | Replace this file by full backup of iobroker backitup adapter.
3 | Rename, of course, iobroker backup file to iodata.tar.gz
--------------------------------------------------------------------------------
/iob/update_addon:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zautrix/hm-iobroker/8ad000a465f24f8fcf06bf27a2f05988da1b598d/iob/update_addon
--------------------------------------------------------------------------------
/modified_iodata_files/iobroker:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | if ( [ "$2" = "" ] ) && ([ "$1" = "start" ] || [ "$1" = "stop" ] || [ "$1" = "restart" ]); then
3 | #start/stop command from linux distribution not working here
4 | #sudo systemctl $1 iobroker
5 | #start here with with
6 | /usr/local/etc/config/rc.d/hm-iobroker $1
7 | else
8 | node /usr/local/addons/hm-iobroker/node_modules/iobroker.js-controller/iobroker.js $1 $2 $3 $4 $5
9 | fi
10 |
--------------------------------------------------------------------------------
/modified_iodata_files/iobroker_update.txt:
--------------------------------------------------------------------------------
1 | Howto update iobroker installtion
2 |
3 | - Update any adapter in ioBroker gui
4 |
5 | - Update ioBroker host (i.e. js-controller ) in this way:
6 |
7 | Log on as root (via ssh) into console and run the following commands:
8 | (ignore any "gyp ERR! ..." messages during upgrade)
9 | (ignore "npm update check failed" message)
10 |
11 | cd /usr/local/addons/hm-iobroker
12 | ./iobroker stop
13 | export npm_config_cache=/usr/local/addons/hm-iobroker/npm_io/.npm
14 | export npm_config_userconfig=/usr/local/addons/hm-iobroker/npm_io/.npmrc
15 | ./iobroker update
16 | ./iobroker upgrade self
17 | ./iobroker start
--------------------------------------------------------------------------------
/modified_iodata_files/npm_io/readme_folder:
--------------------------------------------------------------------------------
1 | folder for npm to put some config or cache data in
2 | the home directory of root (i.e. /root) is not available for this data, because
3 | /root is located on a readonly mounted file system
--------------------------------------------------------------------------------
/rc.d/hm-iobroker:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | export NODE_PATH=/usr/lib/node_modules
4 | ADDONNAME=hm-iobroker
5 | CONFIGDIR=/usr/local/etc/config
6 | ADDONDIR=/usr/local/addons/${ADDONNAME}
7 | EXEC=node
8 | EXECARGS=${ADDONDIR}/node_modules/iobroker.js-controller/controller.js
9 | PIDFILE=/var/run/hm_iobroker.pid
10 | #nmp should not write to /root dir, it is mounted readonly
11 | export npm_config_cache=${ADDONDIR}/npm_io/.npm
12 | #the next line is not a good idea. if enabled it does not install any more properly
13 | #export npm_config_init-module=${ADDONDIR}/.npm-init.js
14 | export npm_config_userconfig=${ADDONDIR}/npm_io/.npmrc
15 | #start with
16 | #/usr/bin/node /usr/local/addons/hm-iobroker/node_modules/iobroker.js-controller/controller.js
17 | # change to addon directory
18 | cd ${ADDONDIR}
19 |
20 | do_start()
21 | {
22 | # used at system start
23 | start-stop-daemon --start --quiet --oknodo --make-pidfile --background --pidfile $PIDFILE --exec $EXEC $EXECARGS
24 | }
25 |
26 | do_stop()
27 | {
28 | start-stop-daemon --stop --quiet --oknodo --retry 5 --pidfile $PIDFILE
29 |
30 | if [ -e $PIDFILE ];then
31 | rm -f $PIDFILE
32 | fi
33 |
34 | #from iobroker killall
35 | pgrep -f '^io.*' | xargs kill -9
36 | #pgrep -f '^node-red*' | xargs kill -9
37 | }
38 |
39 | case "$1" in
40 |
41 | ""|start)
42 | do_start
43 | ;;
44 |
45 | stop)
46 | do_stop
47 | ;;
48 |
49 | restart)
50 | do_stop
51 | sleep 2
52 | do_start
53 | ;;
54 |
55 | info)
56 | echo "Info: ioBroker CCU Addon
"
57 | echo "Info: Copyright (c) 2019 ioBroker Addon developers
"
58 | echo "Info: https://github.com/jens-maus/hm-iobroker"
59 | echo "Version: $(cat ${ADDONDIR}/VERSION)"
60 | echo "Name: hm-iobroker"
61 | echo "Operations: uninstall"
62 | echo "Config-Url: :8081/"
63 | echo "Update: /addons/${ADDONNAME}/www/update-check.cgi"
64 | ;;
65 |
66 | uninstall)
67 | # make sure to stop ioBroker first
68 | do_stop
69 |
70 | # remove the addon button
71 | ${ADDONDIR}/addon_admin/update_addon hm-iobroker
72 |
73 | # remove the whole addon related stuff
74 | rm -rf /usr/local/etc/config/addons/www/${ADDONDIR}
75 | rm -rf ${ADDONDIR}
76 | rm -rf /etc/config/rc.d/hm-iobroker
77 | ;;
78 |
79 | *)
80 | echo "Usage: ${ADDONNAME} {info|start|stop|restart|uninstall}"
81 | exit 1
82 | ;;
83 |
84 | esac
85 |
86 | exit $?
87 |
--------------------------------------------------------------------------------
/update_script:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | ADDONNAME=hm-iobroker
4 | CONFIGDIR=/usr/local/etc/config
5 | ADDONDIR=/usr/local/addons/${ADDONNAME}
6 | RCDDIR=${CONFIGDIR}/rc.d
7 | WWWDIR=${CONFIGDIR}/addons/www/${ADDONNAME}
8 | ADMINDIR=${ADDONDIR}/addon_admin
9 |
10 | if [ "$1" == "HM-RASPBERRYMATIC" ] || [ "$1" == "CCU3" ] ; then
11 | echo "HM-RASPBERRYMATIC"
12 |
13 | # mount /usr/local if not already mounted
14 | mount | grep /usr/local 2>&1 >/dev/null
15 | if [ $? -eq 1 ]; then
16 | mount /usr/local
17 | fi
18 |
19 | mkdir -p ${ADDONDIR}
20 | chmod 777 ${ADDONDIR}
21 |
22 | mkdir -p ${RCDDIR}
23 | chmod 755 ${RCDDIR}
24 |
25 | rm -rf ${ADDONDIR}/*
26 |
27 | mkdir -p ${ADMINDIR}
28 | chmod 777 ${ADMINDIR}
29 |
30 | #cp -r iob/iodata/* ${ADDONDIR}/
31 | tar xfvz iob/iodata.tar.gz -C ${ADDONDIR}/
32 | #patch files. maybe needs to be changed if we have more files
33 | cp -r modified_iodata_files/* ${ADDONDIR}/
34 |
35 | cp -f iob/* ${ADMINDIR}
36 |
37 | cp -af rc.d/* ${RCDDIR}
38 |
39 | rm -rf /usr/local/etc/config/addons/www/${ADDONNAME}
40 |
41 | cp -af www ${ADDONDIR}/
42 | if [ ! -e ${WWWDIR} ]; then
43 | ln -sf ${ADDONDIR}/www ${WWWDIR}
44 | fi
45 |
46 | chmod +rx ${RCDDIR}/iobroker
47 | touch /usr/local/etc/config/hm_addons.cfg
48 | ${ADMINDIR}/update_addon hm-iobroker ${ADMINDIR}/hm-iobroker-addon.cfg
49 |
50 | sync
51 | else
52 | echo "Unsupported CCU platform: '$1'"
53 | fi
54 |
55 | # exit with 0 to signal install succeeded and no reboot
56 | # is required
57 | exit 0
58 |
--------------------------------------------------------------------------------
/www/index.html:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/www/update-check.cgi:
--------------------------------------------------------------------------------
1 | #!/bin/tclsh
2 |
3 | set checkURL "https://raw.githubusercontent.com/jens-maus/hm-iobroker/master/VERSION"
4 | set downloadURL "https://github.com/jens-maus/hm-iobroker/releases"
5 |
6 | catch {
7 | set input $env(QUERY_STRING)
8 | set pairs [split $input &]
9 | foreach pair $pairs {
10 | if {0 != [regexp "^(\[^=]*)=(.*)$" $pair dummy varname val]} {
11 | set $varname $val
12 | }
13 | }
14 | }
15 |
16 | if { [info exists cmd ] && $cmd == "download"} {
17 | puts -nonewline "Content-Type: text/html; charset=utf-8\r\n\r\n"
18 | puts -nonewline "