Script last BatteryDate, check all devices

I want to create a scene every time i turn on my kitchen light, check last BatteryDate and if its greather then PollSettings play an annoucement on my sonos which device did not report.

The purpose of that script is to check if the battery are dead (or still powered).

I just need help for the script.
Probably a lot of peoples will use also that script for checking if devices are still powered.

Thanks for your help

I have set up scenes that notify me when a device has 5% battery. Gives me time to get replacement batteries until the battery level gets to 1%. Even 1% give me a couple of days notice.