Hubitat logs API

Is there an API for Hubitat logs that emits events in a form meant for machine consumption vs display?

I see that I can request past logs from /logs/past/json but the result looks like ["2023-01-17 13:24:08.369\tINFO \tapp|354|L1 hall motion dim <span style='color:red'>Restricted</span>|evt: 1F main hall motion sensor motion active --> restricted" whereas I’m looking for data with a schema or in some kind of structure that doesn’t require parsing. An example might be:

{"timestamp": "2023-01-17 13:24:08.369", "logLevel": "INFO", "source": "application", "sourceId": "354", "sourceDescription": "L1 hall motion dim <span style='color:red'>Restricted</span>", "eventDescription: "1F main hall motion sensor motion active --> restricted"}

Thanks!

1 Like

If you want discrete events for devices, Maker API may work for you. You can poll it via HTTP or have it push events to you.

2 Likes

What is your goal?

I ask because there are two undocumented websocket connections to the hub that are available. I'm not at home (so I cannot check), but I'm pretty sure They send out JSON formatted events. And should be easier on the hub than using MakerAPI vis-a-vis processor use.

Anyway, you can access them at:

ws://your.hubitat.ip/eventsocket
and
ws://your.hubitat.ip/logsocket

3 Likes

I use this to grab logs via Node-RED and write them to a database. Works really well.

2 Likes

Download the Hubitat app