Balena Locating Project question

Hi, I’m new to the BALENA environment.
I set up the BalenaLocating project with 2 Raspberries and some beacons and it works perfectly.
I have some newbie queries:
Can I access the source code of the application that is installed on the raspberry?
is there a guide to writing those kinds of applications?
Is it possible to modify the BalenaDashboard interface where the beacons found appear? For example, translate it into Spanish, or add search options

Best Regards

Hey Juan,

Thanks for the feedback on the project. :slight_smile:

The source code is here: GitHub - phil-d-wilson/balena-locating: Never lose something important to you again by using Bluetooth Low Energy (BLE) beacons and Raspberry Pi sensors to track your stuff.
You are free to fork the project and make any changes you want. The service which finds the bluetooth beacons is written in node.js and the dashboard is written in Blazor.net which is part of the .NET developer platform.

balena don’t have any guides on writing applications per se, but we do have a series of “Getting Started” guides where you can choose your device type and language: Get started with Raspberry Pi 3 and Node.js - Balena Documentation

Phil

Hey Phil

Thank you very much for your answer.
I am new to blazor and would like to bother you with a new question.
I managed to launch the "hello world" application of Blazor:

 1.- dotnet new blazorwasm -o BlazorDemoSPA
2.- cd BlazorDemoSPA
3.- dotnet build
4.- dotnet run

My query is how to do the same with your Dashboard application, that is, download it from GitHub and run it locally.
I downloaded it, then go into the Dashboard directory, but when running dotnet build
and dotnet run (I guess it's stupid to do it like this but I can't think of any other way, sorry) I have screen errors.
 (Thanks for having read this far) my query is how to run the dashboard on my local disk, thank you in advance

Best regards

Juan Carlos Ramirez

Hey there Juan,

I just cloned a fresh copy of the repo and did the following:

  phil- root 2021-07-13 15:08:40  C:/Source/Sandbox/balena-locating/dashboard V2  ﲍ 
➜ $Env:RUN_DASHBOARD="true"
  phil- root 2021-07-13 15:08:44  C:/Source/Sandbox/balena-locating/dashboard V2  ﲍ 
➜ dotnet run
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: C:\Source\Sandbox\balena-locating\dashboard

as you can see the dashboard ran fine. Can you tell me the errors you found?

Phil

Phil:
Thank you very much for your help
Initially it did not work for me due to the version of Microsoft .net core that was installed 
on my computer, when I ran the dashboard it indicated that it could not find version 3.1, 
my way to solve it was to uninstall version 5.0 and install version 3.1. 
Done the above, I modified the $ Env parameter: RUN_DASHBOARD = "true" and after that I modified 
the beacons.cs file and manually entered the values that correspond to me
 :
var influxHost = "[https://eu-central-1-1.aws.cloud2.influxdata.com](https://eu-central-1-1.aws.cloud2.influxdata.com)";
var influxKey = "5qYSOXFj_KsKzVP4MwoaWCLAHuGxzyilsaUh7lLKlfYjNFEy1-_........";
_influxOrg = "eb99f2c59f954723";
_influxBucket = "balenaLocating";

The dashboard loads with a warning (image attached) and when looking for the information 
of the beacons, in the instruction

 var queryApi = _influxDBClient.GetQueryApi ();
 tables = await queryApi.QueryAsync (flux, _influxOrg);

the exception is thrown

Influx exception: System.Net.WebException: The SSL connection could not be established
lished, see inner exception. Authentication failed, see inner exception.
 ---> System.Net.Http.HttpRequestException: The SSL connection could not be this
blished, see inner exception.
 ---> System.Security.Authentication.AuthenticationException: Authentication fai
led, see inner exception.
 ---> System.ComponentModel.Win32Exception (0x80090326): Unexpected message received
rado, or its format is incorrect.
   --- End of inner exception stack trace ---

Best Regards


Hey,

It looks like your influx host URL isn’t formatted correctly. You have a markdown string. It needs to just be “https://eu-central-1-1.aws.cloud2.influxdata.com”.

Also, you should edit your message and remove the key. You should also look to change that key on Influx cloud. This is a public forum and other people could now use your account.

Phil

Hi Juan,

Are you up and running now? :slight_smile:

Phil

Hi Phil!!

Thanks for your interest.
Actually the url, is formatted correctly in the program, it seems that there was a typing error when posting it in the forum,
 (and the key was false, thanks for the warning), I have continued testing and looking for information it seems that 
in some situations (depending on the version of the windows operating system) an error occurs in the handshake 
between the windows machine and the Influxdb server when trying to establish the https connection, 
in my case, this error occurs in Blazor, when I use node-red ( from the same windows machine) the Influxdb node works 
and I can read the data from the bucket using the query taken from the dashboard. 
Thank you very much for your help !!! 
Greetings

Hey,

Have you moved away from the blazor implementation to node-red, or was that just to test? If you are still trying to get the blazor client to work, then I’m happy to help.

I am using the same influxdb URL as you, and I’m running windows, so I’m not quite sure why it works for me but not you. :thinking:

Hey, 
Installing it in node-red was only for testing, what I plan to do is show the solution to some clients to track their assets, 
and that is why I need to customize the dashboard, (the balena platform is ideal since I can control the raspberry update them etc), 
what version of windows are you using? Thank you very much and greetings!!
Hey
Change to a fresh installation of windows and now if it is working! 
Thank you very much for your help!

Regards

JCRC


Hey Phil

One question, balenalocating is a Blazor server-side or web assembly app?

Regards

Juan

Hey Phil!!

