diff --git a/bbb/.htaccess b/.htaccess
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/.htaccess
rename to .htaccess
diff --git a/bbb/LICENSE.txt b/LICENSE.txt
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/LICENSE.txt
rename to LICENSE.txt
diff --git a/README.md b/README.md
old mode 100644
new mode 100755
diff --git a/bbb/README.md b/bbb/README.md
deleted file mode 100644
index 2f47b2e..0000000
--- a/bbb/README.md
+++ /dev/null
@@ -1,104 +0,0 @@
-# Behovsboboxen - a controlsystem for smart homes based on Raspberry Pi.
-BehovsBoBoxen är ett styrsystem för smarta hem baserad på Raspberry Pi. (Svensk text längre ner.)
-![What you need](http://www.behovsbo.se/bilderipso/bbbmaterial.jpg)
-
-Bom: | Get this
----- | --------
-1 | 1 Raspberry pi 2 modell B
-2 | 7 ds18b20 with pins
-3 | 1 ds18b20 waterproof
-4 | 1 micro SD card 8GB
-5 | 1 relaycard with 8 relays
-6 | 1 5V 2,1A USB charger
-7 | 1 breadboard
-8 | 1 bunch connection-wires male-male
-9 | 1 bunch connection-wires female-female
-10 | 1 Ethernetwire
-
-
-1. Connect the temperature sensors (ds18b20) with plus, minus and signal on GPIO4. If you want to have fewer than 8,
-you need to change in the two while-loops in `/home/pi/dallas.py`. You can also add more, up to 16.
-
-2. Connect the relay card with it's 8 relays from the GPIO pins in the same order as described in the beginning of the file `/home/pi/dallas.py`
-
-3. Normal mood for an ip-address is DHCP. If you wish a static ip-address, change in the file `/etc/network/interfaces`
-
-4. In order to reach BehovsBoBoxen from internet you need to do a portforwarding in your router. Se your manual how it's done.
-
-5. You have already downloaded and installed Raspian from `https://www.raspberrypi.org/downloads/noobs/` and made local configurations
-
-6. Now, download the latest version from our repository using git client `git clone https://github.com/Electrotest/BehovsBoBoxen`
-
-7. Run the installation script and follow the given instructions `sudo sh /home/pi/BehovsBoBoxen/install.sh`
-
-8. Now you can enter your webpage with `https://your.ip.n.r` and log in with root:root. The first time you might get a warning and need to accept that you trust the certificate as it is signed by you and not a professional Certificate Authority, CA.
-
-9. You change username and password at the administrationpage. If you forget these you can install BehovsBoBoxen again. Not to much harm done for you.
-
-10. If 1-wire sensors are plugged in according to the manual, you will find folders under `/sys/bus/w1/devices` where each sensor presents it's temperature.
-
-11. The relays should be connected with dupont cabels according to the pin-configurations in `/home/pi/dallas.py`
-
-12. Rundstyrning (Demand side management) can be used if you make an agreement with your utility company in order to control loads and prohibite disturbance on the local network.
-
-13. You can change language to english if you open `/var/www/html/application/config.php` On line 100 you find `$bbb->config['language'] = 'sv_SE';` Change `'sv_SE` to `'en_GB'`
-
-
-# BehovsBoBoxen är ett styrsystem för smarta hem baserad på Raspberry Pi.
-
-Bom | Materiallista
---- | -------------
-1 | 1 Raspberry pi 2 modell B
-2 | 7 ds18b20 med pinnar
-3 | 1 ds18b20 vattensäker
-4 | 1 micro SD kort 8GB
-5 | 1 reläkort med 8 relän
-6 | 1 5V 2,1A USB laddare
-7 | 1 kopplingsdeck
-8 | 1 knippe kopplingssladdar hane-hane
-9 | 1 knippe kopplingssladdar hona-hona
-10 | 1 Ethernetsladd
-
-
-1. Koppla in temperaturgivarna (ds18b20) med plus, minus och signal på GPIO4. Om du vill ha färre än 8 givare behöver du ändra i de två while-looparna i `/home/pi/dallas.py`. Du kan likaså lägga till fler, upp till 16 stycken.
-
-2. Reläkortet kopplas med sina 8 relän från GPIO pinnarna som är angivet i samma ordning som anges i början av filen `/home/pi/dallas.py`
-
-3. Normal läge för IP adress är DHCP, om fast ip adress önskas ändrar man i filen `/etc/network/interfaces`
-
-4. Om du vill kunna nå BehovsBoBoxen från Internet måste du göra en portvidarebefodran i er router, se manualen hur det görs.
-
-5. Du har laddat ner och installerat Raspian från `https://www.raspberrypi.org/downloads/noobs/` och konfigurerat till svenska förhållanden
-
-6. Ladda nu ner den senaste versionen från vår katalog (repository) med git klienten `git clone https://github.com/Electrotest/BehovsBoBoxen`
-
-7. Kör installationsskriptet och följ de givna instruktionerna `sudo sh /home/pi/BehovsBoBoxen/install.sh`
-
-8. Nu kan du gå in på `https://your.ip.n.r` Logga in med root:root. Första gången kan du få en varning och få klicka för att du litar på certifikatet. Det är ju bara signerat av dig och inte någon professionell Certificate Authority, CA.
-
-9. Du byter namn och lösenord på administrationssidan. Om du glömmer inloggningsuppgifterna kan du installera om Boxen – ingen större skada skedd.
-
-10. Om 1-wire sensorer är inkopplade enligt anvisningen, skall det med sökvägen `/sys/bus/w1/devices` finnas mappar där varje sensor anger sin temperatur.
-
-11. Reläna skall kopplas med dupontsladdar enligt pin-konfigurationen i `/home/pi/dallas.py`
-
-12. Rundstyrning kan användas om man gör ett avtal med sitt elnätsbolag om att styra laster för att förhindra störningar på det lokala elnätet.
-
-13. Du kan byta språk till engelska om du går till `/var/www/html/application/config.php` På rad 105 hittar du `$bbb->config['language'] = 'sv_SE';` Ändra `'sv_SE` till `'en_GB'`
-
-
-
-#### The interface of Behovsboboxen is based on Lydia, which is a PHP-based, MVC-inspired CMF
-
-You find Lydia here: [Lydia](https://github.com/mosbth/lydia)
-
-The modified and accustomed version is made by Gunvor Nilsson.
-
-
-#### License
-
-Behovsboboxen (and Lydia) is licensed according to MIT-license.
-
-
-[License/ Pricing:](http://canvasjs.com/download-html5-charting-graphing-library/)
-> CanvasJS is free for non-commercial and paid for commercial use.
\ No newline at end of file
diff --git a/bbb/html/.htaccess b/bbb/html/.htaccess
deleted file mode 100644
index bae9364..0000000
--- a/bbb/html/.htaccess
+++ /dev/null
@@ -1,8 +0,0 @@
-
- RewriteEngine on
- # if the request is not a file/directory, redirect to index.php
- RewriteCond %{REQUEST_FILENAME} !-f
- RewriteCond %{REQUEST_FILENAME} !-d
- RewriteCond %{REQUEST_FILENAME} !-l
- RewriteRule (.*) index.php/$1 [NC,L] # all requests will be sent to index.php/requestedPath - [not case, last]
-
\ No newline at end of file
diff --git a/html/.htaccess b/html/.htaccess
new file mode 100755
index 0000000..10a054b
--- /dev/null
+++ b/html/.htaccess
@@ -0,0 +1,23 @@
+
+ RewriteEngine on
+
+# This will enable the Rewrite capabilities
+
+ RewriteCond %{HTTPS} !=on
+# This checks to make sure the connection is not already HTTPS
+
+ RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
+# This rule will redirect users from their original location, to the same location but using HTTPS.
+# i.e. http://www.example.com/foo/ to https://www.example.com/foo/
+# The leading slash is made optional so that this will work either in httpd.conf
+# or .htaccess context
+
+
+
+
+ # if the request is not a file/directory, redirect to index.php
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteCond %{REQUEST_FILENAME} !-d
+ RewriteCond %{REQUEST_FILENAME} !-l
+ RewriteRule (.*) index.php/$1 [NC,L] # all requests will be sent to index.php/requestedPath - [not case, last]
+
\ No newline at end of file
diff --git a/bbb/html/application/config.php b/html/application/config.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/application/config.php
rename to html/application/config.php
diff --git a/bbb/html/application/data/.ht.sqlite3 b/html/application/data/.ht.sqlite3
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/application/data/.ht.sqlite3
rename to html/application/data/.ht.sqlite3
diff --git a/bbb/html/application/textfile/currentPrices.txt b/html/application/textfile/currentPrices.txt
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/application/textfile/currentPrices.txt
rename to html/application/textfile/currentPrices.txt
diff --git a/bbb/html/application/textfile/newPrices.txt b/html/application/textfile/newPrices.txt
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/application/textfile/newPrices.txt
rename to html/application/textfile/newPrices.txt
diff --git a/bbb/html/application/textfile/room0.txt b/html/application/textfile/room0.txt
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/application/textfile/room0.txt
rename to html/application/textfile/room0.txt
diff --git a/bbb/html/application/textfile/room1.txt b/html/application/textfile/room1.txt
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/application/textfile/room1.txt
rename to html/application/textfile/room1.txt
diff --git a/bbb/html/application/textfile/room2.txt b/html/application/textfile/room2.txt
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/application/textfile/room2.txt
rename to html/application/textfile/room2.txt
diff --git a/bbb/html/application/textfile/room3.txt b/html/application/textfile/room3.txt
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/application/textfile/room3.txt
rename to html/application/textfile/room3.txt
diff --git a/bbb/html/application/textfile/room4.txt b/html/application/textfile/room4.txt
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/application/textfile/room4.txt
rename to html/application/textfile/room4.txt
diff --git a/bbb/html/application/textfile/room5.txt b/html/application/textfile/room5.txt
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/application/textfile/room5.txt
rename to html/application/textfile/room5.txt
diff --git a/bbb/html/application/textfile/room6.txt b/html/application/textfile/room6.txt
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/application/textfile/room6.txt
rename to html/application/textfile/room6.txt
diff --git a/bbb/html/application/textfile/room7.txt b/html/application/textfile/room7.txt
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/application/textfile/room7.txt
rename to html/application/textfile/room7.txt
diff --git a/bbb/html/application/textfile/spotprice.txt b/html/application/textfile/spotprice.txt
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/application/textfile/spotprice.txt
rename to html/application/textfile/spotprice.txt
diff --git a/bbb/html/application/textfile/spotprice2.txt b/html/application/textfile/spotprice2.txt
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/application/textfile/spotprice2.txt
rename to html/application/textfile/spotprice2.txt
diff --git a/bbb/html/application/textfile/temperature.txt b/html/application/textfile/temperature.txt
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/application/textfile/temperature.txt
rename to html/application/textfile/temperature.txt
diff --git a/bbb/html/index.php b/html/index.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/index.php
rename to html/index.php
diff --git a/bbb/html/js/_1.11.4_jquery-ui.js b/html/js/_1.11.4_jquery-ui.js
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/js/_1.11.4_jquery-ui.js
rename to html/js/_1.11.4_jquery-ui.js
diff --git a/bbb/html/js/canvasjs.min.js b/html/js/canvasjs.min.js
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/js/canvasjs.min.js
rename to html/js/canvasjs.min.js
diff --git a/bbb/html/js/jquery-1.10.2.js b/html/js/jquery-1.10.2.js
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/js/jquery-1.10.2.js
rename to html/js/jquery-1.10.2.js
diff --git a/bbb/html/js/jquery-1.7.1.min.js b/html/js/jquery-1.7.1.min.js
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/js/jquery-1.7.1.min.js
rename to html/js/jquery-1.7.1.min.js
diff --git a/bbb/html/js/jquery-ui-1.8.17.custom.min.js b/html/js/jquery-ui-1.8.17.custom.min.js
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/js/jquery-ui-1.8.17.custom.min.js
rename to html/js/jquery-ui-1.8.17.custom.min.js
diff --git a/bbb/html/js/jquery.min.js b/html/js/jquery.min.js
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/js/jquery.min.js
rename to html/js/jquery.min.js
diff --git a/bbb/html/js/less.js b/html/js/less.js
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/js/less.js
rename to html/js/less.js
diff --git a/bbb/html/js/modernizr/2.6.1_smallest.js b/html/js/modernizr/2.6.1_smallest.js
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/js/modernizr/2.6.1_smallest.js
rename to html/js/modernizr/2.6.1_smallest.js
diff --git a/bbb/html/js/script.js b/html/js/script.js
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/js/script.js
rename to html/js/script.js
diff --git a/bbb/html/phpinfo.php b/html/phpinfo.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/phpinfo.php
rename to html/phpinfo.php
diff --git a/bbb/html/src/CBehovsboboxen/403.tpl.php b/html/src/CBehovsboboxen/403.tpl.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CBehovsboboxen/403.tpl.php
rename to html/src/CBehovsboboxen/403.tpl.php
diff --git a/bbb/html/src/CBehovsboboxen/404.tpl.php b/html/src/CBehovsboboxen/404.tpl.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CBehovsboboxen/404.tpl.php
rename to html/src/CBehovsboboxen/404.tpl.php
diff --git a/bbb/html/src/CBehovsboboxen/CBehovsboboxen.php b/html/src/CBehovsboboxen/CBehovsboboxen.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CBehovsboboxen/CBehovsboboxen.php
rename to html/src/CBehovsboboxen/CBehovsboboxen.php
diff --git a/bbb/html/src/CCAdminControlPanel/CCAdminControlPanel.php b/html/src/CCAdminControlPanel/CCAdminControlPanel.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CCAdminControlPanel/CCAdminControlPanel.php
rename to html/src/CCAdminControlPanel/CCAdminControlPanel.php
diff --git a/bbb/html/src/CCAdminControlPanel/index.tpl.php b/html/src/CCAdminControlPanel/index.tpl.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CCAdminControlPanel/index.tpl.php
rename to html/src/CCAdminControlPanel/index.tpl.php
diff --git a/bbb/html/src/CCAdminControlPanel/temperatures.tpl.php b/html/src/CCAdminControlPanel/temperatures.tpl.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CCAdminControlPanel/temperatures.tpl.php
rename to html/src/CCAdminControlPanel/temperatures.tpl.php
diff --git a/bbb/html/src/CCIndex/CCIndex.php b/html/src/CCIndex/CCIndex.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CCIndex/CCIndex.php
rename to html/src/CCIndex/CCIndex.php
diff --git a/bbb/html/src/CCPresentation/CCPresentation.php b/html/src/CCPresentation/CCPresentation.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CCPresentation/CCPresentation.php
rename to html/src/CCPresentation/CCPresentation.php
diff --git a/bbb/html/src/CCPresentation/index.tpl.php b/html/src/CCPresentation/index.tpl.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CCPresentation/index.tpl.php
rename to html/src/CCPresentation/index.tpl.php
diff --git a/bbb/html/src/CCSpotprices/CCSpotprices.php b/html/src/CCSpotprices/CCSpotprices.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CCSpotprices/CCSpotprices.php
rename to html/src/CCSpotprices/CCSpotprices.php
diff --git a/bbb/html/src/CCSpotprices/index.tpl.php b/html/src/CCSpotprices/index.tpl.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CCSpotprices/index.tpl.php
rename to html/src/CCSpotprices/index.tpl.php
diff --git a/bbb/html/src/CCUser/403.tpl.php b/html/src/CCUser/403.tpl.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CCUser/403.tpl.php
rename to html/src/CCUser/403.tpl.php
diff --git a/bbb/html/src/CCUser/CCUser.php b/html/src/CCUser/CCUser.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CCUser/CCUser.php
rename to html/src/CCUser/CCUser.php
diff --git a/bbb/html/src/CCUser/login.tpl.php b/html/src/CCUser/login.tpl.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CCUser/login.tpl.php
rename to html/src/CCUser/login.tpl.php
diff --git a/bbb/html/src/CDatabase/CDatabase.php b/html/src/CDatabase/CDatabase.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CDatabase/CDatabase.php
rename to html/src/CDatabase/CDatabase.php
diff --git a/bbb/html/src/CForm/CForm.php b/html/src/CForm/CForm.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CForm/CForm.php
rename to html/src/CForm/CForm.php
diff --git a/bbb/html/src/CForm/README.md b/html/src/CForm/README.md
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CForm/README.md
rename to html/src/CForm/README.md
diff --git a/bbb/html/src/CFormUser/CFormUser.php b/html/src/CFormUser/CFormUser.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CFormUser/CFormUser.php
rename to html/src/CFormUser/CFormUser.php
diff --git a/bbb/html/src/CInterceptionFilter/CInterceptionFilter.php b/html/src/CInterceptionFilter/CInterceptionFilter.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CInterceptionFilter/CInterceptionFilter.php
rename to html/src/CInterceptionFilter/CInterceptionFilter.php
diff --git a/bbb/html/src/CLog/CLog.php b/html/src/CLog/CLog.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CLog/CLog.php
rename to html/src/CLog/CLog.php
diff --git a/bbb/html/src/CMTemperatures/CMTemperatures.php b/html/src/CMTemperatures/CMTemperatures.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CMTemperatures/CMTemperatures.php
rename to html/src/CMTemperatures/CMTemperatures.php
diff --git a/bbb/html/src/CMTextfiles/CMTextfiles.php b/html/src/CMTextfiles/CMTextfiles.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CMTextfiles/CMTextfiles.php
rename to html/src/CMTextfiles/CMTextfiles.php
diff --git a/bbb/html/src/CMTranslate/CMTranslate.php b/html/src/CMTranslate/CMTranslate.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CMTranslate/CMTranslate.php
rename to html/src/CMTranslate/CMTranslate.php
diff --git a/bbb/html/src/CMUser/CMUser.php b/html/src/CMUser/CMUser.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CMUser/CMUser.php
rename to html/src/CMUser/CMUser.php
diff --git a/bbb/html/src/CObject/CObject.php b/html/src/CObject/CObject.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CObject/CObject.php
rename to html/src/CObject/CObject.php
diff --git a/bbb/html/src/CPageLoader/CPageLoader.php b/html/src/CPageLoader/CPageLoader.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CPageLoader/CPageLoader.php
rename to html/src/CPageLoader/CPageLoader.php
diff --git a/bbb/html/src/CRequest/CRequest.php b/html/src/CRequest/CRequest.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CRequest/CRequest.php
rename to html/src/CRequest/CRequest.php
diff --git a/bbb/html/src/CSession/CSession.php b/html/src/CSession/CSession.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CSession/CSession.php
rename to html/src/CSession/CSession.php
diff --git a/bbb/html/src/CViewContainer/404.tpl.php b/html/src/CViewContainer/404.tpl.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CViewContainer/404.tpl.php
rename to html/src/CViewContainer/404.tpl.php
diff --git a/bbb/html/src/CViewContainer/CViewContainer.php b/html/src/CViewContainer/CViewContainer.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/CViewContainer/CViewContainer.php
rename to html/src/CViewContainer/CViewContainer.php
diff --git a/bbb/html/src/IController/IController.php b/html/src/IController/IController.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/IController/IController.php
rename to html/src/IController/IController.php
diff --git a/bbb/html/src/IHasSQL/IHasSQL.php b/html/src/IHasSQL/IHasSQL.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/IHasSQL/IHasSQL.php
rename to html/src/IHasSQL/IHasSQL.php
diff --git a/bbb/html/src/IModule/IModule.php b/html/src/IModule/IModule.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/IModule/IModule.php
rename to html/src/IModule/IModule.php
diff --git a/bbb/html/src/ISingleton/ISingleton.php b/html/src/ISingleton/ISingleton.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/ISingleton/ISingleton.php
rename to html/src/ISingleton/ISingleton.php
diff --git a/bbb/html/src/bootstrap.php b/html/src/bootstrap.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/src/bootstrap.php
rename to html/src/bootstrap.php
diff --git a/bbb/html/themes/bb/box.jpg b/html/themes/bb/box.jpg
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/bb/box.jpg
rename to html/themes/bb/box.jpg
diff --git a/bbb/html/themes/bb/default.tpl.php b/html/themes/bb/default.tpl.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/bb/default.tpl.php
rename to html/themes/bb/default.tpl.php
diff --git a/bbb/html/themes/bb/index.tpl.php b/html/themes/bb/index.tpl.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/bb/index.tpl.php
rename to html/themes/bb/index.tpl.php
diff --git a/bbb/html/themes/bb/jquery_ui.css b/html/themes/bb/jquery_ui.css
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/bb/jquery_ui.css
rename to html/themes/bb/jquery_ui.css
diff --git a/bbb/html/themes/bb/smallbox.jpg b/html/themes/bb/smallbox.jpg
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/bb/smallbox.jpg
rename to html/themes/bb/smallbox.jpg
diff --git a/bbb/html/themes/bb/style.css b/html/themes/bb/style.css
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/bb/style.css
rename to html/themes/bb/style.css
diff --git a/bbb/html/themes/functions.php b/html/themes/functions.php
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/functions.php
rename to html/themes/functions.php
diff --git a/bbb/html/themes/images/aqua_dayDown.gif b/html/themes/images/aqua_dayDown.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/aqua_dayDown.gif
rename to html/themes/images/aqua_dayDown.gif
diff --git a/bbb/html/themes/images/aqua_dayNormal.gif b/html/themes/images/aqua_dayNormal.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/aqua_dayNormal.gif
rename to html/themes/images/aqua_dayNormal.gif
diff --git a/bbb/html/themes/images/aqua_dayOver.gif b/html/themes/images/aqua_dayOver.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/aqua_dayOver.gif
rename to html/themes/images/aqua_dayOver.gif
diff --git a/bbb/html/themes/images/armygreen_dayDown.gif b/html/themes/images/armygreen_dayDown.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/armygreen_dayDown.gif
rename to html/themes/images/armygreen_dayDown.gif
diff --git a/bbb/html/themes/images/armygreen_dayNormal.gif b/html/themes/images/armygreen_dayNormal.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/armygreen_dayNormal.gif
rename to html/themes/images/armygreen_dayNormal.gif
diff --git a/bbb/html/themes/images/armygreen_dayOver.gif b/html/themes/images/armygreen_dayOver.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/armygreen_dayOver.gif
rename to html/themes/images/armygreen_dayOver.gif
diff --git a/bbb/html/themes/images/background-grad.png b/html/themes/images/background-grad.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/background-grad.png
rename to html/themes/images/background-grad.png
diff --git a/bbb/html/themes/images/bananasplit_dayDown.gif b/html/themes/images/bananasplit_dayDown.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/bananasplit_dayDown.gif
rename to html/themes/images/bananasplit_dayDown.gif
diff --git a/bbb/html/themes/images/bananasplit_dayNormal.gif b/html/themes/images/bananasplit_dayNormal.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/bananasplit_dayNormal.gif
rename to html/themes/images/bananasplit_dayNormal.gif
diff --git a/bbb/html/themes/images/bananasplit_dayOver.gif b/html/themes/images/bananasplit_dayOver.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/bananasplit_dayOver.gif
rename to html/themes/images/bananasplit_dayOver.gif
diff --git a/bbb/html/themes/images/beige_dayDown.gif b/html/themes/images/beige_dayDown.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/beige_dayDown.gif
rename to html/themes/images/beige_dayDown.gif
diff --git a/bbb/html/themes/images/beige_dayNormal.gif b/html/themes/images/beige_dayNormal.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/beige_dayNormal.gif
rename to html/themes/images/beige_dayNormal.gif
diff --git a/bbb/html/themes/images/beige_dayOver.gif b/html/themes/images/beige_dayOver.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/beige_dayOver.gif
rename to html/themes/images/beige_dayOver.gif
diff --git a/bbb/html/themes/images/bg_header.jpg b/html/themes/images/bg_header.jpg
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/bg_header.jpg
rename to html/themes/images/bg_header.jpg
diff --git a/bbb/html/themes/images/boxBottomLeftCorner.png b/html/themes/images/boxBottomLeftCorner.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/boxBottomLeftCorner.png
rename to html/themes/images/boxBottomLeftCorner.png
diff --git a/bbb/html/themes/images/boxBottomRightCorner.png b/html/themes/images/boxBottomRightCorner.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/boxBottomRightCorner.png
rename to html/themes/images/boxBottomRightCorner.png
diff --git a/bbb/html/themes/images/boxSideWallPx.gif b/html/themes/images/boxSideWallPx.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/boxSideWallPx.gif
rename to html/themes/images/boxSideWallPx.gif
diff --git a/bbb/html/themes/images/boxSideWallPx.png b/html/themes/images/boxSideWallPx.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/boxSideWallPx.png
rename to html/themes/images/boxSideWallPx.png
diff --git a/bbb/html/themes/images/boxTopLeftCorner.png b/html/themes/images/boxTopLeftCorner.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/boxTopLeftCorner.png
rename to html/themes/images/boxTopLeftCorner.png
diff --git a/bbb/html/themes/images/boxTopPx.gif b/html/themes/images/boxTopPx.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/boxTopPx.gif
rename to html/themes/images/boxTopPx.gif
diff --git a/bbb/html/themes/images/boxTopPx.png b/html/themes/images/boxTopPx.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/boxTopPx.png
rename to html/themes/images/boxTopPx.png
diff --git a/bbb/html/themes/images/boxTopRightCorner.png b/html/themes/images/boxTopRightCorner.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/boxTopRightCorner.png
rename to html/themes/images/boxTopRightCorner.png
diff --git a/bbb/html/themes/images/bullet1.gif b/html/themes/images/bullet1.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/bullet1.gif
rename to html/themes/images/bullet1.gif
diff --git a/bbb/html/themes/images/calendar.png b/html/themes/images/calendar.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/calendar.png
rename to html/themes/images/calendar.png
diff --git a/bbb/html/themes/images/closeButton_down.gif b/html/themes/images/closeButton_down.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/closeButton_down.gif
rename to html/themes/images/closeButton_down.gif
diff --git a/bbb/html/themes/images/closeButton_normal.gif b/html/themes/images/closeButton_normal.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/closeButton_normal.gif
rename to html/themes/images/closeButton_normal.gif
diff --git a/bbb/html/themes/images/closeButton_over.gif b/html/themes/images/closeButton_over.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/closeButton_over.gif
rename to html/themes/images/closeButton_over.gif
diff --git a/bbb/html/themes/images/deepblue_dayDown.gif b/html/themes/images/deepblue_dayDown.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/deepblue_dayDown.gif
rename to html/themes/images/deepblue_dayDown.gif
diff --git a/bbb/html/themes/images/deepblue_dayNormal.gif b/html/themes/images/deepblue_dayNormal.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/deepblue_dayNormal.gif
rename to html/themes/images/deepblue_dayNormal.gif
diff --git a/bbb/html/themes/images/deepblue_dayOver.gif b/html/themes/images/deepblue_dayOver.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/deepblue_dayOver.gif
rename to html/themes/images/deepblue_dayOver.gif
diff --git a/bbb/html/themes/images/greenish_dayDown.gif b/html/themes/images/greenish_dayDown.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/greenish_dayDown.gif
rename to html/themes/images/greenish_dayDown.gif
diff --git a/bbb/html/themes/images/greenish_dayOver.gif b/html/themes/images/greenish_dayOver.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/greenish_dayOver.gif
rename to html/themes/images/greenish_dayOver.gif
diff --git a/bbb/html/themes/images/handle.png b/html/themes/images/handle.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/handle.png
rename to html/themes/images/handle.png
diff --git a/bbb/html/themes/images/header-corners.png b/html/themes/images/header-corners.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/header-corners.png
rename to html/themes/images/header-corners.png
diff --git a/bbb/html/themes/images/homeIcon.png b/html/themes/images/homeIcon.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/homeIcon.png
rename to html/themes/images/homeIcon.png
diff --git a/bbb/html/themes/images/lightgreen_dayDown.gif b/html/themes/images/lightgreen_dayDown.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/lightgreen_dayDown.gif
rename to html/themes/images/lightgreen_dayDown.gif
diff --git a/bbb/html/themes/images/lightgreen_dayNormal.gif b/html/themes/images/lightgreen_dayNormal.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/lightgreen_dayNormal.gif
rename to html/themes/images/lightgreen_dayNormal.gif
diff --git a/bbb/html/themes/images/lightgreen_dayOver.gif b/html/themes/images/lightgreen_dayOver.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/lightgreen_dayOver.gif
rename to html/themes/images/lightgreen_dayOver.gif
diff --git a/bbb/html/themes/images/loader.gif b/html/themes/images/loader.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/loader.gif
rename to html/themes/images/loader.gif
diff --git a/bbb/html/themes/images/monthBackward_down.gif b/html/themes/images/monthBackward_down.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/monthBackward_down.gif
rename to html/themes/images/monthBackward_down.gif
diff --git a/bbb/html/themes/images/monthBackward_normal.gif b/html/themes/images/monthBackward_normal.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/monthBackward_normal.gif
rename to html/themes/images/monthBackward_normal.gif
diff --git a/bbb/html/themes/images/monthBackward_over.gif b/html/themes/images/monthBackward_over.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/monthBackward_over.gif
rename to html/themes/images/monthBackward_over.gif
diff --git a/bbb/html/themes/images/monthForward_down.gif b/html/themes/images/monthForward_down.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/monthForward_down.gif
rename to html/themes/images/monthForward_down.gif
diff --git a/bbb/html/themes/images/monthForward_normal.gif b/html/themes/images/monthForward_normal.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/monthForward_normal.gif
rename to html/themes/images/monthForward_normal.gif
diff --git a/bbb/html/themes/images/monthForward_over.gif b/html/themes/images/monthForward_over.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/monthForward_over.gif
rename to html/themes/images/monthForward_over.gif
diff --git a/bbb/html/themes/images/ocean_blue_dayDown.gif b/html/themes/images/ocean_blue_dayDown.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/ocean_blue_dayDown.gif
rename to html/themes/images/ocean_blue_dayDown.gif
diff --git a/bbb/html/themes/images/ocean_blue_dayNormal.gif b/html/themes/images/ocean_blue_dayNormal.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/ocean_blue_dayNormal.gif
rename to html/themes/images/ocean_blue_dayNormal.gif
diff --git a/bbb/html/themes/images/ocean_blue_dayOver.gif b/html/themes/images/ocean_blue_dayOver.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/ocean_blue_dayOver.gif
rename to html/themes/images/ocean_blue_dayOver.gif
diff --git a/bbb/html/themes/images/orange_dayDown.gif b/html/themes/images/orange_dayDown.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/orange_dayDown.gif
rename to html/themes/images/orange_dayDown.gif
diff --git a/bbb/html/themes/images/orange_dayNormal.gif b/html/themes/images/orange_dayNormal.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/orange_dayNormal.gif
rename to html/themes/images/orange_dayNormal.gif
diff --git a/bbb/html/themes/images/orange_dayOver.gif b/html/themes/images/orange_dayOver.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/orange_dayOver.gif
rename to html/themes/images/orange_dayOver.gif
diff --git a/bbb/html/themes/images/peppermint_dayDown.gif b/html/themes/images/peppermint_dayDown.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/peppermint_dayDown.gif
rename to html/themes/images/peppermint_dayDown.gif
diff --git a/bbb/html/themes/images/peppermint_dayNormal.gif b/html/themes/images/peppermint_dayNormal.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/peppermint_dayNormal.gif
rename to html/themes/images/peppermint_dayNormal.gif
diff --git a/bbb/html/themes/images/peppermint_dayOver.gif b/html/themes/images/peppermint_dayOver.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/peppermint_dayOver.gif
rename to html/themes/images/peppermint_dayOver.gif
diff --git a/bbb/html/themes/images/pink_dayDown.gif b/html/themes/images/pink_dayDown.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/pink_dayDown.gif
rename to html/themes/images/pink_dayDown.gif
diff --git a/bbb/html/themes/images/pink_dayNormal.gif b/html/themes/images/pink_dayNormal.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/pink_dayNormal.gif
rename to html/themes/images/pink_dayNormal.gif
diff --git a/bbb/html/themes/images/pink_dayOver.gif b/html/themes/images/pink_dayOver.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/pink_dayOver.gif
rename to html/themes/images/pink_dayOver.gif
diff --git a/bbb/html/themes/images/purple_dayDown.gif b/html/themes/images/purple_dayDown.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/purple_dayDown.gif
rename to html/themes/images/purple_dayDown.gif
diff --git a/bbb/html/themes/images/purple_dayNormal.gif b/html/themes/images/purple_dayNormal.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/purple_dayNormal.gif
rename to html/themes/images/purple_dayNormal.gif
diff --git a/bbb/html/themes/images/purple_dayOver.gif b/html/themes/images/purple_dayOver.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/purple_dayOver.gif
rename to html/themes/images/purple_dayOver.gif
diff --git a/bbb/html/themes/images/torqoise_dayDown.gif b/html/themes/images/torqoise_dayDown.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/torqoise_dayDown.gif
rename to html/themes/images/torqoise_dayDown.gif
diff --git a/bbb/html/themes/images/torqoise_dayNormal.gif b/html/themes/images/torqoise_dayNormal.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/torqoise_dayNormal.gif
rename to html/themes/images/torqoise_dayNormal.gif
diff --git a/bbb/html/themes/images/torqoise_dayOver.gif b/html/themes/images/torqoise_dayOver.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/torqoise_dayOver.gif
rename to html/themes/images/torqoise_dayOver.gif
diff --git a/bbb/html/themes/images/ui-bg_diagonals-thick_18_b81900_40x40.png b/html/themes/images/ui-bg_diagonals-thick_18_b81900_40x40.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/ui-bg_diagonals-thick_18_b81900_40x40.png
rename to html/themes/images/ui-bg_diagonals-thick_18_b81900_40x40.png
diff --git a/bbb/html/themes/images/ui-bg_diagonals-thick_20_666666_40x40.png b/html/themes/images/ui-bg_diagonals-thick_20_666666_40x40.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/ui-bg_diagonals-thick_20_666666_40x40.png
rename to html/themes/images/ui-bg_diagonals-thick_20_666666_40x40.png
diff --git a/bbb/html/themes/images/ui-bg_flat_10_000000_40x100.png b/html/themes/images/ui-bg_flat_10_000000_40x100.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/ui-bg_flat_10_000000_40x100.png
rename to html/themes/images/ui-bg_flat_10_000000_40x100.png
diff --git a/bbb/html/themes/images/ui-bg_glass_100_f6f6f6_1x400.png b/html/themes/images/ui-bg_glass_100_f6f6f6_1x400.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/ui-bg_glass_100_f6f6f6_1x400.png
rename to html/themes/images/ui-bg_glass_100_f6f6f6_1x400.png
diff --git a/bbb/html/themes/images/ui-bg_glass_100_fdf5ce_1x400.png b/html/themes/images/ui-bg_glass_100_fdf5ce_1x400.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/ui-bg_glass_100_fdf5ce_1x400.png
rename to html/themes/images/ui-bg_glass_100_fdf5ce_1x400.png
diff --git a/bbb/html/themes/images/ui-bg_glass_65_ffffff_1x400.png b/html/themes/images/ui-bg_glass_65_ffffff_1x400.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/ui-bg_glass_65_ffffff_1x400.png
rename to html/themes/images/ui-bg_glass_65_ffffff_1x400.png
diff --git a/bbb/html/themes/images/ui-bg_gloss-wave_35_f6a828_500x100.png b/html/themes/images/ui-bg_gloss-wave_35_f6a828_500x100.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/ui-bg_gloss-wave_35_f6a828_500x100.png
rename to html/themes/images/ui-bg_gloss-wave_35_f6a828_500x100.png
diff --git a/bbb/html/themes/images/ui-bg_highlight-soft_100_eeeeee_1x100.png b/html/themes/images/ui-bg_highlight-soft_100_eeeeee_1x100.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/ui-bg_highlight-soft_100_eeeeee_1x100.png
rename to html/themes/images/ui-bg_highlight-soft_100_eeeeee_1x100.png
diff --git a/bbb/html/themes/images/ui-bg_highlight-soft_75_ffe45c_1x100.png b/html/themes/images/ui-bg_highlight-soft_75_ffe45c_1x100.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/ui-bg_highlight-soft_75_ffe45c_1x100.png
rename to html/themes/images/ui-bg_highlight-soft_75_ffe45c_1x100.png
diff --git a/bbb/html/themes/images/ui-icons_222222_256x240.png b/html/themes/images/ui-icons_222222_256x240.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/ui-icons_222222_256x240.png
rename to html/themes/images/ui-icons_222222_256x240.png
diff --git a/bbb/html/themes/images/ui-icons_228ef1_256x240.png b/html/themes/images/ui-icons_228ef1_256x240.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/ui-icons_228ef1_256x240.png
rename to html/themes/images/ui-icons_228ef1_256x240.png
diff --git a/bbb/html/themes/images/ui-icons_ef8c08_256x240.png b/html/themes/images/ui-icons_ef8c08_256x240.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/ui-icons_ef8c08_256x240.png
rename to html/themes/images/ui-icons_ef8c08_256x240.png
diff --git a/bbb/html/themes/images/ui-icons_ffd27a_256x240.png b/html/themes/images/ui-icons_ffd27a_256x240.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/ui-icons_ffd27a_256x240.png
rename to html/themes/images/ui-icons_ffd27a_256x240.png
diff --git a/bbb/html/themes/images/ui-icons_ffffff_256x240.png b/html/themes/images/ui-icons_ffffff_256x240.png
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/ui-icons_ffffff_256x240.png
rename to html/themes/images/ui-icons_ffffff_256x240.png
diff --git a/bbb/html/themes/images/yearBackward_down.gif b/html/themes/images/yearBackward_down.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/yearBackward_down.gif
rename to html/themes/images/yearBackward_down.gif
diff --git a/bbb/html/themes/images/yearBackward_normal.gif b/html/themes/images/yearBackward_normal.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/yearBackward_normal.gif
rename to html/themes/images/yearBackward_normal.gif
diff --git a/bbb/html/themes/images/yearBackward_over.gif b/html/themes/images/yearBackward_over.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/yearBackward_over.gif
rename to html/themes/images/yearBackward_over.gif
diff --git a/bbb/html/themes/images/yearForward_down.gif b/html/themes/images/yearForward_down.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/yearForward_down.gif
rename to html/themes/images/yearForward_down.gif
diff --git a/bbb/html/themes/images/yearForward_normal.gif b/html/themes/images/yearForward_normal.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/yearForward_normal.gif
rename to html/themes/images/yearForward_normal.gif
diff --git a/bbb/html/themes/images/yearForward_over.gif b/html/themes/images/yearForward_over.gif
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/html/themes/images/yearForward_over.gif
rename to html/themes/images/yearForward_over.gif
diff --git a/install.sh b/install.sh
old mode 100644
new mode 100755
index 6b039aa..61c833d
--- a/install.sh
+++ b/install.sh
@@ -1,128 +1,200 @@
-#!/bin/sh
-#2016-01-28 18.00
+#! /bin/sh
+#
+#
+#
+# install.sh
+#
+# Description: Installs BehovsBoBoxen
+#
+# Usage: install.sh {web|all} {x}
+#
+# web - update the web server part
+# all - installs the complete system including update/upgrade of system, install of additional packages etc.
+# x - If a second argument is specified, Domoticz support is installed, i.e. bbb_domoticz.py will be the
+# control process.
+#
+
+LOGFILE = "/var/log/bbb"
+
+if [ -z "$2" ]
+then
+
+ DOMOTICZ=1
+ echo "No Domoticz support"
+else
+ DOMOTICZ=0
+ echo "Domoticz support"
+fi
+
+
+# Set true (0) if support for Domoticz control is desired
+# Will use bbb_add/bbb_domoticz.py as control system and install startup script
+# rc.local will not modified
+#
+#
+
+
+
+#
+# Function updates the webb application
+#
+do_web()
+{
+ echo "Update BehovsBoBoxen webb application"
+ sudo chmod 755 /var/www -R
+# full file permissions
+
+ sudo cp -R /home/pi/BehovsBoBoxen/html /var/www
+# copies the files for the web-interface
+ sudo chmod 755 /var/www/html -R
+# restore file permissions
+
+ sudo chmod 777 /var/www/html/application/textfile -R
+ sudo chmod 777 /var/www/html/application/data -R
+ sudo chmod 777 /var/www/html/application/data/.ht.sqlite3
+ sudo chmod 777 /var/www/html/src/CCSpotprices/CCSpotprices.php
+# full file permissions
+
+ sudo rm -f /var/www/html/index.html
+# remove above file
+
+ echo "Webb application updated"
+ RETVAL="$?"
+ return "$RETVAL"
+}
+
+#
+# Function that installs the whole BehovsBoBoxen
+#
+do_all()
+{
+ echo "Install BehovsBoBoxen"
+ sudo apt-get update -y
+# gets Raspian updates
+
+ sudo apt-get upgrade -y
+# installs Raspian updates
+
+ sudo apt-get install vsftpd -y
+# installs ftp programme
+
+ sudo apt-get install apache2 php5 libapache2-mod-php5 -y
+# installs webserver and php library
+
+ sudo apt-get install sqlite3
+# installs sqlite3
+
+ sudo apt-get install php5-sqlite
+# installs php-sqlite
+
+ sudo a2enmod rewrite
+# activates mod_rewrite
+
+ sudo service apache2 restart
+# restarts apache2
+
+ sudo rm -f /var/www/html -R
+
+ sudo chmod 777 /home/pi/BehovsBoBoxen -R
+# full file permissions for the the BehovsBoBoxen-repository from github
+
+ if [ $DOMOTICZ ]
+ then
+ echo "Install Domoticz support"
+ sudo cp /home/pi/BehovsBoBoxen/scripts/bbb_domoticz.sh /etc/init.d
+ sudo chmod 755 /etc/init.d/bbb_domoticz.sh
+ sudo update-rc.d bbb_domoticz.sh defaults
+ [ -e $LOGFILE ] || mkdir $LOGFILE
+ else
+ sudo cp /home/pi/BehovsBoBoxen/scripts/rc.local /etc/rc.local
+ sudo chmod 755 /etc/rc.local
+# copies and change path for the file that starts the box at reboot
+ fi
-sudo apt-get update -y
-#gets Raspian updates
+ do_web
-sudo apt-get upgrade -y
-#installs Raspian updates
+# sudo crontab -l -u root | cat /home/pi/BehovsBoBoxen/scripts/cron.txt | sudo crontab -u root -
+# we get the new spotpricefile after 16:00 and recalculate the temperatures afte
-sudo apt-get install vsftpd -y
-#installs ftp programme
-sudo apt-get install apache2 php5 libapache2-mod-php5 -y
-#installs webserver and php library
+ cat /boot/config.txt |grep "dtoverlay=w1-gpio,gpiopin=4" || echo "dtoverlay=w1-gpio,gpiopin=4" | sudo tee -a /boot/config.txt
+# append "dtoverlay=..." to /boot/config.txt unless it's already there
+#
+
+ echo "Enable SSL mode"
+ sudo a2enmod ssl
+ sudo service apache2 restart
+# enable mod_ssl
+
+ sudo chmod 777 /etc/apache2 -R
+
+ sudo rm -f /etc/apache2/apache2.conf
+ sudo cp /home/pi/BehovsBoBoxen/scripts/apache2.conf /etc/apache2/apache2.conf
+# AllowOverride All
-sudo apt-get install sqlite3
-#installs sqlite3
+# sudo mkdir /etc/apache2/ssl
+ sudo cp -rp /home/pi/BehovsBoBoxen/ssl /etc/apache2
+ sudo chmod 777 /etc/apache2/ssl -R
+# adds ssl repository, to hold key and cerificate
+
+ echo "Generate selfsigned certificate"
+ sudo openssl req -x509 -nodes -days 1095 -newkey rsa:2048 -out /etc/apache2/ssl/behovsboboxen.crt -keyout /etc/apache2/ssl/behovsboboxen.key -subj "/C=SE/ST=Sverige/L=Molndal/O=/OU=/CN=behovsboboxen"
-sudo apt-get install php5-sqlite
-#installs php-sqlite
-
-sudo a2enmod rewrite
-#activates mod_rewrite
-
-sudo service apache2 restart
-#restarts apache2
-
-sudo chmod 777 /home/pi/BehovsBoBoxen/bbb -R
-
-mkdir /home/pi/bbb
-sudo chmod 777 /home/pi/bbb -R
-sudo cp /home/pi/BehovsBoBoxen/bbb -R /home/pi
-sudo rm -f /home/pi/BehovsBoBoxen/html -R
-sudo rm -f /home/pi/BehovsBoBoxen/ssl -R
-sudo rm -f /home/pi/BehovsBoBoxen/scripts -R
-sudo rm -f /home/pi/BehovsBoBoxen/LICENSE.txt
-sudo rm -f /home/pi/BehovsBoBoxen/README.md
-sudo rm -f /home/pi/BehovsBoBoxen/.htaccess
-sudo cp /home/pi/bbb/html -R /home/pi/BehovsBoBoxen
-sudo cp /home/pi/bbb/ssl -R /home/pi/BehovsBoBoxen
-sudo cp /home/pi/bbb/scripts -R /home/pi/BehovsBoBoxen
-sudo cp /home/pi/bbb/LICENSE.txt /home/pi/BehovsBoBoxen
-sudo cp /home/pi/bbb/README.md /home/pi/BehovsBoBoxen
-sudo cp /home/pi/bbb/.htaccess /home/pi/BehovsBoBoxen
-sudo rm -f /home/pi/bbb/ -R
-sudo rm -f /var/www/html -R
-sudo rm /home/pi/BehovsBoBoxen/bbb -R
-sudo chmod 777 /etc/rc.local
-sudo rm -f /etc/rc.local
-
-sudo chmod 777 /home/pi/BehovsBoBoxen -R
-#full file permissions for the the BehovsBoBoxen-repository from github
-
-sudo cp /home/pi/BehovsBoBoxen/scripts/rc.local /etc/rc.local
-#copies and change path for the file that starts the box at reboot
-sudo chmod 755 /etc/rc.local
-
-sudo chmod 777 /var/www -R
-#full file permissions
-
-sudo cp -R /home/pi/BehovsBoBoxen/html /var/www
-#copies the files for the web-interface
-sudo chmod 755 /var/www/html -R
-#restore file permissions
-
-sudo chmod 777 /var/www/html/application/textfile -R
-sudo chmod 777 /var/www/html/application/data -R
-sudo chmod 777 /var/www/html/application/data/.ht.sqlite3
-sudo chmod 777 /var/www/html/src/CCSpotprices/CCSpotprices.php
-#full file permissions
-
-sudo crontab -l -u root | cat /home/pi/BehovsBoBoxen/scripts/cron.txt | sudo crontab -u root -
-#we get the new spotpricefile after 16:00 and recalculate the temperatures after 00:00
-
-echo "dtoverlay=w1-gpio,gpiopin=4" | sudo tee -a /boot/config.txt
+# req request
+#-nodes if a private key is created it will not be encrypted
+#-newkey creates a new certificate request and a new private key
+#rsa:2048 generates an RSA key 2048 bits in size
+#-keyout the filename to write the newly created private key to
+#-out specifies the output filename
+#-subj sets certificate subject
+#x509 certificate display and signing utility
+#-subj arg Replaces subject field of input request with specified data and
-sudo rm -f /var/www/html/index.html
-#remove above file
+ echo "Certificate done"
+ sudo rm -f /etc/apache2/sites-available/default-ssl.conf
-sudo a2enmod ssl
-sudo service apache2 restart
-#enable mod_ssl
+ sudo cp -rp /home/pi/BehovsBoBoxen/scripts/default-ssl /etc/apache2/sites-available/default-ssl
+ sudo cp -rp /home/pi/BehovsBoBoxen/scripts/000-default-ssl /etc/apache2/sites-enabled/000-default-ssl
+# symlink text, -p keeps file permissions from host to receiver
-sudo chmod 777 /etc/apache2 -R
+ sudo cp -rp /home/pi/BehovsBoBoxen/scripts/default-ssl.conf /etc/apache2/sites-available/default-ssl.conf
+ sudo cp -rp /home/pi/BehovsBoBoxen/scripts/default-ssl.conf /etc/apache2/sites-enabled/default-ssl.conf
+# 443
-sudo rm -f /etc/apache2/apache2.conf
-sudo cp /home/pi/BehovsBoBoxen/scripts/apache2.conf /etc/apache2/apache2.conf
-#AllowOverride All
+ sudo chmod 755 /etc/apache2
+ sudo chmod 755 /etc/apache2/ssl
+ sudo chmod 755 /home/pi/BehovsBoBoxen
+# restores file permissions
-#sudo mkdir /etc/apache2/ssl
-sudo cp -rp /home/pi/BehovsBoBoxen/ssl /etc/apache2
-sudo chmod 777 /etc/apache2/ssl -R
-#adds ssl repository, to hold key and cerificate
-sudo openssl req -x509 -nodes -days 1095 -newkey rsa:2048 -out /etc/apache2/ssl/behovsboboxen.crt -keyout /etc/apache2/ssl/behovsboboxen.key -subj "/C=SE/ST=Sverige/L=Molndal/O=/OU=/CN=behovsboboxen"
+ sudo /etc/init.d/apache2 restart
+# restarts apache2
-# req request
-#-nodes if a private key is created it will not be encrypted
-#-newkey creates a new certificate request and a new private key
-#rsa:2048 generates an RSA key 2048 bits in size
-#-keyout the filename to write the newly created private key to
-#-out specifies the output filename
-#-subj sets certificate subject
-#x509 certificate display and signing utility
-#-subj arg Replaces subject field of input request with specified data and outputs modified request. The arg must be formatted as /type0=value0/type1=value1/type2=..., characters may be escaped by \ (backslash), no spaces are skipped.
-sudo rm -f /etc/apache2/sites-available/default-ssl.conf
+ echo "installation ok, the system will restart"
+ sudo reboot
-sudo cp -rp /home/pi/BehovsBoBoxen/scripts/default-ssl /etc/apache2/sites-available/default-ssl
-sudo cp -rp /home/pi/BehovsBoBoxen/scripts/000-default-ssl /etc/apache2/sites-enabled/000-default-ssl
-#symlink text, -p keeps file permissions from host to receiver
-sudo cp -rp /home/pi/BehovsBoBoxen/scripts/default-ssl.conf /etc/apache2/sites-available/default-ssl.conf
-sudo cp -rp /home/pi/BehovsBoBoxen/scripts/default-ssl.conf /etc/apache2/sites-enabled/default-ssl.conf
-#443
+
-sudo chmod 755 /etc/apache2
-sudo chmod 755 /etc/apache2/ssl
-sudo chmod 755 /home/pi/BehovsBoBoxen
-#restores file permissions
+ RETVAL="$?"
+ return "$RETVAL"
+}
-sudo /etc/init.d/apache2 restart
-#restarts apache2
+case "$1" in
+ web)
+ do_web
+ ;;
+ all)
+ do_all
+ ;;
+
-echo "installation ok, the system will restart" | sudo tee -a /boot/config.txt
+ *)
+ echo "Usage: $SCRIPTNAME {web|all}"
+ exit 3
+ ;;
+esac
-sudo reboot
\ No newline at end of file
+:
diff --git a/install.sh~ b/install.sh~
new file mode 100755
index 0000000..fd7db8e
--- /dev/null
+++ b/install.sh~
@@ -0,0 +1,198 @@
+#! /bin/sh
+#
+#
+#
+# install.sh
+#
+# Description: Installs BehovsBoBoxen
+#
+# Usage: install.sh {web|all} {x}
+#
+# web - update the web server part
+# all - installs the complete system including update/upgrade of system, install of additional packages etc.
+# x - If a second argument is specified, Domoticz support is installed, i.e. bbb_domoticz.py will be the
+# control process.
+#
+
+if [ -z "$2" ]
+then
+
+ DOMOTICZ=1
+ echo "No Domoticz support"
+else
+ DOMOTICZ=0
+ echo "Domoticz support"
+fi
+
+
+# Set true (0) if support for Domoticz control is desired
+# Will use bbb_add/bbb_domoticz.py as control system and install startup script
+# rc.local will not modified
+#
+#
+
+
+
+#
+# Function updates the webb application
+#
+do_web()
+{
+ echo "Update BehovsBoBoxen webb application"
+ sudo chmod 755 /var/www -R
+# full file permissions
+
+ sudo cp -R /home/pi/BehovsBoBoxen/html /var/www
+# copies the files for the web-interface
+ sudo chmod 755 /var/www/html -R
+# restore file permissions
+
+ sudo chmod 777 /var/www/html/application/textfile -R
+ sudo chmod 777 /var/www/html/application/data -R
+ sudo chmod 777 /var/www/html/application/data/.ht.sqlite3
+ sudo chmod 777 /var/www/html/src/CCSpotprices/CCSpotprices.php
+# full file permissions
+
+ sudo rm -f /var/www/html/index.html
+# remove above file
+
+ echo "Webb application updated"
+ RETVAL="$?"
+ return "$RETVAL"
+}
+
+#
+# Function that installs the whole BehovsBoBoxen
+#
+do_all()
+{
+ echo "Install BehovsBoBoxen"
+ sudo apt-get update -y
+# gets Raspian updates
+
+ sudo apt-get upgrade -y
+# installs Raspian updates
+
+ sudo apt-get install vsftpd -y
+# installs ftp programme
+
+ sudo apt-get install apache2 php5 libapache2-mod-php5 -y
+# installs webserver and php library
+
+ sudo apt-get install sqlite3
+# installs sqlite3
+
+ sudo apt-get install php5-sqlite
+# installs php-sqlite
+
+ sudo a2enmod rewrite
+# activates mod_rewrite
+
+ sudo service apache2 restart
+# restarts apache2
+
+ sudo rm -f /var/www/html -R
+
+ sudo chmod 777 /home/pi/BehovsBoBoxen -R
+# full file permissions for the the BehovsBoBoxen-repository from github
+
+ if [ $DOMOTICZ ]
+ then
+ echo "Install Domoticz support"
+ sudo cp /home/pi/BehovsBoBoxen/scripts/bbb_domoticz.sh /etc/init.d
+ sudo chmod 755 /etc/init.d/bbb_domoticz.sh
+ sudo update-rc.d bbb_domoticz.sh defaults
+
+ else
+ sudo cp /home/pi/BehovsBoBoxen/scripts/rc.local /etc/rc.local
+ sudo chmod 755 /etc/rc.local
+# copies and change path for the file that starts the box at reboot
+ fi
+
+ do_web
+
+# sudo crontab -l -u root | cat /home/pi/BehovsBoBoxen/scripts/cron.txt | sudo crontab -u root -
+# we get the new spotpricefile after 16:00 and recalculate the temperatures afte
+
+
+ cat /boot/config.txt |grep "dtoverlay=w1-gpio,gpiopin=4" || echo "dtoverlay=w1-gpio,gpiopin=4" | sudo tee -a /boot/config.txt
+# append "dtoverlay=..." to /boot/config.txt unless it's already there
+#
+
+ echo "Enable SSL mode"
+ sudo a2enmod ssl
+ sudo service apache2 restart
+# enable mod_ssl
+
+ sudo chmod 777 /etc/apache2 -R
+
+ sudo rm -f /etc/apache2/apache2.conf
+ sudo cp /home/pi/BehovsBoBoxen/scripts/apache2.conf /etc/apache2/apache2.conf
+# AllowOverride All
+
+# sudo mkdir /etc/apache2/ssl
+ sudo cp -rp /home/pi/BehovsBoBoxen/ssl /etc/apache2
+ sudo chmod 777 /etc/apache2/ssl -R
+# adds ssl repository, to hold key and cerificate
+
+ echo "Generate selfsigned certificate"
+ sudo openssl req -x509 -nodes -days 1095 -newkey rsa:2048 -out /etc/apache2/ssl/behovsboboxen.crt -keyout /etc/apache2/ssl/behovsboboxen.key -subj "/C=SE/ST=Sverige/L=Molndal/O=/OU=/CN=behovsboboxen"
+
+# req request
+#-nodes if a private key is created it will not be encrypted
+#-newkey creates a new certificate request and a new private key
+#rsa:2048 generates an RSA key 2048 bits in size
+#-keyout the filename to write the newly created private key to
+#-out specifies the output filename
+#-subj sets certificate subject
+#x509 certificate display and signing utility
+#-subj arg Replaces subject field of input request with specified data and
+
+ echo "Certificate done"
+ sudo rm -f /etc/apache2/sites-available/default-ssl.conf
+
+ sudo cp -rp /home/pi/BehovsBoBoxen/scripts/default-ssl /etc/apache2/sites-available/default-ssl
+ sudo cp -rp /home/pi/BehovsBoBoxen/scripts/000-default-ssl /etc/apache2/sites-enabled/000-default-ssl
+# symlink text, -p keeps file permissions from host to receiver
+
+ sudo cp -rp /home/pi/BehovsBoBoxen/scripts/default-ssl.conf /etc/apache2/sites-available/default-ssl.conf
+ sudo cp -rp /home/pi/BehovsBoBoxen/scripts/default-ssl.conf /etc/apache2/sites-enabled/default-ssl.conf
+# 443
+
+ sudo chmod 755 /etc/apache2
+ sudo chmod 755 /etc/apache2/ssl
+ sudo chmod 755 /home/pi/BehovsBoBoxen
+# restores file permissions
+
+
+ sudo /etc/init.d/apache2 restart
+# restarts apache2
+
+
+
+ echo "installation ok, the system will restart"
+ sudo reboot
+
+
+
+
+ RETVAL="$?"
+ return "$RETVAL"
+}
+
+case "$1" in
+ web)
+ do_web
+ ;;
+ all)
+ do_all
+ ;;
+
+
+ *)
+ echo "Usage: $SCRIPTNAME {web|all}"
+ exit 3
+ ;;
+esac
+
+:
diff --git a/bbb/scripts/000-default-ssl b/scripts/000-default-ssl
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/scripts/000-default-ssl
rename to scripts/000-default-ssl
diff --git a/bbb/scripts/apache2.conf b/scripts/apache2.conf
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/scripts/apache2.conf
rename to scripts/apache2.conf
diff --git a/scripts/bbb_domoticz.py b/scripts/bbb_domoticz.py
new file mode 100755
index 0000000..db2831a
--- /dev/null
+++ b/scripts/bbb_domoticz.py
@@ -0,0 +1,396 @@
+#!/usr/bin/python
+#-*- coding: utf-8 -*-
+#2016-03-14:21:51
+#
+# Modified by Ulf Bengtner, 2015-06-14, to read all sensors from Domoticz.
+#
+# All sensors are mapped by Domoticz sensor id, IDX. The actual sensors used
+# are read from a configuration file /home/pi/domoticz_sensors. They should be
+# listed in the same order as the room names are specified in Behovsbobox
+#
+#
+import urllib2,json,sys
+#import urllib2,json
+
+import datetime;
+import time;
+import sqlite3
+import datetime
+import logging, logging.handlers, argparse
+import subprocess
+import RPi.GPIO as GPIO
+
+#GPIO general purpose input output
+GPIO.setmode(GPIO.BOARD) # Board numbering mode, i.e. number refers to pin
+GPIO.setwarnings(False)
+#GPIO.setup(11,GPIO.OUT)
+#GPIO.setup(13,GPIO.OUT)
+#GPIO.setup(15,GPIO.OUT)
+#GPIO.setup(29,GPIO.OUT)
+#GPIO.setup(31,GPIO.OUT)
+#GPIO.setup(33,GPIO.OUT)
+#GPIO.setup(35,GPIO.OUT)
+#GPIO.setup(37,GPIO.OUT)
+#GPIO.setup(12,GPIO.OUT)
+#GPIO.setup(16,GPIO.OUT)
+#GPIO.setup(18,GPIO.OUT)
+#GPIO.setup(22,GPIO.OUT)
+#GPIO.setup(32,GPIO.OUT)
+#GPIO.setup(36,GPIO.OUT)
+#GPIO.setup(38,GPIO.OUT)
+#GPIO.setup(40,GPIO.OUT)
+#
+# original pin-out Öland
+#
+GPIO.setup(26,GPIO.OUT)
+GPIO.setup(24,GPIO.OUT)
+GPIO.setup(21,GPIO.OUT)
+GPIO.setup(19,GPIO.OUT)
+GPIO.setup(23,GPIO.OUT)
+GPIO.setup(11,GPIO.OUT)
+GPIO.setup(12,GPIO.OUT)
+GPIO.setup(15,GPIO.OUT)
+
+
+WAIT=300 # Delay (s) between each cycle in control loop
+
+DOMOTICZ_IN=1 # Set this variable to 1 to read temperatures from Domoticz, otherwise 0
+DOMOTICZ_OUT=0 # Set this variable to 1 to control valves from Domoticz, otherwise 0
+
+DOMOTICZ_URL="bobox.dyndns.org:8085" # URL to Domoticz server - use 127.0.0.1 for local
+USERNAME = 'ubee' # update username and password to what is defined in Domoticz
+PASSWORD = 'xyz'
+
+LOGFILE = '/var/log/bbb/bbb_domoticz.log'
+
+def tracefunc(frame, event, arg, indent=[0]):
+ calltrace=""
+ if event == "call":
+ indent[0] += 2
+ logger.debug("-" * indent[0] + "> call function +%s",frame.f_code.co_name)
+ elif event == "return":
+ logger.debug("-" * indent[0] + "exit function +%s",frame.f_code.co_name)
+ indent[0] -= 2
+ return tracefunc
+
+
+
+#
+# The control loop reads those sensors (slaves). The control loop stop
+# when id is 0
+#
+# If Domoticz is used for control, the Domoticz idx is read from Domoticz. Otherwise configure with 1w id:s
+#
+#
+# sensors[0] - first room
+# sensors[1] - second room
+# ...
+#
+sensors = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
+
+#
+#sensors = ["28-00000662b340","28-000006636be0","28-00000663000e","28-00000558923e","28-000006636545","28-0000066355d5","28-00000663137f",0,0,0,0,0,0,0,0,0]
+#
+#
+# array of rooms holding the setpoint values we want
+#
+setpoints = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
+#
+#
+# the temperature value we read in each room
+#
+actualTemp = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
+#
+#
+# The GPIO pin used to control the valve for each room
+# With Domoticz control, the value is configured and read from Domoticz. The number corresponds to the IDX of the associated
+# switch controlling a defined pin
+#
+
+pins = [26,24,21,19,23,11,12,15,0,0,0,0,0,0,0,0]
+
+#
+# define logging handler
+#
+parser = argparse.ArgumentParser( description='BehovsBoBoxen Control daemon' )
+parser.add_argument("-v", "--verbose", help="Logging verbose", action="store_true")
+
+args = parser.parse_args()
+if args.verbose:
+ logging.basicConfig(level=logging.DEBUG)
+else:
+ logging.basicConfig(level=logging.INFO)
+
+
+logger = logging.getLogger(__name__)
+
+# create a file handler
+
+handler = logging.handlers.RotatingFileHandler(LOGFILE,maxBytes=200000,backupCount=10)
+#
+# set level
+#
+handler.setLevel(logging.DEBUG) # Do not change this!
+
+# create a logging format
+
+formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
+handler.setFormatter(formatter)
+
+# add the handlers to the logger
+
+logger.addHandler(handler)
+
+logger.info("BehovsBoBoxen control system: bbb_domoticz.py starting up")
+
+#
+# Uncomment this line for extensive tracing
+#
+# sys.settrace(tracefunc)
+
+if DOMOTICZ_IN or DOMOTICZ_OUT:
+#
+# build authenticate string to access Domoticz server
+#
+
+ p = urllib2.HTTPPasswordMgrWithDefaultRealm()
+ p.add_password(None, DOMOTICZ_URL, USERNAME, PASSWORD)
+
+ handler = urllib2.HTTPBasicAuthHandler(p)
+ opener = urllib2.build_opener(handler)
+ urllib2.install_opener(opener)
+
+
+
+
+ if DOMOTICZ_IN:
+#
+# Find all temperature sensors in Domoticz and populate sensors array
+#
+ url= "http://"+DOMOTICZ_URL+"/json.htm?type=devices&filter=temp&used=true&order=Name"
+ logger.debug('Reading from %s',url)
+ try:
+ response=urllib2.urlopen(url)
+ data=json.loads(response.read())
+ logger.debug('Response is %s',json.dumps(data, indent=4, sort_keys=True))
+ for i in range(len(data["result"])):
+ a=data["result"][i]["Description"]
+ ini=a.find('%room')
+ if ini != -1:
+ ini=ini+6
+ rIndex=int(a[ini:])
+ logger.info('Configure room id %s with Domoticz sensor idx: %s', rIndex, data["result"][i]["idx"])
+ sensors[rIndex]=data["result"][i]["idx"]
+ except URLError:
+ logger.warning('Cannot connect to Domoticz server %s', url)
+
+#
+# end if DOMOTICZ_IN
+#
+
+if DOMOTICZ_OUT:
+#
+# Find all swítches that control valves in Domoticz and populate output array
+#
+
+ url= "http://"+DOMOTICZ_URL+"/json.htm?type=devices&filter=light&used=true&order=Name"
+ logger.debug('Reading from %s',url)
+ response=urllib2.urlopen(url)
+# response=urllib.urlopen(url)
+ data=json.loads(response.read())
+ logger.debug('Response is %s',json.dumps(data, indent=4, sort_keys=True))
+
+ for i in range(len(data["result"])):
+ a=data["result"][i]["Description"]
+ ini=a.find('%room')
+ if ini != -1:
+ ini=ini+6
+ rIndex=int(a[ini:])
+ logger.info('Configure room id %s with Domoticz switch IDX %s',str(rIndex), data["result"][i]["idx"])
+
+ pins[rIndex]=data["result"][i]["idx"]
+#
+# end if DOMOTICZ_OUT
+#
+logger.info('======================================================================')
+
+
+#################################################################################
+#
+# actualTemps()
+#
+# reads the temperatures in each room and returns array
+#
+# depending on the variable domoticz the temperatures are read through Domoticz
+# or directly from 1-wire sensors.
+#
+##################################################################################
+
+def actualTemps(currentTemp,sensors):
+
+ basePath="/sys/bus/w1/devices/"
+ tailPath="/w1_slave"
+ newTemp=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
+ readOK=True
+
+ i = 0
+ while i < 16 and sensors[i] != 0:
+
+ if DOMOTICZ_IN:
+#
+# Read devices in Domoticz
+#
+ try:
+ url= "http://"+DOMOTICZ_URL+"/json.htm?type=devices&rid=" + str(sensors[i])
+ logger.debug('Reading from %s',url)
+ response=urllib2.urlopen(url)
+ data=json.loads(response.read())
+ logger.debug("Response is %s",json.dumps(data, indent=4, sort_keys=True))
+ except:
+#
+# no access to Domoticz server
+# return old reading
+#
+ readOK=False
+ logger.warning("No access to Domoticz server")
+ newTemp[i]=currentTemp[i]
+ if readOK :
+ try:
+ temperature = data ["result"][0]["Temp"]
+ logger.debug('Room index %s, temperature is %s', i, temperature)
+ newTemp[i] = (round(temperature,1))
+ except KeyError:
+ logger.warning("Domoticz sensor idx %s is not known!",sensors[i])
+ else:
+#
+# Read 1 wire sensors the old way
+#
+ searchPath = basePath + sensors[i] + tailPath
+ logger.debug("Reading 1-wire from %s",searchPath)
+ try:
+ tfile = open(searchPath)
+ text = tfile.read()
+ tfile.close()
+ secondline = text.split("\n")[1]
+ temperaturedata = secondline.split(" ")[9]
+ temperature = float(temperaturedata[2:])
+ temperature = temperature / 1000
+ newTemp[i] = (round(temperature,1))
+ except IOError:
+ logger.warning("Domoticz 1-wire %s is not known!",sensors[i])
+ newTemp[i]=currentTemp[i]
+ logger.debug('Room index %s, temperature is %s', i, newTemp[i])
+ i = i + 1
+ return newTemp
+
+######################################################################
+#
+# getdate()
+#
+# read actual time and date, removes microseconds
+#
+######################################################################
+
+def getdate():
+ date = datetime.datetime.now()
+ return(unicode(date.replace(microsecond=0)))
+
+######################################################################
+#
+# updateTempFile()
+#
+# Write actual temperatures in file
+#
+######################################################################
+
+def updateTempFile(actualTemp):
+ file = open("/var/www/html/application/textfile/temperature.txt", "w")
+ file.write(getdate())
+ file.write("; ")
+ file.write('; '.join(map(str, actualTemp)))
+ file.close
+
+######################################################################
+#
+# set_output()
+#
+# controls the specified GPIO.pin either through Domoticz or directly
+#
+######################################################################
+
+def set_output(id, pin, value):
+
+ readOK=True
+
+ logger.info('Room id %s, GPIO id %s, output %s',id, pin,value)
+ if DOMOTICZ_OUT:
+ try:
+ if value:
+ url="http://"+DOMOTICZ_URL+"/json.htm?type=command¶m=switchlight&idx="+str(pin)+"&switchcmd=Off"
+ else:
+ url="http://"+DOMOTICZ_URL+"/json.htm?type=command¶m=switchlight&idx="+str(pin)+"&switchcmd=On"
+ logger.debug('Reading from %s',url)
+ response=urllib2.urlopen(url)
+ except:
+ readOK =False
+ logger.warning("No access to Domoticz server")
+ if readOK:
+ data=json.loads(response.read())
+ logger.debug('Response is %s',json.dumps(data, indent=4, sort_keys=True))
+ if data ["status"] != "OK" :
+ logger.warning("Domoticz switch idx %s is not known!",pin)
+ else:
+ GPIO.output(pin,value)
+
+
+
+
+
+
+##########################################################################
+#
+# the control loop
+#
+#########################################################################
+
+def main():
+
+ actualTemp = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
+ while 1 > 0:
+#
+# read actual temperatures and store in temporay file to be displayed by web service
+#
+ actualTemp = actualTemps(actualTemp,sensors)
+ updateTempFile(actualTemp)
+
+
+ actualtime=datetime.datetime.now() #get time
+ actualhour=actualtime.hour #get hour
+
+ x = 0
+ while x < 16 and sensors[x] != 0:
+#
+# Get setpoints for room x from file
+#
+ room = "room" + str(x)
+ string = "/var/www/html/application/textfile/" + room + ".txt"
+ logger.debug('Reading setpoints from room %s from file %s', x, string)
+ room = open(string, "r")
+ setpoints[x]=float(room.read().split(',')[actualhour])
+ room.close()
+ logger.info('Room id %s, Temperature: %s, Setpoint: %s ', x, actualTemp[x], setpoints[x])
+
+ if actualTemp[x] > setpoints[x]: set_output(x,pins[x],False)
+ if actualTemp[x] < setpoints[x]: set_output(x,pins[x],True)
+ logger.info('--------------------------------------------')
+ x = x + 1
+
+ time.sleep(WAIT)
+
+
+try:
+
+ main()
+
+except:
+ logger.exception("bbb_domoticz.py terminated");
\ No newline at end of file
diff --git a/scripts/bbb_domoticz.py~ b/scripts/bbb_domoticz.py~
new file mode 100755
index 0000000..3713c61
--- /dev/null
+++ b/scripts/bbb_domoticz.py~
@@ -0,0 +1,396 @@
+#!/usr/bin/python
+#-*- coding: utf-8 -*-
+#2016-03-14:21:51
+#
+# Modified by Ulf Bengtner, 2015-06-14, to read all sensors from Domoticz.
+#
+# All sensors are mapped by Domoticz sensor id, IDX. The actual sensors used
+# are read from a configuration file /home/pi/domoticz_sensors. They should be
+# listed in the same order as the room names are specified in Behovsbobox
+#
+#
+import urllib2,json,sys
+#import urllib2,json
+
+import datetime;
+import time;
+import sqlite3
+import datetime
+import logging, logging.handlers, argparse
+import subprocess
+import RPi.GPIO as GPIO
+
+#GPIO general purpose input output
+GPIO.setmode(GPIO.BOARD) # Board numbering mode, i.e. number refers to pin
+GPIO.setwarnings(False)
+#GPIO.setup(11,GPIO.OUT)
+#GPIO.setup(13,GPIO.OUT)
+#GPIO.setup(15,GPIO.OUT)
+#GPIO.setup(29,GPIO.OUT)
+#GPIO.setup(31,GPIO.OUT)
+#GPIO.setup(33,GPIO.OUT)
+#GPIO.setup(35,GPIO.OUT)
+#GPIO.setup(37,GPIO.OUT)
+#GPIO.setup(12,GPIO.OUT)
+#GPIO.setup(16,GPIO.OUT)
+#GPIO.setup(18,GPIO.OUT)
+#GPIO.setup(22,GPIO.OUT)
+#GPIO.setup(32,GPIO.OUT)
+#GPIO.setup(36,GPIO.OUT)
+#GPIO.setup(38,GPIO.OUT)
+#GPIO.setup(40,GPIO.OUT)
+#
+# original pin-out Öland
+#
+GPIO.setup(26,GPIO.OUT)
+GPIO.setup(24,GPIO.OUT)
+GPIO.setup(21,GPIO.OUT)
+GPIO.setup(19,GPIO.OUT)
+GPIO.setup(23,GPIO.OUT)
+GPIO.setup(11,GPIO.OUT)
+GPIO.setup(12,GPIO.OUT)
+GPIO.setup(15,GPIO.OUT)
+
+
+WAIT=300 # Delay (s) between each cycle in control loop
+
+DOMOTICZ_IN=1 # Set this variable to 1 to read temperatures from Domoticz, otherwise 0
+DOMOTICZ_OUT=0 # Set this variable to 1 to control valves from Domoticz, otherwise 0
+
+DOMOTICZ_URL="bobox.dyndns.org:8085" # URL to Domoticz server - use 127.0.0.1 for local
+USERNAME = 'ubee' # update username and password to what is defined in Domoticz
+PASSWORD = 'xyz'
+
+LOGFILE = '/home/pi/bbb_addon/bbb_domoticz.log'
+
+def tracefunc(frame, event, arg, indent=[0]):
+ calltrace=""
+ if event == "call":
+ indent[0] += 2
+ logger.debug("-" * indent[0] + "> call function +%s",frame.f_code.co_name)
+ elif event == "return":
+ logger.debug("-" * indent[0] + "exit function +%s",frame.f_code.co_name)
+ indent[0] -= 2
+ return tracefunc
+
+
+
+#
+# The control loop reads those sensors (slaves). The control loop stop
+# when id is 0
+#
+# If Domoticz is used for control, the Domoticz idx is read from Domoticz. Otherwise configure with 1w id:s
+#
+#
+# sensors[0] - first room
+# sensors[1] - second room
+# ...
+#
+sensors = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
+
+#
+#sensors = ["28-00000662b340","28-000006636be0","28-00000663000e","28-00000558923e","28-000006636545","28-0000066355d5","28-00000663137f",0,0,0,0,0,0,0,0,0]
+#
+#
+# array of rooms holding the setpoint values we want
+#
+setpoints = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
+#
+#
+# the temperature value we read in each room
+#
+actualTemp = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
+#
+#
+# The GPIO pin used to control the valve for each room
+# With Domoticz control, the value is configured and read from Domoticz. The number corresponds to the IDX of the associated
+# switch controlling a defined pin
+#
+
+pins = [26,24,21,19,23,11,12,15,0,0,0,0,0,0,0,0]
+
+#
+# define logging handler
+#
+parser = argparse.ArgumentParser( description='BehovsBoBoxen Control daemon' )
+parser.add_argument("-v", "--verbose", help="Logging verbose", action="store_true")
+
+args = parser.parse_args()
+if args.verbose:
+ logging.basicConfig(level=logging.DEBUG)
+else:
+ logging.basicConfig(level=logging.INFO)
+
+
+logger = logging.getLogger(__name__)
+
+# create a file handler
+
+handler = logging.handlers.RotatingFileHandler(LOGFILE,maxBytes=200000,backupCount=10)
+#
+# set level
+#
+handler.setLevel(logging.DEBUG) # Do not change this!
+
+# create a logging format
+
+formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
+handler.setFormatter(formatter)
+
+# add the handlers to the logger
+
+logger.addHandler(handler)
+
+logger.info("BehovsBoBoxen control system: bbb_domoticz.py starting up")
+
+#
+# Uncomment this line for extensive tracing
+#
+# sys.settrace(tracefunc)
+
+if DOMOTICZ_IN or DOMOTICZ_OUT:
+#
+# build authenticate string to access Domoticz server
+#
+
+ p = urllib2.HTTPPasswordMgrWithDefaultRealm()
+ p.add_password(None, DOMOTICZ_URL, USERNAME, PASSWORD)
+
+ handler = urllib2.HTTPBasicAuthHandler(p)
+ opener = urllib2.build_opener(handler)
+ urllib2.install_opener(opener)
+
+
+
+
+ if DOMOTICZ_IN:
+#
+# Find all temperature sensors in Domoticz and populate sensors array
+#
+ url= "http://"+DOMOTICZ_URL+"/json.htm?type=devices&filter=temp&used=true&order=Name"
+ logger.debug('Reading from %s',url)
+ try:
+ response=urllib2.urlopen(url)
+ data=json.loads(response.read())
+ logger.debug('Response is %s',json.dumps(data, indent=4, sort_keys=True))
+ for i in range(len(data["result"])):
+ a=data["result"][i]["Description"]
+ ini=a.find('%room')
+ if ini != -1:
+ ini=ini+6
+ rIndex=int(a[ini:])
+ logger.info('Configure room id %s with Domoticz sensor idx: %s', rIndex, data["result"][i]["idx"])
+ sensors[rIndex]=data["result"][i]["idx"]
+ except URLError:
+ logger.warning('Cannot connect to Domoticz server %s', url)
+
+#
+# end if DOMOTICZ_IN
+#
+
+if DOMOTICZ_OUT:
+#
+# Find all swítches that control valves in Domoticz and populate output array
+#
+
+ url= "http://"+DOMOTICZ_URL+"/json.htm?type=devices&filter=light&used=true&order=Name"
+ logger.debug('Reading from %s',url)
+ response=urllib2.urlopen(url)
+# response=urllib.urlopen(url)
+ data=json.loads(response.read())
+ logger.debug('Response is %s',json.dumps(data, indent=4, sort_keys=True))
+
+ for i in range(len(data["result"])):
+ a=data["result"][i]["Description"]
+ ini=a.find('%room')
+ if ini != -1:
+ ini=ini+6
+ rIndex=int(a[ini:])
+ logger.info('Configure room id %s with Domoticz switch IDX %s',str(rIndex), data["result"][i]["idx"])
+
+ pins[rIndex]=data["result"][i]["idx"]
+#
+# end if DOMOTICZ_OUT
+#
+logger.info('======================================================================')
+
+
+#################################################################################
+#
+# actualTemps()
+#
+# reads the temperatures in each room and returns array
+#
+# depending on the variable domoticz the temperatures are read through Domoticz
+# or directly from 1-wire sensors.
+#
+##################################################################################
+
+def actualTemps(currentTemp,sensors):
+
+ basePath="/sys/bus/w1/devices/"
+ tailPath="/w1_slave"
+ newTemp=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
+ readOK=True
+
+ i = 0
+ while i < 16 and sensors[i] != 0:
+
+ if DOMOTICZ_IN:
+#
+# Read devices in Domoticz
+#
+ try:
+ url= "http://"+DOMOTICZ_URL+"/json.htm?type=devices&rid=" + str(sensors[i])
+ logger.debug('Reading from %s',url)
+ response=urllib2.urlopen(url)
+ data=json.loads(response.read())
+ logger.debug("Response is %s",json.dumps(data, indent=4, sort_keys=True))
+ except:
+#
+# no access to Domoticz server
+# return old reading
+#
+ readOK=False
+ logger.warning("No access to Domoticz server")
+ newTemp[i]=currentTemp[i]
+ if readOK :
+ try:
+ temperature = data ["result"][0]["Temp"]
+ logger.debug('Room index %s, temperature is %s', i, temperature)
+ newTemp[i] = (round(temperature,1))
+ except KeyError:
+ logger.warning("Domoticz sensor idx %s is not known!",sensors[i])
+ else:
+#
+# Read 1 wire sensors the old way
+#
+ searchPath = basePath + sensors[i] + tailPath
+ logger.debug("Reading 1-wire from %s",searchPath)
+ try:
+ tfile = open(searchPath)
+ text = tfile.read()
+ tfile.close()
+ secondline = text.split("\n")[1]
+ temperaturedata = secondline.split(" ")[9]
+ temperature = float(temperaturedata[2:])
+ temperature = temperature / 1000
+ newTemp[i] = (round(temperature,1))
+ except IOError:
+ logger.warning("Domoticz 1-wire %s is not known!",sensors[i])
+ newTemp[i]=currentTemp[i]
+ logger.debug('Room index %s, temperature is %s', i, newTemp[i])
+ i = i + 1
+ return newTemp
+
+######################################################################
+#
+# getdate()
+#
+# read actual time and date, removes microseconds
+#
+######################################################################
+
+def getdate():
+ date = datetime.datetime.now()
+ return(unicode(date.replace(microsecond=0)))
+
+######################################################################
+#
+# updateTempFile()
+#
+# Write actual temperatures in file
+#
+######################################################################
+
+def updateTempFile(actualTemp):
+ file = open("/var/www/html/application/textfile/temperature.txt", "w")
+ file.write(getdate())
+ file.write("; ")
+ file.write('; '.join(map(str, actualTemp)))
+ file.close
+
+######################################################################
+#
+# set_output()
+#
+# controls the specified GPIO.pin either through Domoticz or directly
+#
+######################################################################
+
+def set_output(id, pin, value):
+
+ readOK=True
+
+ logger.info('Room id %s, GPIO id %s, output %s',id, pin,value)
+ if DOMOTICZ_OUT:
+ try:
+ if value:
+ url="http://"+DOMOTICZ_URL+"/json.htm?type=command¶m=switchlight&idx="+str(pin)+"&switchcmd=Off"
+ else:
+ url="http://"+DOMOTICZ_URL+"/json.htm?type=command¶m=switchlight&idx="+str(pin)+"&switchcmd=On"
+ logger.debug('Reading from %s',url)
+ response=urllib2.urlopen(url)
+ except:
+ readOK =False
+ logger.warning("No access to Domoticz server")
+ if readOK:
+ data=json.loads(response.read())
+ logger.debug('Response is %s',json.dumps(data, indent=4, sort_keys=True))
+ if data ["status"] != "OK" :
+ logger.warning("Domoticz switch idx %s is not known!",pin)
+ else:
+ GPIO.output(pin,value)
+
+
+
+
+
+
+##########################################################################
+#
+# the control loop
+#
+#########################################################################
+
+def main():
+
+ actualTemp = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
+ while 1 > 0:
+#
+# read actual temperatures and store in temporay file to be displayed by web service
+#
+ actualTemp = actualTemps(actualTemp,sensors)
+ updateTempFile(actualTemp)
+
+
+ actualtime=datetime.datetime.now() #get time
+ actualhour=actualtime.hour #get hour
+
+ x = 0
+ while x < 16 and sensors[x] != 0:
+#
+# Get setpoints for room x from file
+#
+ room = "room" + str(x)
+ string = "/var/www/html/application/textfile/" + room + ".txt"
+ logger.debug('Reading setpoints from room %s from file %s', x, string)
+ room = open(string, "r")
+ setpoints[x]=float(room.read().split(',')[actualhour])
+ room.close()
+ logger.info('Room id %s, Temperature: %s, Setpoint: %s ', x, actualTemp[x], setpoints[x])
+
+ if actualTemp[x] > setpoints[x]: set_output(x,pins[x],False)
+ if actualTemp[x] < setpoints[x]: set_output(x,pins[x],True)
+ logger.info('--------------------------------------------')
+ x = x + 1
+
+ time.sleep(WAIT)
+
+
+try:
+
+ main()
+
+except:
+ logger.exception("bbb_domoticz.py terminated");
\ No newline at end of file
diff --git a/scripts/bbb_domoticz.sh b/scripts/bbb_domoticz.sh
new file mode 100755
index 0000000..37f9f0a
--- /dev/null
+++ b/scripts/bbb_domoticz.sh
@@ -0,0 +1,156 @@
+#! /bin/bash
+### BEGIN INIT INFO
+# Provides: bbb_domoticz
+# Required-Start: $network $remote_fs $syslog
+# Required-Stop: $network $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: BehovsBoBox control script
+# Description: This daemon will start the BehovsBoBox Control system
+### END INIT INFO
+
+# Do NOT "set -e"
+
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
+DESC="BehovsBoBox Control System"
+NAME=bbb_domoticz.py
+USERNAME=pi
+
+DAEMON=/home/pi/BehovsBoBoxen/scripts/$NAME
+# DAEMON_OPTS=$2
+DAMEON_OPTS="-v"
+
+PIDFILE=/var/run/bbb_domoticz.pid
+#
+SCRIPTNAME=/etc/init.d/bbb_domoticz.sh
+
+
+
+#
+# Modified to force deamon to execute in background
+#
+
+# Exit if the package is not installed
+# [ -x "$DAEMON" ] || exit 0
+
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+VERBOSE=""
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
+# and status_of_proc is working.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+ # Return
+ # 0 if daemon has been started
+ # 1 if daemon was already running
+ # 2 if daemon could not be started
+ if [ -e $PIDFILE ]
+ then
+ pid=$(<$PIDFILE)
+ ps p $pid > /dev/null || rm -f $PIDFILE
+ fi
+# start-stop-daemon --chuid $USERNAME --start --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
+# || return 1
+# echo "OK to start"
+#
+# run script once from /home/pi/bbb_addon
+# kill the daemon
+#
+ /home/pi/BehovsBoBoxen/scripts/bbb_domoticz_local.sh start
+#
+ echo "Extra start", $?
+ sleep 10 #wait
+# pid =$(<$PIDFILE)
+# echo "Will kill process", pid
+# kill pid
+# ps p $pid > /dev/null || rm -f $PIDFILE
+#
+# start again
+
+
+
+
+ start-stop-daemon --start --make-pidfile --pidfile $PIDFILE --background --startas $DAEMON -- $DAEMON_OPTS || return 2
+# python /home/pi/bbb_addon/bbb_domoticz.sh &
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+ # Return
+ # 0 if daemon has been stopped
+ # 1 if daemon was already stopped
+ # 2 if daemon could not be stopped
+ # other if a failure occurred
+ start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
+ RETVAL="$?"
+ [ "$RETVAL" = 2 ] && return 2
+ # Wait for children to finish too if this is a daemon that forks
+ # and if the daemon is only ever run from this initscript.
+ # If the above conditions are not satisfied then add some other code
+ # that waits for the process to drop all resources that could be
+ # needed by services started subsequently. A last resort is to
+ # sleep for some time.
+ start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
+ [ "$?" = 2 ] && return 2
+ # Many daemons don't delete their pidfiles when they exit.
+ rm -f $PIDFILE
+ return "$RETVAL"
+}
+
+case "$1" in
+ start)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+ do_start
+# echo "status $?"
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ stop)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ status)
+ status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+ ;;
+ restart)
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1)
+ do_start
+ case "$?" in
+ 0) log_end_msg 0 ;;
+ 1) log_end_msg 1 ;; # Old process is still running
+ *) log_end_msg 1 ;; # Failed to start
+ esac
+ ;;
+ *)
+ # Failed to stop
+ log_end_msg 1
+ ;;
+ esac
+ ;;
+ *)
+ echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/scripts/bbb_domoticz.sh~ b/scripts/bbb_domoticz.sh~
new file mode 100755
index 0000000..e98f246
--- /dev/null
+++ b/scripts/bbb_domoticz.sh~
@@ -0,0 +1,156 @@
+#! /bin/bash
+### BEGIN INIT INFO
+# Provides: bbb_domoticz
+# Required-Start: $network $remote_fs $syslog
+# Required-Stop: $network $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: BehovsBoBox control script
+# Description: This daemon will start the BehovsBoBox Control system
+### END INIT INFO
+
+# Do NOT "set -e"
+
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
+DESC="BehovsBoBox Control System"
+NAME=bbb_domoticz.py
+USERNAME=pi
+
+DAEMON=/home/pi/BehovsBoBoxen/scripts/$NAME
+# DAEMON_OPTS=$2
+DAMEON_OPTS="-v"
+
+PIDFILE=/var/run/bbb_domoticz.pid
+#
+SCRIPTNAME=/etc/init.d/bbb_domoticz.sh
+
+
+
+#
+# Modified to force deamon to execute in background
+#
+
+# Exit if the package is not installed
+# [ -x "$DAEMON" ] || exit 0
+
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+VERBOSE=""
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
+# and status_of_proc is working.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+ # Return
+ # 0 if daemon has been started
+ # 1 if daemon was already running
+ # 2 if daemon could not be started
+ if [ -e $PIDFILE ]
+ then
+ pid=$(<$PIDFILE)
+ ps p $pid > /dev/null || rm -f $PIDFILE
+ fi
+# start-stop-daemon --chuid $USERNAME --start --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
+# || return 1
+# echo "OK to start"
+#
+# run script once from /home/pi/bbb_addon
+# kill the daemon
+#
+ /home/pi/bbb_addon/bbb_domoticz_local.sh start
+#
+ echo "Extra start", $?
+ sleep 10 #wait
+# pid =$(<$PIDFILE)
+# echo "Will kill process", pid
+# kill pid
+# ps p $pid > /dev/null || rm -f $PIDFILE
+#
+# start again
+
+
+
+
+ start-stop-daemon --start --make-pidfile --pidfile $PIDFILE --background --startas $DAEMON -- $DAEMON_OPTS || return 2
+# python /home/pi/bbb_addon/bbb_domoticz.sh &
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+ # Return
+ # 0 if daemon has been stopped
+ # 1 if daemon was already stopped
+ # 2 if daemon could not be stopped
+ # other if a failure occurred
+ start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
+ RETVAL="$?"
+ [ "$RETVAL" = 2 ] && return 2
+ # Wait for children to finish too if this is a daemon that forks
+ # and if the daemon is only ever run from this initscript.
+ # If the above conditions are not satisfied then add some other code
+ # that waits for the process to drop all resources that could be
+ # needed by services started subsequently. A last resort is to
+ # sleep for some time.
+ start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
+ [ "$?" = 2 ] && return 2
+ # Many daemons don't delete their pidfiles when they exit.
+ rm -f $PIDFILE
+ return "$RETVAL"
+}
+
+case "$1" in
+ start)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+ do_start
+# echo "status $?"
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ stop)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ status)
+ status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+ ;;
+ restart)
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1)
+ do_start
+ case "$?" in
+ 0) log_end_msg 0 ;;
+ 1) log_end_msg 1 ;; # Old process is still running
+ *) log_end_msg 1 ;; # Failed to start
+ esac
+ ;;
+ *)
+ # Failed to stop
+ log_end_msg 1
+ ;;
+ esac
+ ;;
+ *)
+ echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/scripts/bbb_domoticz_local.sh b/scripts/bbb_domoticz_local.sh
new file mode 100755
index 0000000..f7f85d9
--- /dev/null
+++ b/scripts/bbb_domoticz_local.sh
@@ -0,0 +1,136 @@
+#! /bin/bash
+### BEGIN INIT INFO
+# Provides: bbb_domoticz
+# Required-Start: $network $remote_fs $syslog
+# Required-Stop: $network $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: BehovsBoBox control script
+# Description: This daemon will start the BehovsBoBox Control system
+### END INIT INFO
+
+# Do NOT "set -e"
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
+DESC="BehovsBoBox Control System"
+NAME=bbb_domoticz.py
+USERNAME=pi
+
+DAEMON=/home/pi/BehovsBoBoxen/scripts/$NAME
+DEAMON_OPTS=$2
+
+PIDFILE=/var/run/bbb_domoticz.pid
+#
+SCRIPTNAME=/etc/init.d/bbb_domoticz.sh
+
+
+
+#
+# Modified to force deamon to execute in background
+#
+
+# Exit if the package is not installed
+# [ -x "$DAEMON" ] || exit 0
+
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+VERBOSE="yes"
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
+# and status_of_proc is working.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+ # Return
+ # 0 if daemon has been started
+ # 1 if daemon was already running
+ # 2 if daemon could not be started
+ if [ -e $PIDFILE ]
+ then
+ pid=$(<$PIDFILE)
+ ps p $pid > /dev/null || rm -f $PIDFILE
+ fi
+# start-stop-daemon --chuid $USERNAME --start --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
+# || return 1
+# echo "OK to start"
+ start-stop-daemon --start --make-pidfile --pidfile $PIDFILE --background --startas $DAEMON -- $DEAMON_OPTS || return 2
+# python /home/pi/bbb_addon/bbb_domoticz.sh &
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+ # Return
+ # 0 if daemon has been stopped
+ # 1 if daemon was already stopped
+ # 2 if daemon could not be stopped
+ # other if a failure occurred
+ start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
+ RETVAL="$?"
+ [ "$RETVAL" = 2 ] && return 2
+ # Wait for children to finish too if this is a daemon that forks
+ # and if the daemon is only ever run from this initscript.
+ # If the above conditions are not satisfied then add some other code
+ # that waits for the process to drop all resources that could be
+ # needed by services started subsequently. A last resort is to
+ # sleep for some time.
+ start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
+ [ "$?" = 2 ] && return 2
+ # Many daemons don't delete their pidfiles when they exit.
+ rm -f $PIDFILE
+ return "$RETVAL"
+}
+
+case "$1" in
+ start)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+ do_start
+# echo "status $?"
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ stop)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ status)
+ status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+ ;;
+ restart)
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1)
+ do_start
+ case "$?" in
+ 0) log_end_msg 0 ;;
+ 1) log_end_msg 1 ;; # Old process is still running
+ *) log_end_msg 1 ;; # Failed to start
+ esac
+ ;;
+ *)
+ # Failed to stop
+ log_end_msg 1
+ ;;
+ esac
+ ;;
+ *)
+ echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/scripts/check_processes.sh b/scripts/check_processes.sh
new file mode 100755
index 0000000..350e4fa
--- /dev/null
+++ b/scripts/check_processes.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+# echo "Check processes and network connection"
+
+. /lib/init/vars.sh
+VERBOSE=""
+
+. /lib/lsb/init-functions
+
+
+DOMOTICZPID=$( /dev/null
+if [ "$?" = "1" ]
+then
+ echo $(date) "Domoticz is not running. Will be restarted" | tee -a /var/log/checkp.log > /dev/null
+ /etc/init.d/domoticz.sh start
+fi
+
+
+ps p $DALLASPID > /dev/null
+if [ "$?" = "1" ]
+then
+ echo $(date) "Dallas.py is not running. Will be restarted" | tee -a /var/log/checkp.log > /dev/null
+ /etc/init.d/bbb_domoitcz.sh start
+fi
+
+
+ping -c 1 192.168.1.1 > /tmp/ping.log
+if [ "$?" != "0" ]
+then
+# date | tee -a /var/log/checkp.log > /dev/null
+# cat /tmp/ping.log | tee -a /var/log/checkp.log
+ echo $(date) "No network connection. Will try to restart interface." | tee -a /var/log/checkp.log > /dev/null
+ /etc/init.d/networking stop
+ /etc/init.d/networking start
+# ifdown wlan0&&ifup wlan0
+ sleep 10s
+ ping -c 1 192.168.1.1 > /tmp/ping.log
+ if [ "$?" != 0 ]
+ then
+ echo $(date) "Network still down. Will reboot" | sudo tee -a /var/log/checkp.log > /dev/null
+ sudo reboot
+ fi
+ exit 0
+fi
\ No newline at end of file
diff --git a/scripts/checkp b/scripts/checkp
new file mode 100755
index 0000000..9339244
--- /dev/null
+++ b/scripts/checkp
@@ -0,0 +1 @@
+*/10 * * * * root /home/pi/BehovsBoBoxen/scripts/check_processes.sh
diff --git a/bbb/scripts/cron.txt b/scripts/cron.txt
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/scripts/cron.txt
rename to scripts/cron.txt
diff --git a/bbb/scripts/dallas.py b/scripts/dallas.py
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/scripts/dallas.py
rename to scripts/dallas.py
diff --git a/bbb/scripts/default-ssl b/scripts/default-ssl
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/scripts/default-ssl
rename to scripts/default-ssl
diff --git a/bbb/scripts/default-ssl.conf b/scripts/default-ssl.conf
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/scripts/default-ssl.conf
rename to scripts/default-ssl.conf
diff --git a/bbb/scripts/getspotprice.py b/scripts/getspotprice.py
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/scripts/getspotprice.py
rename to scripts/getspotprice.py
diff --git a/bbb/scripts/rc.local b/scripts/rc.local
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/scripts/rc.local
rename to scripts/rc.local
diff --git a/scripts/reboot b/scripts/reboot
new file mode 100755
index 0000000..f356bfc
--- /dev/null
+++ b/scripts/reboot
@@ -0,0 +1 @@
+15 1 * * * root /home/pi/BehovsBoBoxen/scripts/reboot.sh
diff --git a/bbb/scripts/script.sh b/scripts/script.sh
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/scripts/script.sh
rename to scripts/script.sh
diff --git a/bbb/scripts/script2.sh b/scripts/script2.sh
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/scripts/script2.sh
rename to scripts/script2.sh
diff --git a/bbb/ssl/text b/ssl/text
old mode 100644
new mode 100755
similarity index 100%
rename from bbb/ssl/text
rename to ssl/text