[APP][PRO] Audit

Hi Jamie,
Great improvements!

App v1.0.13 and restarted several times:
I see level [Alert] still being active for alarm capabilities, instead of level [Warning]

{
    "context": {
        "runtime": {
            "column": 28,
            "file": "../../../../../../lib/watcher/capability.js",
            "function": "trigger",
            "line": 57,
            "method": "trigger",
            "type": "Capability"
        },
        "system": {
            "main_file": "/opt/homey-client/system/manager/ManagerApps/AppProcess/bootstrap.js",
            "pid": 17965
        }
    },
    "detail": {
        "code": "alarm_motion.binary_sensor.cam_tuin_motion_detection",
        "device": "Cam Tuin",
        "driver": "homey:app:io.home-assistant.community:camera",
        "owner": "",
        "type": "alarm",
        "value": "true",
        "zone": "[0b] Algemeen"
    },
    "dt": "2024-07-04T14:29:11.656Z",
    "level": "alert",
    "message": "Cam Tuin ",
    "meta": {
        "action": "update",
        "entity": "capability",
        "fields": [
            "alarm_motion.binary_sensor.cam_tuin_motion_detection"
        ],
        "id": "7231862b-b20e-463b-8be7-d2e0f1e00237",
        "name": "Motion detection",
        "reason": "alarm_motion.binary_sensor.cam_tuin_motion_detection",
        "timestamp": 1720103351547
    }
}

And Audit app alerts:

{
    "context": {
        "runtime": {
            "column": 28,
            "file": "../../../../../../node_modules/@logtail/winston/dist/cjs/winston.js",
            "function": "log",
            "line": 36,
            "method": "log",
            "type": "LogtailTransport"
        },
        "system": {
            "main_file": "/opt/homey-client/system/manager/ManagerApps/AppProcess/bootstrap.js",
            "pid": 17965
        }
    },
    "dt": "2024-07-04T14:20:05.355Z",
    "level": "alert",
    "message": "BetterStack is connected"
}

.

{
    "context": {
        "runtime": {
            "column": 28,
            "file": "../../../../../../node_modules/@logtail/winston/dist/cjs/winston.js",
            "function": "log",
            "line": 36,
            "method": "log",
            "type": "LogtailTransport"
        },
        "system": {
            "main_file": "/opt/homey-client/system/manager/ManagerApps/AppProcess/bootstrap.js",
            "pid": 17771
        }
    },
    "dt": "2024-07-04T14:19:33.656Z",
    "level": "alert",
    "message": "The weather polling has been disabled"
}

.
Btw any idea why the weather polling gets disabled by default?

Hmm tricky one, because its just given the device a ‘alarm’ rather then saying what type of alarm it is.

Weather is disabled by default, because Athom did a really poor job of it and its rate limiting - it even caused their outage a couple months back. I disabled it until they fixed the problem and I could test. Ill reenable it tomorrow so we can see if they really did fix it :

1 Like

I notice
"code": "alarm_motion. ....
as well as
"type": "alarm".
It’s from a HA community app device, maybe dev RonnyW can explain why it’s type is alarm and not alarm.motion?
No biggie btw :blush: :wink:

.

Ah I see, I was just curious about the notification
But getting the weather updates would be a nice addition to the app.
Thanx!

Audit 1.0.13 with level notice produced:

04.07.2024, 21:03:00,541] alert: Audit Log has been initialized
[04.07.2024, 21:12:07,821] notice: Wetter Ffm morgen Wetterdatum updated from 20:12 05.07.2024 to 21:12 05.07.2024
[04.07.2024, 21:17:10,700] notice: Nous P1 Eingeschaltet
[04.07.2024, 21:17:19,738] notice: Nous P1 Ausgeschaltet
[04.07.2024, 21:17:43,680] warning: Aqara doorS1 Kontakt-Alarm ist angegangen
[04.07.2024, 21:17:43,699] notice: WaschkĂŒche has became active
[04.07.2024, 21:17:43,715] notice: 0. Keller has became active
[04.07.2024, 21:17:43,727] notice: Heim has became active
[04.07.2024, 21:17:47,134] warning: Aqara doorS1 Kontakt-Alarm ist ausgegangen
[04.07.2024, 21:17:47,146] notice: WaschkĂŒche has became inactive
[04.07.2024, 21:17:47,155] notice: 0. Keller has became inactive
[04.07.2024, 21:17:47,162] notice: Heim has became inactive
[04.07.2024, 21:17:59,224] alert: DoorS_6o Sabotage-Alarm ist angegangen
[04.07.2024, 21:18:29,251] alert: DoorS_6o Sabotage-Alarm ist ausgegangen
[04.07.2024, 21:19:18,651] notice: Wetter Ffm Vorhersagezeit updated from 04.07.2024 20:59 to 04.07.2024 21:19
[04.07.2024, 21:19:18,673] notice: Wetter Ffm Bezeichnung updated from MĂ€ĂŸig bewölkt to Klarer Himmel
[04.07.2024, 21:19:18,721] notice: Wetter Ffm has been updated
[04.07.2024, 21:19:18,822] notice: Wetter Ffm Wetterlage updated from Clouds to Clear
[04.07.2024, 21:19:18,826] notice: Wetter Ffm Spezifische Wetterlage updated from 802 to 800
[04.07.2024, 21:19:18,841] notice: Wetter Ffm Wetterlage Bezeichnung updated from Bewölkt to Klar

