One flow to log all device status changes?

How can I create a flow that adds a log entry and/or sends a notification when any of my devices is turned on or off?
There is a flow card that you can use to report when any device has not reported to Homey, but I cannot seem to find this for status changes.
Do I really need to create separate flows for every device I own?

Depends on what you would like to log to. There are a few apps that could do it for you, but they log to a Influx of Microsoft SQL database.

Or maybe mttq can be of use?

Try papertrails!

I use Papertrails. So what I would like to achieve is that if a light is switched on, a line is added to the Papertrails log stating “(date)(time) [device x] switched on”.

You can’t. You need a flow for that. A flow per device.

Like I said, there are some apps that can help you without having to create a flow for each device, but they log to dabases, not to papertrail.

This is not a text log file, (for us normal users that is), but maybe this is somewhat usable? It’s build in since some time.

Hitting the “x hrs ago” line will reveal timestamp.

I am aware of this functionality, but what I am looking for is to consolidate exactly this info for all devices in one logfile.

Amazing that this is not a standard functionality.
So which apps are you suggesting?

I get that, the “funny” thing is, the on/off data presented is stored in some kind of log file.
So if anyone knows how to retreive that with Homeyscript?

A workaround: if you entered different energy levels for your on/off devices,

your desired data is available in Insights.

While using an insights export app, you can create your logfile

I decided to create two flows for every device: one to log turning and one to log turning off the device. A bit cumbersome, but by using the web version of the Homey app it took a reasonable amount of time.
I still find it remarkable that information that is available in the system cannot not be consolidated in a file and/or exported.

Homey is a black box, which is intentional. Athom doesn’t want users to have too much control over it.

AFAIK on/off data (or any other boolean data) isn’t stored, so a Homey script won’t help you there.

I don’t understand that… The info from the on/off data below has to come from a file / database of some kind. Where do you think it is from? It has to be stored somehow?
It also survives a system reboot, so it’s not in RAM only.

all boolean values are also stored in “insights” database like all other values, the insight page on (and previously just doesn’t show them, only number insights.


I stand corrected then :blush: didn’t know that.

1 Like

So, now all we need is someone to write an app to collect and store all device activities in a CSV, ready for export. :upside_down_face:

Sure, although it was a bit of trial-and-error :wink:

let allDevices = await Homey.insights.getLogs()
let onoffDevices = allDevices.filter(function (capability){
onoffDevices.forEach(async (device) => {
  let deviceData = await Homey.insights.getLogEntries({uri: device.uri, id:})
  deviceData.values.forEach( value => {
    console.log(, value.t, value.v,'(', value.originName, ')')

It will output something like this

Switch Lampen Keuken 2021-10-17T23:29:14.677Z false ( Lampen Beneden Uit )
Switch Lampen Keuken 2021-10-18T05:37:23.481Z true ( deCONZ )
Switch Lampen Keuken 2021-10-18T06:19:52.820Z false ( deCONZ )
Switch Lampen Keuken 2021-10-22T17:02:51.677Z true ( Lampen Beneden Aan )
Switch Lampen Keuken 2021-10-22T23:46:34.780Z false ( Lampen Beneden Uit )
Switch Lampen Keuken 2021-10-23T16:49:06.216Z true ( Lampen Beneden Aan )
Lampen Beneden 2021-10-10T23:54:03.740Z false ( Lampen Beneden Uit )
Lampen Beneden 2021-10-10T23:54:03.740Z false ( Lampen Beneden Uit )
Lampen Beneden 2021-10-11T05:24:40.159Z true ( deCONZ )
Lampen Beneden 2021-10-11T06:36:09.768Z false ( deCONZ )
Lampen Beneden 2021-10-11T06:36:13.347Z true ( deCONZ )
Lampen Beneden 2021-10-11T08:54:50.812Z false ( < group > )
Lampen Beneden 2021-10-11T15:57:59.171Z true ( deCONZ )
Lampen Beneden 2021-10-11T23:13:42.747Z false ( Lampen Beneden Uit )

Grouped by device, sorted by date/time (‘zulu’ time) and it gives you the name of the app or flow that changed the state (true which is on or false which is off)

For @DGalama this still isn’t a solution, as it still isn’t in CSV format. Maybe a feature request to the developer of Archive Insights App for Homey | Homey (@Gruijter) may help, he might be willing to include the onoff capability in the export features of Archive Insights


That’s great @Le_Cactus !! Thanks!


This way it’s output is returned in .csv format @DGalama :
console.log('"' + + '"' + ',',value.t + ',',value.v + ',','"' + value.originName + '"')

Copy the output and “paste Special” it into an spreadsheet tool.
Mostly the default separator = , and string delimiter = "

Next, how to retreive the local time instead of zulu time :wink: :wink:

1 Like

Wow, this looks great, thanks!

1 Like