Home automation with a Raspberry Pi

Objects and Custom Scripts

The Objects dialog lists all the existing adapters with their respective configuration options. They are summarized in a tree below the respective instance (Figure 6). You can typically modify the configuration of the end devices in the individual folders by adjusting the predefined values. Because the individual attributes of the devices are also required for creating corresponding controls in the Vis editor visualization dialogs (discussed in the next section), you will want to assign meaningful names to the object attributes and enter them in the corresponding lines of the attribute view to ensure a better overview of the features in the Vis editor interface.

Figure 6: The Objects view shows the bundled device-specific attributes.

Because the current configuration of a component does not yet allow automated control, ioBroker offers a scripting option for installing a convenient interface: the JS Script Engine adapter. In the interface, you can choose whether you want to create the script in JavaScript, Blockly, or TypeScript. If you choose Blockly, ioBroker integrates a modular system that allows programming of components through the underlying JavaScript back end with graphical puzzle pieces.

Once you have integrated the script engine into the system, a new Scripts entry appears in the sidebar, where you can call the engine. Script programming requires some prior knowledge, but the ioBroker developers do offer detailed documentation to help you out [5].

Uniform Interface

With the help of the Vis interface, you can combine your entire private IoT into a unified control center. Vis is also implemented as an adapter and installed when the control software in ioBroker is installed. The visualization module combines all common control elements such as switches, scripts, and scenes of the smart home infrastructure in a uniform, web-based interface that you can access with any end device (Figure 7). To access the interface, either call the corresponding adapter in the Instances group from the adapter web page icon, or enter the IP address of the Raspberry Pi followed by port number 8082 in the address bar of a browser.

Figure 7: Build your own smart home control interface in the Vis editor.

If you call the Vis adapter from the Instances view, the Vis editor appears, where you can define the individual attributes for the end devices to be controlled. The editor has complex optional settings for the respective actuators, switches, sensors, and terminal devices; it is a good idea to read the manual up front to avoid creating faulty controls. The individual device attributes can be found by choosing the Objects item in the ioBroker sidebar (Figure 6).

If you call the Vis adapter manually from the web browser, you are taken to a dialog that presents an editor; clicking the VIS RUNTIME button opens the preconfigured control interface, which you can use to switch the individual devices on and off or to display information. A tablet that displays this interface in the browser is ideal for this task, letting you monitor and control your infrastructure conveniently, simply by tapping.

In the Vis interface, you can also include widgets in the editor that provide you with information such as the weather situation or a time display. Widgets are enabled in the same way as traditional device controls [6]. The system lets you freely design the widgets in terms of appearance; the same applies to the Vis interface background. The developers provide basic layout templates that can be freely customized.

Developing Scenarios

ioBroker lets you program and use scenes to control your device groups individually. To do so, use the Adapters selection to integrate the scenes adapter into the system. After doing so, the new Scenes option appears in the vertical bar on the left side of the program window. On opening, you are taken to the scene editor, which lets you define individual, changing settings profiles for individual components or component groups.

ioBroker stores the settings profiles in a tree structure. Once you have captured one or more of these scenes, incorporate them into your control interface in the Vis editor; then, you can manage multiple devices together by predefined scene profiles (e.g., automatically dimming the lights and lowering the blinds for a home theater setting).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Home Assistant with MQTT

    Automating your four walls does not necessarily require commercial solutions. With a little skill, you can develop your own projects on a low budget.

  • Safe Messaging with TLSA

    Decoupled application design gets in the way of secure communication, but a little known feature of DNS can provide message security.

  • ESPHome

    With an ESP32 or Raspberry Pi Pico W microcontroller board, you can easily create your own home automation devices. Thanks to ESPHome, you don't even have to be a programmer.

  • Tasmota

    Flashing IoT devices with new firmware lets you wield control and keep them out of the cloud.

  • Controlling a Smart Plug

    You could spend hundreds of dollars on specialized IoT appliances and fixtures, or you could just hack a smart plug and talk to it with your Linux system.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News