Monitoring mains voltages

I am looking for almost the same.

I have some outdoor motion triggered lights, and I have connected them to a Sonoff Pow. When the power is above a threshold value, I assume the light must be turned on.

I have an outdoor motion sensor connected to a Shelly 1, but it isn’t working good. I needed to insert a relay between the two to get it working. (Shelly 1: 25VAC on input - Motion Sensor attached gives 100 VAC)
But I think attaching it to your hot-water system should work. (https://shelly.cloud/shelly1-open-source/)

And it should be possible to just use a esp8266 with an optocoupler to detect mains voltage. (https://www.aliexpress.com/item/1-Bit-AC-220V-Optocoupler-Isolation-Module-Voltage-Detect-Board-Adaptive-3-5V-For-PLC-Isolamento/32828199766.html?spm=2114.search0604.3.22.76bc5c1cOaf0nB&ws_ab_test=searchweb0_0,searchweb201602_2_10065_10068_319_317_10696_10084_453_10083_454_10618_10304_10307_10820_10821_10301_537_536_10902_10843_10059_10884_10887_321_322_10103,searchweb201603_51,ppcSwitch_0&algo_expid=698b1ac0-6421-4ab4-a717-c21eef65504c-3&algo_pvid=698b1ac0-6421-4ab4-a717-c21eef65504c&transAbTest=ae803_3)