I haven't tried these, but they might be more suitable for an outdoor garden, and I've heard good things: https://www.blumat.com/tropf/das-tropf-blumat-system/vorteil...
I think there's a way to hook the latter up to mains water if you have a big install.
Basically, the soil moisture determines the watering rate via diffusion through a clay cone.
I was getting all ready to rig up some custom raspi sensor based watering thing when I found this and realized that my way would have been waayyyy more maintenance headache, more expensive, and probably not work as well.
I have automations to limit watering if it has rained recently, and also to increase watering if the day has been extremely hot. Still looking to make it even smarter but this has already been a great improvement.