IoBroker Installation on Raspberry Pi or Debian Linux
by MyHomeThings in Circuits > Raspberry Pi
3823 Views, 1 Favorites, 0 Comments
IoBroker Installation on Raspberry Pi or Debian Linux
What is ioBroker?
What good is ioBroker for me?
IoBroker is an open source free software for bringing different smart home devices (IoTs) together into a complete system (smart home system). These tools work on their own, but you get a complex control panel with a graphical interface that can be accessed on the local network with a web browser.
You can find a little more of the original page here: What is ioBroker?
IoBroker consists of modules called adapters. Smart devices connect to ioBroker with adapters. You can install the necessary adapters with one click and use them after a quick installation.
IoBroker can be installed on a SoC single-card computer (RaspberryPI, OrangePI, etc.) or on a desktop PC running Windows or Linux. I recommend using Linux, I tried on Windows with little success.
A good solution is to install the operating system on a RaspberryPi 4.
Supplies
The IoBroker Installation
I assume the operating system is installed.
You can read the original post here: ioBroker installation on Raspberry pi or Debian Linux
In the first step, update the system.
sudo apt-get update && upgrade
Check the installed versions of nodejs and npm..
node -v nodejs -v npm -v
If the version is correct or no version number is returned, we can proceed with the installation.
If the version is not correct it should be removed as follows.
sudo apt-get --purge remove node sudo apt-get --purge remove nodejs sudo apt-get autoremove
Then reboot the system.
sudo reboot
Install node.js
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - sudo apt-get install -y nodejs
On Debian as root
sudo su curl -sL https://deb.nodesource.com/setup_12.x | bash - apt-get install -y nodejs
Then reboot the system.
sudo reboot
Check the nodejs version again.
node -v nodejs -v
If node -vthe answer is “not found”, enter the following at the command prompt:
sudo ln -s /usr/local/bin/nodejs /usr/bin/node
Let’s see the npm version:
npm -v
This must return a version number higher than 6. If not, update npm:
sudo -H npm install -g npm@6
Install ioBroker:
curl -sLf https://iobroker.net/install.sh | bash -
Other commands for ioBroker
sudo systemctl stop iobroker sudo systemctl start iobroker sudo systemctl restart iobroker
Now open the IP address you received at the end of the installation in your browser
For example: http://192.168.8.102:8081
You Can Start the Settings.
After completing the basic settings, go to the Adapter tab.
In the Adapter panel, install the required adapters.
IoBroker and MQTT Adapter
One of the most important accessories of our self-made Smart Home devices is the ioBroker MQTT adapter. MQTT allows low-resource bidirectional communication, so the MQTT protocol is a good option for data exchange between ioBroker and microcontroller.
The original page can be found here: ioBroker and MQTT adapter
The MQTT adapter must be installed first. To do this, enter MQTT in the viewfinder in the adapter panel, then select (Picture 1) the MQTT Broker / Client adapter.
Click on the “+” button: (Picture 2)
When done, select Server / broker, select the IP address below. You can set a user name and password, but this is not required on an internal network. (Picture 4)
We're done. You can use the MQTT adapter. Click the “Play” button. (Picture 5)
In the Object panel is the MQTT adapter, nothing is connected yet. (Picture 6)
Let's See Our First Device
In this step, I would like to show how easy it is to create various smart devices using NodeMCU ESP8266 in an arduino framework and integrate them into ioBroker using the MQTT protocol. We turn on an LED.
You can read the original post here: NodeMCU ESP8266 to ioBroker, connect relay via MQTT
The circuit only needs a few components:
Put it together on a breadboard (Picture 1).
Instead of the LED, you can also switch a relay module. (Picture 2).
Attention!
Mains voltage is not a toy and can cause a fatal electric shock or fire! Only at your own risk and only if you know what you are doing!
You can find more interesting things here
Upload the code to the NodeMCU ESP8266 using the Arduino program
#include <ESP8266WiFi.h> #include <PubSubClient.h> const char* ssid = "Wifi SSID"; const char* password = "Wifi Password"; const char* mqtt_server = "192.168.xxx.xxx"; int Led = D5; WiFiClient espClient; PubSubClient client(espClient); void setup() { WiFi.mode(WIFI_STA); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); } client.setServer(mqtt_server, 1883); client.setCallback(callback); pinMode(Led, OUTPUT); digitalWrite(Led, LOW); } void loop() { if (!client.connected()) { reconnect(); } client.loop(); } void reconnect() { while (!client.connected()) { String clientId = "ESP8266_LED_Client"; if (client.connect(clientId.c_str())) { client.subscribe("LEDtopic"); } else { delay(6000); } } } void callback(char* topic, byte* payload, unsigned int length) { payload[length] = '\0'; String strTopic = String(topic); String strPayload = String((char * ) payload); if(strTopic == "LEDtopic") { if(strPayload == "false") { digitalWrite(Led, LOW); } if(strPayload == "true") { digitalWrite(Led, HIGH); } } }
Our device has been released, now we can control it. In the text box, type “true” to turn it on or “false” to turn it off. (Picture 3).
I hope you enjoyed the article and it was useful information for you.
I look forward to your feedback.
Have a nice day!