Simple LOG app - Former main topic [Deprecated]

I haven’t made any changes for quite some time. I need to test this myself, for now I’m clueless

Hi Niels,

Great app which I am currently exploring.

I am logging temperature data and when I look at the raw data in the Homey developers tool, all data seems fine. When I export it via CSV I get a time shift of About 2.5 Hours?

Is there somewhere a setting which could cause this? Any idea?

Thanks in advance, Jan

Time is in zulu. https://greenwichmeantime.com/info/history/zulu

Hi Niels,

That explains. Thanks for the quick respons.

Jan

Hi @Niels I’m having the same problem. CSV download at developer.athom.com/tools/app-settings gives the message as @JPe4619.

Would it be possible to access the CSV through e.g. the Web API Playground or have it email to an email address from a flow?

You can not download them from within the App. It’s something with the app that doesn’t allow this. From the website https://developer.athom.com/tools/app-settings you should be able do download the log file.

I have some ideas i want to either incorporate into this app or build something entirely new. That could help a bunch but don’t expect anything soon. Sorry.

1 Like

Hi Niels,

I’m trying to download it from the website and that doesn’t work. It displays the CSV content but there is no download…

No need to be sorry.

In my case this works without problems (v2.4.1).

What OS and browser versions are you using to download? I suspect it’s due to either a setting or a specific to a os or browser. Maybe i can find a workaround.

Something I forgot to mention. You could use the API endpoint /api/app/nl.nielsdeklerk.log
More info on this can be found at the AppStore,app information of my app.

@Niels, It took some time to get a few things tested.

  • OS is Windows.
  • Browser is Chrome 64-bit v84 (latest).
  • Tested on Edge, same problem.
  • Tested on FireFox 64-bit v79 (latest) and there it does gives the download pop-up.

Did have a look at the console log in Chrome and this is the error:
Download is disallowed. The frame initiating or instantiating the download is sandboxed, but the flag ‘allow-downloads’ is not set. See https://www.chromestatus.com/feature/5706745674465280 for more details.

After reading the documentation at Chrome, it appears to be a change initiated as of v83. I expect this to be introduced in the near future in FireFox as well.

1 Like

It makes total sense that chrome is doing this. Others are sure to follow up. The java code generating the CSV is running on your homey and is both sandboxed and proxied. I doubt Athom wil set the allow-download header. Ill look into alternatives. For now thats the current API. Is that something you can work with?

Yes and No…

I’m using the log to monitor the execution of my flows. Have many and together they are complex (flows kicking of flows, conditions based on device values, variables, time, presence etc.). It seems that Homey is dropping some commands every now and then. The log gives me the insights to tune and fix.

That means I’m on the end-user side. As such I have no experience with the API and hence the ‘No’.
If I would dive into it, I probably will be able to use it as I have a technical background. Hence the ‘Yes’.

For now using the CSV dump through copy and paste takes the least of my time.
Maybe someday I start figuring out how to do a web call from a flow and have the response email to me… if at all possible.

Thanks anyway!

I am still using the app and it works here flawless. Every five minutes I am logging the temperature output of 8 temperature sensors which are spread throughout my WTW-unit and the locations where I really want to control the temperature. Exporting of the CSV-file (as *.pdf) and then put the data in Excel. In the meantime I was able to ‘tweak’ the parameters and variables of my WTW-unit, which would have been impossible without this app. Thanks again!

1 Like

Hello,
firstly, amazing app. Exactly what I need to collect data for a room which will be in a different country than me.
I am trying request the API in Python with url “https://MY-BEARER-TOKEN.connect.athom.com/api/app/nl.nielsdeklerk.log”. This is not working because the bearer ID has columns in it which failes to be parsed. I have tried different sections of the bearer token as suggested in comments but I only get ‘{“error”:“mesh_node_offline”}’. The bearer token was collected seconds before the attempt. If i use Client-ID instead of Bearer token I get “You need to log in to access this resource”.

