HomeControlA home automation system for your Raspberry PI and your Android smartphone.
Install server on RaspberryPI
Settings in local config file
|Setting name||Example value(s)||Explanation|
|nodeName||homecontrolX||In individual node name for the raspberry.|
homecontrolX | 192.168.0.55
In individual node hostname or its ip address.
|usePlain||true | false||Listen for unencrypted connections.|
|useSsl||true | false||Listen for encrypted connections. I suggest you do not use encryption for initial testing, but activate it later after the general setup is working.|
|sslDebug||true | false||In case of SSL problems where you don't know the reason, activate this.|
|listenPortPlain||36735||The port where the daemon is supposed to listen for incoming unencrypted connections.|
|listenPortSsl||36736||The port where the daemon is supposed to listen for incoming encrypted connections.|
|keystoreFilename||keystore.jks||The filename of the java keystore. Only required if SSL is used anywhere.|
|keystorePassword||keystorePassword||The password of the java keystore.|
|DEPRECATED - Use databaseServerNames now -
The servername or IP address where the Mysql database is running.
|databaseServerNames||servername1;servername2||The servername or IP address where the Mysql database is running. Separate multiple servers with semikolons. If you use multiple servers you need to take care of data sync yourself!|
|databasePort||3306||The database port.|
|databaseName||homecontrol||The name of the database.|
true | false
Do you have sensors attached?
Enter sensors in the database now (table "sensors"). If you had sensors in your config file during update they have been migrated to the database. - Device type, gpio pin, watch for rising/falling
Settings in database
|Setting name||Example value(s)||Explanation|
|authenticationMode||ldap | local||Authentication source|
|databaseVersion||number||Database version. You should not change this value yourself. The upgrade routine routine will take care of that.|
|dateFormat||dd.MM.yyyy HH:mm:ss:SSSS||Dateformat, especially for logs. Consult this page for documentation.|
|encryptionKey||changeme||An encryption key that is used to communicate with sensor nodes.|
|ldapBasePath||CN=Users,DC=my,DC=domain,DC=name||LDAP base path|
|ldapCacheRefresh||60||Because the connection to an LDAP server can take a moment that'll delay login time the server will remember a user's credentials in memory for a couple of minutes. After that time has passed it'll check if they are still correct. If not the next login attempt of that user will take a moment longer because the LDAP server will be contacted again. Set this value to 0 to deactivate caching.|
|ldapDomain||domain name||LDAP windows domain, will be linked with user name.|
|ldapHosts||dc1.mydomain:389;dc2.mydomain:389||List of LDAP servers with port. Separate multiple ones with semikolons.|
|ldapMailAttribute||Mail attribute for a user in LDAP database|
|ldapMemberGroup||CN=HomeControl,CN=Users,DC=my,DC=domain,DC=name||LDAP path of usergroup that is allowed to connect to Homecontrol|
|ldapUserAttribute||samAccountName||LDAP attribute that holds the user's username|
|ldapUseSsl||true | false||Use SSL for connections to LDAP servers? Remember to check the port in the server list of you change this. Keep in mind the root CA's certificate that signed your LDAP server's certificate needs to be in a keystore.|
|logLevel||1-5||Log level, the higher the more details will be logged.
1 = basic information like daemon start/stop, also all critical errors
2 = actions like devices switched or users logged on
3 = details about actions
4 = network communication
5 = SQL related events
|logMaxSize||number||Maximum size of log file in megabytes.|
|maximumLoggedInUsers||20||Maximum amount of simultaneous incoming connections.|
true | false
Send mail notifications, see notificationsEnabled now.
|mqttClientEnabled||true | false||MQTT client enabled.|
|mqttClientPassword||password||Password used to connect to MQTT server.|
|mqttClientServerHostname||mqtt.domain.com||Hostname of MQTT server.|
|mqttClientServerPort||usually 1883||Port of MQTT server.|
|mqttClientUseAuthentication||true | false||Use authentication for MQTT client.|
|mqttClientUsername||username||Username used to connect to MQTT server.|
|mqttClientUseSsl||true | false||Use SSL to connect to MQTT server.|
|notificationAuthenticate||true | false||Use authentication (username/password) to send emails.|
|notificationsEnabled (used to be mail)||true | false||Send emails in case of events? Not in use, yet.|
|notificationFromAddressfirstname.lastname@example.org||Sender address for notifications.|
|notificationMailServer||smtp.provider.org||Mailserver used for admin notifications. In general for email settings start the server with the -testEmailNotification parameter to test email notifications.|
|notificationMailServerPort||25||Port of notification mail server. Encrypted is currently not supported, yet. Please wait for the next version.|
|notificationEncryptionType||NONE | STARTTLS | TLS | SSL||Encryption type used in smtp connection.|
|notificationPassword||password||Password of notification mail server.|
|notificationToAddressemail@example.com||Recepient address for notifications.|
|notificationUsername||username||Username of notification mail server.|
|notificationVerbosity||1 - 5||The higher the more notifications will be sent.|
|openWeatherMapApiKey||password||Your individual openWeatherMap API key. Generate your's at https://openWeatherMap.org/|
|pushNotificationApiKey||password||Your individual Firebase API key. Generate your's at https://console.firebase.google.com/|
|s20watchdogInterval||10000||Amount of milliseconds between watchdog checks.|
|s20useWatchdog||true | false||Applies only if you're using Orvibo S20 devices: Enable watchdog. This will keep an eye on S20 devices and check their switching status. It could be that they have been triggerd from outside the application.|
|sensorUdpWatchPort||number||Specifiy a port to listen on and receive UDP messages from potential sensor nodes. Keep in mind homecontrol runs as a non-privileged user by default. So ports <= 1024 cannot be used.|
|serverRelay||true | false||Relay commands to other servers|
|serverRelayAutoDisconnectTime||60000||Time in ms after which to disconnect from other nodes. Connection will be kept open for this amount of milliseconds in case the client sends more commands than just one.|
|serverRelayClientTimeout||5000||Timeout in ms for relay connection attempts.|
|serverRelayPsk||asdlfkjsadkfjsldfjlskdjf||Password that server nodes use to authenticate each other.|
|serverRelayUseSsl||true | false||Decides if RelayConnections will be established using SSL (if you have multiple nodes). Remember to enter all nodes into "nodes" table and set the correct ports.|
|switchAttempts||1 - 5||The amount of attempts to switch devices.|
|switchRoomDelay||0||If you send mass commands (like switch all devices in a room) and multiple nodes send commands at almost the same time I've noticed problems which may be because of signal collisions. A node will wait a random fraction of this number of milliseconds before sending commands.|
|temperatureUnit||C | F||Celsius or Fahrenheit|
|voiceInterfaceEnabled||true | false||Voice integration enabled or not|
|voiceInterfaceIntentMqttPath||hermes/intent/#||MQTT path to listen for snips messages|
nohup ssh pi@jarvis /home/pi/.nvm/versions/node/v12.10.0/bin/node /home/pi/lite_js/ledPattern.js
OPTIONAL: A command to run for LED responses on the voice hardware node
/usr/bin/ssh pi@jarvis /home/pi/speakText.sh '
OPTIONAL: The command to give TTS responses
OPTIONAL: ssh pi@jarvis aplay -D sysdefault:CARD=ALSA
OPTIONAL: The command for sound responses like confirmation or error
|voiceInterfaceType||rhasspy | snips||The type of voice software you're running|
|FINISH PREREQUISITES FIRST!!!|
You have two general choices:
User locationYou can change a user's location easily from your phone by triggering a URL like this:
The application supports those sensors:
Motion sensorThis one is fairly easy. Get a sensor like these: http://www.electrodragon.com/product/pir/, model name may be something like HC-SR501. Attach it with 5V and ground. The 3rd pin goes to one of your GPIO pins. Specify it in the config, it'll then be monitored.
The setting rising/falling means: If your sensor will output a higher voltage in case of motion then use rising, if it'll go down in case of motion then use falling.
Temperature and humidty sensorGet a DHT11 sensor. Then set it up like described in https://learn.adafruit.com/dht-humidity-sensing-on-raspberry-pi-with-gdocs-logging/wiring. If the execution works integrate it into the config.
IMPORTANT: The script needs to be available at /home/pi/Adafruit_Python_DHT/examples/AdafruitDHT.py
Brightness sensorSince the raspberry can only read digital inputs by default, you'll need some help getting more info than 0 and 1. Otherwise you could only distinguish between dark and bright, nothing else. So you'll need a converter like the MCP3008 to transfer the different values over the SPI bus.
Here's a very nice walkthrough on interfacing the chip with your raspberry. However I chose to switch the left two cables (3.3V and ground). So the measured value will rise the brighter it is. I found that more intuitive. Use the script from the website to test your installation. However HomeControl will bring its own script to read the value as I need a more machine-readable output.
Power sensorIf you have a TP Link HS110 socket a related power usage sensor will be created/changed/deleted.
Door/window sensorCurrently supported over zigbee2mqtt.
This step is only necessary if you want to connect to the server using encryption (what I strongly recommend if you intent to use this software over the internet). This chapter can only cover managing a java keystore. It does not explain how asymetric encryption is working in general. You create only 1 keystore, so the keystore filename should always be the same.
You have two general choices:
Basically HomeControl can catch on to your MQTT server that is from the other end fed from a working installation of Zigbee2MQTT. You can get it at https://www.zigbee2mqtt.io. Keep it mind you also need to purchase some hardware which is relatively inexpensive though.
|HomeControl can be used with Snips voice assistant. Keep in mind snips has been more or less discontinued since the company was bought by Sonos.|
HomeControl can be used with Rhasspy voice assistant.
It's rather simple. Start/Stop script is installed if the installation was successfull.
You can execute commands to a running server with the -sendCommand parameter. For example you can utilize this to automate stuff using other application.
|Here is a list of available startup parameters along with links to a closer description.|
Here are some of the most common problems along with possible solutions.
Here are examples for scripts that can be integrated into rules:
HomeControl - Copyright by Jens Schröder, 2015 - 2023