train-station-indicator

I have two indicators.
I wanted them to display at different times.
Mostly because you only 1000 api calls to the database free of charge every day.
All other parameters are the same

So I went into variables and set the global device variable
transportApi_operatingHours to 9-19

on the second Rpi Zero I used the device overide to 6-10

Now the second RPI is correct with the display. But the first is blank completely.
I have set the global environment variable
departureStation to my local 3 digit code station name. ( 100% correctly)

What is this error ‘departures’ environment variable i am getting below - what has that got to do with it?
Is this a bug?

Error: Please ensure the ‘departures’ environment variable is set
26.01.21 15:19:14 (+0000) Service exited ‘main sha256:76f7278ba82e22755ca767d581bb8b16a3c0d34d914e7e782ba6b26f3ca493e5’
26.01.21 15:19:21 (+0000) Restarting service ‘main sha256:76f7278ba82e22755ca767d581bb8b16a3c0d34d914e7e782ba6b26f3ca493e5’
26.01.21 15:19:10 (+0000) main Error: Please ensure the ‘departures’ environment variable is set
26.01.21 15:19:28 (+0000) main Error: Please ensure the ‘departures’ environment variable is set
26.01.21 15:19:33 (+0000) Service exited ‘main sha256:76f7278ba82e22755ca767d581bb8b16a3c0d34d914e7e782ba6b26f3ca493e5’

Hey @norskman

Could you perhaps share a screenshot of the environment variables you set up?

It is weird that one of the device works and the other throws that error.

Thanks

I have worked out the problem.
It has nothing to do with the code.

When the number of API hits reaches the limit of 1000 per day. The RPI will not show anything on the screen AT ALL.

This is independent of the time settings variable.

many thanks

Hey Jack,

When you say " independent of the time settings variable" which variable do you mean? I can see that there is a refreshTime config setting, which is defaulted to updating once every 3 minutes. Each refresh causes two API calls, which means a screen running all day would cause 960 calls. Pretty close to the limit. More than one device running on the same API key, clearly will go over the limit.

Two counter this, I think your options are:

  1. put each device on a separate API key
  2. increase the refresh interval to 6 minutes
  3. alter the operatingHours config element, so that your signs are not updating when you are not using them.

Phil

yes, I have done exactly what you just said.
I also noted the 2 api calls requirement.
That fixed it. so thats for confirming this point.

Also noting: That if you go over the 1000 api calls per day - irrespective of the time variable ‘operating hours’ the display will blank. That caused me a lot of headaches.
I finally worked it out, as the next day it worked without touching the display or re-powering. So I guessed it had something to do with the limit being reached.

My other concern was the error reported as
Error: Please ensure the ‘departures’ environment variable is set

Well there is no named ‘departures’ global environment - so I was trying to fathom out what it meant.
worse, I did have my ‘departurestation’ environment variable setup correctly. I never figured that one out. But I do have two working now.

Hi Jack,

You could add an issue to the project’s repo for a better error message to be displayed on the screen maybe: https://github.com/balenalabs/uk-train-departure-display
Or PRing a fix into the repo would be even better. :wink:

Phil

As an interim fix, perhaps the OP should look at how often the devices update. Using the examples given both indicators used for the times specified are only running for a total of 14 hours.

If both were updating once every 60 seconds that is only 840 calls to the API for both units together each day, well within the 1000 limit. It may then be the case that only one indicator is required after all.