## 8. Work together with an app inventor group

So far, we have only exchanged data between different devices within our local network (our own WLAN ). Now we want to make it possible to access the dollhouse from anywhere in the world. Now work together with the group that has been working with the MIT App Inventor. Try together to control the light in the doll's house with the smartphone app.

## 8.1 Overview

With a smartphone, you should be able to switch the light (or another actuator) on or off in the dollhouse. This endeavor could be simplified via MQTT as follows:

## 8.2 Implementation on the Smartphone (MQTT Client 1)

Your partners have been working on a smartphone app that you can use to control your light in the doll's house. Talk to them and find out how the app works.

## 8.3 Implementation on the Raspberry Pi (MQTT Client 2)

- Select Tab "Beleuchtungs- Beispiel"
- In this flow, you will find a purple 'mqtt in' node. It is used to subscribe to any topic at a broker. This node has been pre-configured by the instructor. Therefore, a secure connection to an MQTT broker on the internet is already established. For authentication with this broker, a username and password are already set. You are now connected to the same broker as the smartphone of your partners.
- Double-clicking on this node will display the following settings. Change the number here (unless you have position 3), according to the label visible on the upper left side of the dollhouse wagon.

- Connect the output of the purple node to the input of the lighting in the 1st floor.

- Also, draw a connection to a debug node to check later if data is coming from the MQTT Broker.

## 8.4 Testing and Reflecting!

Now, the remote control with the smartphone should work. Discuss with your neighbor:

- What path do the data take from the smartphone to the dollhouse?

- Do the data stay within the same room?

- Are the data transmitted securely?

- Who else has control over your lighting?

Tip: You can locate the MQTT Broker by entering the broker's URL 'schnupperkurs-mqtt-broker.s2.eu.hivemq.cloud' here:

https://www.handy-sofort-orten.de/ip-adresse-orten/ip-adresse-und-standort-von-webservern-zeigen/

## 8.5 Develop the app further

Publish the current temperature via MQTT so that you can retrieve the data later using your smartphone. Work together and find out how you can do this.