Thank you very much for your help, now it is working fine, it seems to me that it was a very old version of windows and that caused the problem.
Do you intend to publish the project you mention on YouTube that incorporates the K-Nearest Neighbor algorithm?
I’m trying to advance on that, so any advice will be welcome !!

Hey there @jcramirez404 !

You can find the algorithm I hacked together a few years ago here and I’m resurrecting the project and keeping a build log here.

balenalocating is a Blazor server-side or web assembly app?

balenaLocating is server-side blazor, due to some limitations with the WASM support when I made the application. Good reminder for me to re-visit WASM and blazor though! :slight_smile:

Phil

Hi Phil!

Thanks for your answer.
I am trying to understand your idea.
What I would have tried to do is have a central server and a database, the central server would have different operating states:
state 1 receiving information from the beacon scanners from the Raspberry and recording that information in the database.
state 2 generating fingerprinting, in this state it is receiving information from a single beacon which is moving between the points of the grid
state 3 positioning in which the server receives the information from the raspberry and applies the knn algorithm within the grid points to position the beacon.
In the model that you indicate based on DAPR sidecar, the calculation of the positions is done by each Actor Model?

Best Regards

Juan Ramírez

Hey @jcramirez404

Thanks for the interest. Yeah the actor framework will be used to get the “fingerprint” of the received BLE signal strength from each sensor, and it will plug that into the ML model and guess the BLE device’s position.

Let’s continue this on my build log, I appreciate your ideas and questions. :slight_smile:

Phil

I am trying BalenaCloud for first time. I installed the os in a Raspbeery Pi 3 model B, everything right but after the device is added to my Balena Fleet, the beaconService is showing this error.

Logs
05.10.22 13:53:27 (-0400) beaconService npm ERR! code ELIFECYCLE
05.10.22 13:53:27 (-0400) beaconService npm ERR! errno 1
05.10.22 13:53:27 (-0400) beaconService npm ERR! @ start: node server.js
05.10.22 13:53:27 (-0400) beaconService npm ERR! Exit status 1
05.10.22 13:53:27 (-0400) beaconService npm ERR!
05.10.22 13:53:27 (-0400) beaconService npm ERR! Failed at the @ start script.
05.10.22 13:53:27 (-0400) beaconService npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
05.10.22 13:53:27 (-0400) beaconService
05.10.22 13:53:27 (-0400) beaconService npm ERR! A complete log of this run can be found in:
05.10.22 13:53:27 (-0400) beaconService npm ERR! /root/.npm/_logs/2022-10-05T17_53_27_626Z-debug.log
05.10.22 13:53:28 (-0400) Service exited ‘beaconService sha256:875648b37d93b676f6b4f63a6dfbda5a0ae9e5cbe07e06b269924e6f13bfee0c’
05.10.22 13:53:28 (-0400) beaconService
05.10.22 13:54:29 (-0400) Restarting service ‘beaconService sha256:875648b37d93b676f6b4f63a6dfbda5a0ae9e5cbe07e06b269924e6f13bfee0c’
05.10.22 13:54:30 (-0400) beaconService
05.10.22 13:54:30 (-0400) beaconService > @ start /app
05.10.22 13:54:30 (-0400) beaconService > node server.js
05.10.22 13:54:30 (-0400) beaconService
05.10.22 13:54:31 (-0400) beaconService Started to scan.
05.10.22 13:54:32 (-0400) beaconService Beacon: beacon,device=068d563d4822d3157f1c130571709533,deviceName=dreary-moon,tag=FDA50693-A4E2-4FB1-AFCF-C6EB07647825-5-6 rssi=-30
05.10.22 13:54:34 (-0400) beaconService
05.10.22 13:54:34 (-0400) beaconService ð
05.10.22 13:54:34 (-0400) beaconService 405 Not Allowed
05.10.22 13:54:34 (-0400) beaconService
05.10.22 13:54:34 (-0400) beaconService

405 Not Allowed


05.10.22 13:54:34 (-0400) beaconService
nginx/1.22.0
05.10.22 13:54:34 (-0400) beaconService
05.10.22 13:54:34 (-0400) beaconService
05.10.22 13:54:34 (-0400) beaconService
05.10.22 13:54:34 (-0400) beaconService at Influxdb._fetch (/app/node_modules/influxdb-v2/src/index.js:49:13)
05.10.22 13:54:34 (-0400) beaconService at processTicksAndRejections (internal/process/task_queues.js:97:5)
05.10.22 13:54:34 (-0400) beaconService at async Influxdb.write (/app/node_modules/influxdb-v2/src/index.js:120:12)
05.10.22 13:54:34 (-0400) beaconService at async /app/server.js:111:5
05.10.22 13:54:34 (-0400) beaconService npm ERR! code ELIFECYCLE
05.10.22 13:54:34 (-0400) beaconService npm ERR! errno 1
05.10.22 13:54:34 (-0400) beaconService npm ERR! @ start: node server.js
05.10.22 13:54:34 (-0400) beaconService npm ERR! Exit status 1
05.10.22 13:54:34 (-0400) beaconService npm ERR!
05.10.22 13:54:34 (-0400) beaconService npm ERR! Failed at the @ start script.
05.10.22 13:54:34 (-0400) beaconService npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
05.10.22 13:54:34 (-0400) beaconService
05.10.22 13:54:34 (-0400) beaconService npm ERR! A complete log of this run can be found in:
05.10.22 13:54:34 (-0400) beaconService npm ERR! /root/.npm/_logs/2022-10-05T17_54_34_640Z-debug.log

Hope you can help me .