Would like to pass messages from IOT broker to home network broker so that Home Assistant on another Pi can can get the messages. Move to the Home Assistant directory. Do you want to control a standard wall outlet device with your microcontroller, but don’t want to mess with the high-voltag… For more information about MQTT, check out some of the links below:Need some inspiration for your next project?
Erste IntegrationenUnabhängiger Blog zu Technik, Hardware, Software und Do-it-yourself im angenehmen Format. The first one is to install HASS.io on your Raspberry Pi as operating system. MQTT (aka MQ Telemetry Transport) is a machine-to-machine or “Internet of Things” connectivity protocol on top of TCP/IP. Then the sensor gets a name and we define the unit of the measurement because MQTT transfers the data as string without a unit.At this point of the tutorial I give you a bonus: We will not only add the temperature of the weather station but we add also the temperature of the CPU and GPU of the Raspberry Pi and also the clock speed.Therefore we add the following snippet to the configuration file:Then we save the file and restart Home Assistant via Configuration → Server Controls → Restart.There are multiple ways to configure sensors in Home Assistant. you want it to be shown, then follow the next step. LCD Touchscreen HAT for Raspberry Pi - TFT 3.5in. Your first step to get MQTT and Home Assistant working is to choose a broker.
After that, click on Start and give it a couple of minutes for Node-RED to initiate.. After Node-RED is up and running, you can refresh Home Assistant, and the Node-RED option would now be available on the sidebar.
You can easy switch to one article and come back later.The following table gives you an overview of all components and parts that I used for this tutorial.
Just like before, make sure to fill in the WiFi credentials and the IP address of your Raspberry Pi broker like you did in the previous example.Find the built-in LED connected to GPIO pin 5 on the second ESP32 Thing.Once the second ESP32 connects to the network, it will automatically subscribe to Hopefully, this tutorial has given you a starting point to integrate MQTT in your home automation project. Jetzt kannst du nochmal eine Testnachricht in das test-topic senden. Add it to your cart, read through the guide, and adjust the cart as necessary.Depending on your setup, you may also need the following. You may not need everything though depending on what you have. To test this, from the terminal window of the Pi, we're going to subscribe to Press on the ESP32's button that is connected on GPIO pin 0.Now when we press the button on the ESP32 connected to GPIO pin 0, we should see the on/off commands as shown below.Now that the switch is connected to the broker, we need to connect a device that will react when a new message is sent to the topic. Checking the configuration before reloading or rebooting is a simple habit which can help you avoid unpleasant things.Once the system has restarted, reopen configuration.yaml look for “sensor” and underneath add:Obviously the name of the topic and element like the unit of measurement depends on what you are aiming at and what sort of sensor you are connecting.The information you have here in the configuration file are the same you need to add to the code you load on the sensor.If everything is in order and the sensor is working correctly – to be sure at this point I still keep REPL open to see the messages it prints – on your dashboard you should see your new entity and the value read by the sensor.