ESPHOME MQTT setup AI-on-the-edge-device

I am working for days at the GitHub - jomjol/AI-on-the-edge-device

At least managed to get the values ​​read correctly.
Only the integration into HA does not want to work. Can’t find any useful instructions.
If I create a device for the ESPHome and then write the config to the ESP via the Ras4, I can no longer get to the UI via the wlan

Afterwords Esp-Home device is found for this, but without an entity!
Is the procedure correct at all to run an ESP Home install over it?

Looks like, that the ESPHome setup overwrites my installation !

I have this entry in the config:

[MQTT]
Url = mqtt://10.0.0.88:1883
MainTopic = water meter
ClientID = water
user = wateruser
password = waterfall

I then created this user in Mosquitto Broker… Is that even true?
I’m afraid I didn’t understand the principle of how to get an entity from ESP as a sensor in HA.
thank you for your help

I then created this user in Mosquitto Broker… Is that even true? I’m afraid I didn’t understand the principle of how to get an entity from ESP as a sensor in HA.
thank you for your help

I think you are mixing various “technologies” here. Your linked github (AI-on-the-edge-device) looks like to have :zero: to do / in common with esphome.

How esphome works described in detail on the website (search function included):

Little spoiler on that one: I have around 100 esp(home) devices and in total :zero: mqtt broker :wink:

What orange-assistant says.
ESPHome is a way to program ESP (and Pico) micro-controllers, but there are at least half-a-dozen other ways. The project you mention uses one of those other ones.

There is an API available, apparently: REST API · jomjol/AI-on-the-edge-device Wiki · GitHub (not exactly well documented, though)
You can use HA Restfull sensors to hook it up

You don’t need ESPhome with the AI device. Just configure the needed values as MQTT sensors in HA either in configuration.yaml or via the auto-discovery of MQTT.

Btw: I would not recommend using whitespaces in the MQTT configuration of the watermeter (water meter → water_meter)

To use auto-discovery you have to create configuration items in your MQTT broker. This can be done via HA developer tools by calling the service “MQTT Publish”.

Example configuration for value item:

item: homeassistant/sensor/water_val/config

payload:

            {"~": "homeassistant/watercam", "unique_id": "water_val",
              "device": {"name": "watercam", "mf": "jomjol", "identifiers": "watercam"},
              "name": "water_val", "state_topic": "~/water_meter/value", "device_class": "water",
              "state_class": "total_increasing", "unit_of_meas": "m³",
               "avty_t": "~/connection", "pl_avail": "connected", "pl_not_avail": "connection lost"
            }

Retain: ON

@keicherr

thx for your help. But I am still a bit confused.
You talk about a service which I have to start at developer tools → MQTT Publish
I am not sure how I can handle services there. Are they running forever. What do you mean by:
item: homeassistant/sensor/water_val/config ?

I think it is much easier for me to handle that in a yaml file.

In your payload script I see things like watercam and water_val . This confuse me as well. As i written before I define the following at the esp.

[MQTT]
Url = 10.0.0.88:1883
MainTopic = water_meter
ClientID = water
user = wateruser
password = waterfall

Would you please so kind and use this variables and help me out … Thx !

The MQTT sensor declaration for the watermeter value in configuration.yaml should look like this

mqtt:
  sensor:
    - name: "water_meter_value"
      state_topic: "water_meter/main/value"
      device_class: water
      state_class: total_increasing
      unit_of_measurement: "m³"

Hope this helps. :slight_smile:

1 Like

Thx a lot … lloks good now

Why didn’t you simply follow this explanation?
https://github.com/jomjol/AI-on-the-edge-device/wiki/Integration-Home-Assistant

But ok, re-inventing the wheel might also train the yaml skills :smiley:

1 Like

That was the link i am looking for :laughing:

Bye the way, right now I have this service running via the call in the developer option
is it always starting after reboot ?

service: mqtt.publish
data:
  topic: watercam
  retain: true
  payload: " {\"~\": \"homeassistant/watercam\", \"unique_id\": \"water_val\",               \"device\": {\"name\": \"watercam\", \"mf\": \"jomjol\", \"identifiers\": \"watercam\"},               \"name\": \"water_val\", \"state_topic\": \"~/water_meter/value\", \"device_class\": \"water\",               \"state_class\": \"total_increasing\", \"unit_of_meas\": \"m³\",                \"avty_t\": \"~/connection\", \"pl_avail\": \"connected\", \"pl_not_avail\": \"connection lost\"             }"

Thx to all helpers !

This works suprisingly well on my water meter :slight_smile: .
Currently, it reads every cubic meter. But I would like to read cubic centimeters.
Or with a comma (for example: 350.49 cubic meter)

Who has experience in this?

But I would like to read cubic centimeters.

That is possible, just set up the analog counters as well.

1 Like