How to receive datas/events from Raspberry to display it to Insight?

Hi all,
I’m looking for a solution to monitor my tank water from garden.
I have built a Raspberry PI with HC-SR04 sensor and it works. I can gather my tank water level form linked LCD to the Rpi.
Now, I would like to send sensor datas to Homey, allowing me to monitor it, create flows on triggers event and notify me about the tank water level.

My ultimate goal is to have an App for that and then a device to display.
But first, I would like to gather events and build an Insight for monitoring water level.

I don’t know how to say to Rpi “send data to homey” and then from Homey “Ok Rpi, thanks for data now I can show you cool graphic from Insight”.

Any idea how to make Homey and Rpi to speak together ?

Thanks in advance for all answers.
Best regards.

With MQTT apps they can send messages to eachother.

Thanks for reply.
I have deployed MQTT Broker, MQTT Hub and MQTT Client on Homey.
Just configured the IP addres and, for testing, disable the user auth.
Now, I have created a MQTT device from Homey with 2 capabilities.
The device is configured as following :
2022-08-30_105259

2022-08-30_105308

The Advanced → Topics contains :

{
  "alarm_water": {
    "capability": "alarm_water",
    "stateTopic": "",
    "setTopic": "mqtt/tankwater",
    "valueTemplate": "",
    "outputTemplate": "",
    "displayName": "Water alarm"
  },
  "meter_water": {
    "capability": "meter_water",
    "stateTopic": "",
    "setTopic": "mqtt/tankwater",
    "valueTemplate": "",
    "outputTemplate": "",
    "displayName": "Water Meter"
  }
}

The device is n,t updated.

I have tried by changing the “setTopic” with complete path :

{
  "alarm_water": {
    "capability": "alarm_water",
    "stateTopic": "",
    "setTopic": "mqtt/tankwater/alarm_water",
    "valueTemplate": "",
    "outputTemplate": "",
    "displayName": "Water alarm"
  },
  "meter_water": {
    "capability": "meter_water",
    "stateTopic": "",
    "setTopic": "mqtt/tankwater/meter_water",
    "valueTemplate": "",
    "outputTemplate": "",
    "displayName": "Water Meter"
  }
}

The device is not updated too.

I’m using MQTT Explorer to test sending values (INT and BOOL). The Homey device is not updated:


Then, I have tried to force update value from AdvancedFlow (thanks to Homey team for this fgeature, it’s very usefull !) :

I confirm I receive Push Notification on my phone. This confirm Homey is well configured and my client (MQTT Explorer) can contact it and send datas.
BUT, I don’t understand why my MQTT Device is not updated with sent values.

Any ideas ?

I’m pretty sure you need to configure the stateTopic to retrieve the values, not the setTopic (which is to set the values from Homey).

A MQTT device doesn’t need a flow:
I entered the state topic of a Home Assistant sensor to the MQTT device, and the value appears

Insights:

@robertklep you right, the “stateTopic” is the good parameter to configure !
Thank you very much !

@Peter_Kawa I have tested by disabling my flow, and it does not works.
I need to use stateTopic insteadd of setTopic (thanks @robertklep ) AND create a flow to manage them.
I don’t understand why I need to use flow in addition to MQTT, I think this is not the normal statement, but it works.

My current config:

{
  "alarm_water": {
    "capability": "alarm_water",
    "stateTopic": "mqtt/tankwater/alarm_water",
    "setTopic": "",
    "valueTemplate": "",
    "outputTemplate": "",
    "displayName": "Water alarm"
  },
  "meter_water": {
    "capability": "meter_water",
    "stateTopic": "mqtt/tankwater/meter_water",
    "setTopic": "",
    "valueTemplate": "",
    "outputTemplate": "",
    "displayName": "Water Meter"
  }
}

2022-08-30_150636
2022-08-30_150643
2022-08-30_150650

With this configuration I con continue with the next step, make my Raspberry to send mqtt events to Homey.

Again, thanks @robertklep @Peter_Kawa .
I will complete later this topic to complete the case.

Best regards

1 Like

Coming back with elements.
My project work as expected.
The RPi calculates distance between the HC-SR04 (distance sensor) and target object (finally, the water level).
Getting the distance in cm, show it on LCD display connected to RPi, and send the INT value to Homey through MQTT and device.
This allow me to monitor the water level from the tank directly from the LCD, without phone/computer and trigger with Homey automation and warning using AdvancedFlows.

Below my draft project (RPi+LCD20x4+HC-SR04 sensor):

Thanks to Homey community.

4 Likes