Communication between an Arduino to Home Assistant

As one of the goofiest projects you’ll ever see, I’m building a stink detector to determine when one of my kitties drops some friends off in the litterbox. Currently I have a motion sensor that determines when one of my pals enters the dedicated bathroom for their boxes and that turns on the exhaust fan for 15 minutes. But to be honest, 15 minutes isn’t enough sometimes. I’m blaming Penny, as I suspect she’s the one for the awful stench. I suppose I could extend the fan run time, but why should I when we have the technology?

The main component in the malodorous scent in poo and farts is hydrogen sulfide (H2S). A MQ136 sensor should be able to detect this. I’ve already built a prototype on an Arduino breadboard, and I’m “burning in” the sensor. Unfortunately my Arduino is too old to have WiFi, but I’ve got half a dozen micro ESB286 units that do have WiFi.

So what’s the best way (or what are my options) to have the Arduino trigger HomeAssistant when the stench is first detected in order to turn the fan on and turn it off when the odor dissipitates?

MQTT is probably the simplest?

Just publish a topic, /kitty/stink = 1, then when it goes away, change it back to 0. Have HA read that as a sensor.

In one project I had arduino sending json through serial to ESP of which simply relayed that to mqtt server. It’s easy to use the same method towards arduino.

Check https://esphomelib.com/esphomeyaml/ for building sensors based on ESP32/ESP8266.

If your code runs on on an arduino it /should/ run on an esp8266 too. This plus mqtt is what I do with all sensors now.

I just noticed HA now has webhooks. That might even be easier.

Hello people
I have an automation project with two Mega Arduinos and over 70 relays, all wired. I am implementing the Home Assistant and I am having difficulty making the communication between the two. The two arduinos are connected to my network via LAN. Could someone help me how to do this case. I’m having a hard time and that would be very important for my project.
thankful

thanks for the point to the MQ136 - exactly what I want for a sensoe