Home Assistant[0] is a great tool to act as this bridge. It can act as a HomeKit device, so anything it knows about can be exposed to Apple devices via the Home app. It also has integrations to talk to virtually anything, or you can build your own IoT devices with ESPHome[1].
So much this - ESPHome is incredible. The next amazing bit is how good a system you can cook up with some low cost ESP8266 or ESP32 chips and a few sensors.
I’ve been looking for ages for a decent thermometer that connects to Home Assistant. All were expensive and required all sorts of contortions to get into HA. A week or two ago I bought some US$6 chips and a few US$3 sensors and they had me there in short order. I have no electronics background and very little coding experience.
If you want to take this kind of thing to the next level, check out Node-RED. It's a visual programming environment that's well-suited for home automation.
One of my most-used automation setups is a dust collection fat near the cat litter boxes. The basic idea is to turn the fan off, if it's on, when the cats approach, then turn it on five minutes after they leave and turn it off ten minutes later. The cats are detected using a PIR sensor hooked to an ESP8266 running ESPHome. I've also got an automation which will turn the fan on and ignore the PIR sensor for ten minutes so that I can clean the litter without breathing in a bunch of dust - this part is kicked off via an input_boolean that's exposed to HomeKit, so I can tell Siri to turn it on and it triggers a whole bunch of work.
The main thing that prevents me from DIY IoT is worry about fire hazard. Is there a guide out there for picking right components (e.g. are Sonoff devices solid enough) and assembling them in a way they could be safely plugged to mains, or used to switch mains power? Alternatively, are there guides on how to build battery-powered IoT? I'd be fine powering stuff around home from rechargable AAs if I had a clue on how to build IoT devices like that (IANAEE).
Yeah, I would not suggest DIY'ing anything that's directly connected to mains power unless you are super sure you know what you are doing. That's a really good way to cause you problems with your homeowner's insurance if you have a fire and it could be against your local building codes.
That said, there are devices out there that can be used on mains power that are UL certified. I have a ton of Z-Wave [0] switches and relays for various things all talking to Home Assistant. Z-Wave is an open [1] (or soon to be open) mesh networking communications protocol that is pretty widely used and supported, so you're not locked into a single vendor.
For low-power stuff, I'm a bit more willing to experiment, but not on mains power. But I am also not an EE. :P
For powering my ESP32/ESP8266 stuff, I use "trustworthy" USB power supplies (e.g., stuff from a brick-and-mortar store, or leftover iPhone adapters, not random Aliexpress adapters) and use short USB cables to connect them. Costco usually has some kind of appropriate adapter for a reasonable price.
For controlling 110V loads, I've found that the Ikea TRÅDFRI outlets work well. If you stay within the TRÅDFRI ecosystem, you need a "steering device" such as a switch or remote to pair them to the gateway, but if you're willing to step outside that ecosystem Zigbee adapters like the ConBee II can talk to the outlets directly (I'm in the process of migrating my Ikea gear to this). The Home Assistant TRÅDFRI component works well.
I use USB chargers/hubs for anything I build myself, and Sonoff plugs (even better if they're the kind you don't need to splice into wires) for anything that needs to control mains. This approach has worked excellently so far.
So far my chips are all sensors powered off USB. Adding relays is next level and I haven't done that.
I've relied on smart plugs that are wall-wart style.
However I want to refill the boiler automatically on an old La Cimbali Junior and when I find an ultrasound sensor that will penetrate my espresso machine's boiler and detect a low water level (risking element burn out) I likely will though. I've tried a Hall sensor and one ultrasound sensor and neither work. I think I need an ultrasound sensor designed for fuel tanks or similar.
A quick look at the manual suggests that there's a light that tells you when it needs to be filled with water. It might be easier to just trace that back and piggy back off of whatever sensor it already has.
It may be too small for an ultrasonic sensor to work well. The ultrasonic sensors I've used are all basically blind to anything closer than 5-10cm.
If your goal is just to fill the reservoir automatically from a plumbed-in water source, without monitoring/logging water levels, a small float valve like this[0] might be a good answer too. I don't know how big the reservoir in your machine is, nor do I know if this particular valve is food-safe.
You should definitely fix that light though. That sensor may also be part of a safety cutoff to prevent burning out the element.
You probably don’t need an ultrasound sensor or anything fancy for detecting water levels. Get a couple of strips of conductive metal which isn’t going to rust, then stick them down either side of the water tank, and finally hook the top of those strips into an ESP8266 or similar. When water level is above the required point the water will complete the circuit, and when it drops below the circuit will be broken.
There are two water levels that could be monitored, the stainless reservoir and the brass boiler. Despite the metal I think it would still work for the reservoir, because this seems to be how new models work.
It’s the boiler I mainly want to monitor however, and it is very hot and is pressurised.
I had no idea about that, but some cursory Googling seems to indicate this property is only really true of fully purified water - either via distillation or turning it into steam first. I suspect that all but the most impressive water filters are still going to give you conductive water, but regardless it’s an easy thing to test.
Xiaomi makes a $10 BLE temperature and humidity sensor. You don’t have to use their proprietary app, there’s an open source MQTT bridge available. It also has a display and runs for months from an AAA cell, which anything esp8266 based won’t.
They won’t run long on battery if you try to run them constantly. This is why they support deep sleep, which allows you to instruct it to shutdown until an interrupt is fired by either the real-time clock, or some other input. Typical behaviour for a device like a temperature sensor is to wake up, report the temperature, and then go back to sleep either for a set duration or until a significant change in temperature is reported by some lower power components.
Thank you - I’ve been playing with this and it’s really neat. It’s an amusing workflow in ESPHome as you have to work out when the device is awake to run an OTA update.
[0] https://home-assistant.io/
[1] https://esphome.io/