At this point i have realized that I am obviously doing something wrong. I have tried to read up on the community forum and it made me unsure if I need to learn how to write json-script in a compiler or do something with Homey Playground to be able to access a GET API-link that will work for my homey.

What is the simplest way to access my Simple LOG GET API for novice python programmer with no experience with java or json-scripts?

1 Like

@Theodorska thank you for your support.

I wasn’t sure how i once got it working myself so i thought to do some tests and i realized a lot has changed and not all for the better :slight_smile: I’ll race you through how it works.

First of, all the current simple log API’s turned out to be broken :see_no_evil:
I build a fix that will be published as soon as it’s accepted. but you could use this version here for testing: https://homey.app/a/nl.nielsdeklerk.log/test/

I think that getting a bearer token (to authenticate the API calls) is badly documented by athom. but luckily i found help here: https://homey.solweb.no/advanced-api-usage/bearertoken#the-homeyscript So cudo’s to him. You’ll need the homeyscript app installed on homey and add the documented script in the homeyscript interface (https://homeyscript.homey.app/) it will get you a new bearer token generated through homey. there are other ways you could use, but found this method to work best.

so how to use the API.

send a http GET to “http://[Your homey IP]/api/app/nl.nielsdeklerk.log” and add a HTTP header named “authorization” with the token formated like “Bearer ce0c0ec0e0ce0ce0ce0ce0”

sending a https:// is obviously prefered but for testing http has some benefits.
you can also use the cloud endpoint:
https://[cloudid].connect.athom.com/api/app/nl.nielsdeklerk.log/

Hope this helps.

2 Likes

Hi!

Since the last update my log entries in the timeline are also showing the Log Group name. I prefer the old way where the simple log logs show the group name but the timeline only shows the entry. Is this something that is by design now?

Before the latest simple log update the time line looked like this;

And after;

Hope this is something that can be reverted

Guess I never pushed that update in the meantime. :grimacing:

I’ll make a new card for it. Or add a checkbox if possible to the existing cards

1 Like

Good morning,
I’m seeing a lot of questions regarding the log file and timezone settings. I did build a little python script that collects the log over the local API and prints the results. just sharing so others can benefit.
Kind regards, Frans

import requests, json, datetime
from dateutil import parser
#setting homey_id and url for API via variables
homey_id=“homey-[code]” #put you homey_id here “homey-[key]”
api_url=“api/app/nl.nielsdeklerk.log/” #standard url for Niels de Klerk’s great app
r = requests.get(“http://”+homey_id+“/”+api_url) #GET request for log file over API
#print banner
print (“---------------------------------------------------------------------”)
print (“- Homey simple log viewer over API -”)
print (“---------------------------------------------------------------------”)
log = json.loads(r.text) #put json resulst into log variable
#reverse loop through log file and print table
for key in reversed(log):
dt = parser.parse(key[“date”]) #parse date field from log file.
dt = datetime.datetime.astimezone(dt) #adjust timezone to local time offset.
print(dt.strftime(‘%d.%m.%Y’) + " " + dt.strftime(‘%H:%M:%S’) + “\t” + key[“data”]) #print log data without group names
#uncomment below line if you want also groups to be displayed
#print(dt.strftime(‘%d.%m.%Y’) + " " + dt.strftime(‘%H:%M:%S’) + “\t” + key[“data”] + “\t[ " + key[“group”] + " ]”)
#print some debug/response time lines
print (“\r”)
print ("api status code : " + str(r.status_code))
print ("api response time : " + str(r.elapsed.total_seconds()) + “s”)
print (“program exit : 200”)

2 Likes

Great app, but I was missing some functionality.
Like a readable overview, restrictions etc so I build something in PHP
Hadn’t seen @Frans_Wittenberg work yet, but its nice to have options :slight_smile:

Put the below in a file on a php capable server like a NAS or Raspberry Pi also set homey’s IP address, it would be good if this is a fixed address…

2 Likes