To be frank the weather information I‘d prefer under label info. They are from the Open-meteo weather App. The open weather App is handelt alike.

Got reply from Bstack support, the pw can be set in account settings > security :crazy_face:

I’m happy to have a look at that, if you can supply the log message json either from Betterstack or your detailed log. I only speak English so I need that other information to understand the item and why it was classified as it was.

So the audit app currently relies heavily on developers utilising the inbuilt capabilities. Ie it checks th reason for “alarm_contact” and if that fails it then looks at the “type” in this case it (correctly) pick up alarm. BUT the reason for you it “alarm_contactblahnlah” - I’ll add some fuzzy logic for you which should solve it.

New version of the app,

  • Weather has been enabled, currently capped to check once every 15 minutes.
  • @Peter_Kawa your (and everyone elses) alarm (and similar) issues should now be solved.
  • Stability Fixes

Sorry for the frequent updates, I would prefer if there was a way to have a beta to iron out these things 
 but there is not, there are two errors I am still seeing one of them looks to be an issue on Homey the other is running out of hard drive space, I may have to limit the detail logs to 24 hours only and maybe 3 days for message logs - with sanity checks on the files.

3 Likes

Hi Jamie, at around 10:45UTC, I just sent a diag report from my daily driver Homey, mentioning logging to Bstack still worked, but I was wrong there: it didn’t.
App memory use is above 50MB’s, which is pretty high for Pro 2019.

The app at my test-Homey Pro 2019 doesn’t crash, app settings are mirrored from the main Homey.
The app uses around 25MB’s on this one.

Thx.

I’ve noticed the log rotating is performed at midnight UTC, Jamie.
I think it should rotate at midnight local time? Here it’s UTC+2

Sorry I don’t think that’s going to be easy, all the dates are in utc, I’m just overwriting the date of the logs to be based on the homey Timezone.

No problem. Although it’s mentioned in the logs, I think maybe it’s a good idea to mention this somewhere in the manual/howto?

2 Likes

@Jamie also be aware of “daylight saving” if you choose to do actions around 01:00~03:00 at these days things might be messed up (run twice or not at all)

I’m a bit worried that files in utc and logs in local time is a little confusing as things won’t be where your expecting and your log file will be rotated and zipped up potentially half way through the day - I might look at reverting this feature.

I hope you can make it user selectable, if possible at all.
Something like:


Show timestamps in UTC instead of local time :ballot_box_with_check:
(Note: logs always rotate @ 0:00 UTC)


Digging through logs with UTC timestamps is not my most fav thing to do.
But it’s your app and your time of course.

Still, it’s quite absurd it can be so hard to use local time in general in Homey app code

Your post didnt show the examples?

To be fair the issue with the time stuff isn’t Homey’s fault - its the library i’m using to rotate and manage the files.

I am trying to think of a good way (in all my apps) to have more advance features available but not immediately accessible - (think power experiments). If you know of an app that manages this well - let me know.

Sorry, is the example visible now in my prev post?



About local time stuff, I just read about others struggling with it, after Athom made UTC time the default instead of local time.


I get it. Now only the ‘Maintenance > Try to repair’ section pops up, as you already use in < group > app.



A thingy about the weather updates (no biggie):
It seems to be logged, and triggers the ‘weather changed’ flowcard when the weather got updated instead of changed, resulting in identical logs, and flow output. We can’t react on weather changes now.

Not sure if it’s intentional or not possible to catch a changed event.
Xmpl:

Thx!

Yep, weather has three bugs I’ve seen

  1. it does an init to get the weather then followed shortly by a normal request (rather then waiting 5 min)
  2. when the temp and other values change rather then just showing the item which is changed all values are sent (though it seems to work for pressure sometimes)
  3. it sends the notice on update rather then on change

I’ll fix them when I next do an update, let me j ow if you come across anything else.

If you want better weather support comment here on this request to Athom (which in typical fashion the have just ignored)

2 Likes

Please note however that the issue is marked as Closed by Herman, not sure they even read comments on closed issues at all :frowning:

They should?
Hmmm I might drive to Enschede when we’re ignored! :motorcycle: :grimacing:

2 Likes

Latest version includes fixes for the weather auditing and updates the audit level of device auditing, specificaly device warning messages and device unavailable messages.

Note that I will be updating the flow action cards, then going to start focusing back on version 2 of this app and/or other new apps on my todo list.

3 Likes