Hi all,
I do currently have problems with some INNR Light Bulbs randomly turning on for no apparent reason. They’re not part of any flow, do turn on at random times of the day and the Timeline of the Bulb only says that they were turned on by the “INNR” App. However, the INNR App does not turn on any lights. This is reported wrongly by Homey.
I already contacted Athom Support and the Developer of the INNR App. No one of them was able to help unfortunately. I’d now like to write a HomeyScript that detects when a Bulb was turned on “by the INNR App” so that I can automatically turn it off.
The Bulbs are sometimes on for the whole night because I don’t always see them turning on randomly (I have over 26 INNR Bulbs scattered in my Home).
What I tried to do was to get the Logs for each “light” class device and check the Logs for that specific Device. However, the following code doesn’t seem to work as the Filter is completely useless and returns all Logs.
const lights = Object.values(await Homey.devices.getDevices()).filter(device => device.class === 'light');
for (const light of lights) {
const logs = await Homey.insights.getLogs({ filter: { id: `homey:device:${light.id}:onoff` }});
console.log(logs.map(log => log.id));
}
Example Output (part of it):
'homey:device:ad249cdd-0a1b-449d-86ea-86e08fe6814c:measure_current',
'homey:device:ad249cdd-0a1b-449d-86ea-86e08fe6814c:measure_voltage',
'homey:device:ad249cdd-0a1b-449d-86ea-86e08fe6814c:meter_power',
'homey:device:ad249cdd-0a1b-449d-86ea-86e08fe6814c:onoff',
'homey:device:ae14532c-1d7e-4d64-966f-35b43b92bcf9:onoff',
'homey:device:af2639ec-b6e9-4364-9c1f-b988a839439d:onoff',
'homey:device:b048c0f6-24f7-4203-9c0a-0585f5815375:onoff',
'homey:device:b1ee6bf6-edca-47cb-b198-fd7a7a1671b4:onoff',
'homey:device:b6ed8c56-71c5-4417-890f-7aed25da29ac:onoff',
'homey:device:c1bbc031-8b78-4afe-a1bc-57c521fc21c1:alarm_battery',
'homey:device:c1bbc031-8b78-4afe-a1bc-57c521fc21c1:alarm_motion',
'homey:device:c1bbc031-8b78-4afe-a1bc-57c521fc21c1:measure_battery',
'homey:device:c1bbc031-8b78-4afe-a1bc-57c521fc21c1:measure_luminance',
'homey:device:c1bbc031-8b78-4afe-a1bc-57c521fc21c1:measure_temperature',
So not only the Logs for my “light” class devices are returned, but all of them (luminance and temperature for example are my motion sensors).
Am I using the filter the wrong way? The Homey API SDK is kind of garbage…