Adding sensors from console

73 views
Skip to first unread message

rog...@yahoo.es

unread,
Apr 29, 2021, 7:56:45 AM4/29/21
to Sentilo
Hi,
I remember when using Sentilo for first time, I added sensors from console. I could find documentation releted on that point.

After that, we have changed to a new server, we have upgraded to new Sentilo versions, we have added and deleted sensors...

Today I was trying to add several new sensors to Sentilo. As I remembered, I have sent a POST request to <myurl:8081/catalog/provider> with a JSON file and with catalog token as IDENTITY_KEY in header. As usual.

But, today, received response has been "Invalid Credential".

I suspect I could change default catalog token for security reason, but maybe I did not put the same everywhere. Is it possible? Should Sentilo run with this wrong configuration?

Or, where should I get propertly token to add sensors to catalog (I can access to source, to property files, to mongodb, to sentilo-catalog-web...)?

Thanks in advance,

Roger

Sentilo IO

unread,
Apr 30, 2021, 5:04:22 AM4/30/21
to Sentilo
Hi Roger,

It should work using the catalog token but, as you say,  maybe it's not the best option for security reasons. Anyway maybe the problem is related with the URL you're using (catalog/provider), this "provider" should be created before the request.
The best approach instead using the catalog token is to create a specific "provider" using the Catalog console and use it's own token to create the sensors.
Hope it helps ;)

Regards,

rog...@yahoo.es

unread,
May 3, 2021, 6:36:44 AM5/3/21
to Sentilo
Hi,

Thanks for your response...
This is exactly the way I used. Provider and component were already created in catalog-web-console.

Never mind, it has been solved, but I think you have a bug there. Let me explain:

I was looking for some differences between what I saw in catalog-web-console and as responses of http request from Postman (http:<url:port>/catalog with catalog token)...
First, I check new provider and components were not listed if no sensor was created yet.
After that, I create the first sensor for this provider (also was first sensor for this component, obviously) using catalog-web-console.
Then I already got provider, component and sensor from Postman request.
Finally I could send http POST request with definition of 27 sensors successfully.

It seams that sensor definition using http requests with Postman (or curl) will work just in case other sensors of this provider have already been created before.

I hope it helps.
Regards,
Roger

El dia divendres, 30 d’abril de 2021 a les 11:04:22 UTC+2, io.se...@gmail.com va escriure:

Sentilo IO

unread,
May 6, 2021, 3:38:32 AM5/6/21
to Sentilo
Hi Roger,

The current behavior is as you said, if you have only created providers or components without sensors there wont' be a JSON body in the response.
We're not fully agreed that this is a bug, because the response definition sets sensors as mandatory, so it's coherent. Anyway we'll keep in mind for further releases.

Thanks !
Sentilo Team

rog...@yahoo.es

unread,
May 28, 2021, 4:23:06 AM5/28/21
to Sentilo
Thanks,
But may be something lost in translation...
I think there is a bug because no sensors are created (using http request with curl o Postman) when component was empty, and they were fully created after creating the first one "manually".
I'm not talking about console responses of HTTP request, I'm talking about effects of my request (creation of sensors).
I think I could create first sensor of a provider (or component) also using a curl or Postman HTTP request. Isn't it?
Probably my explanation was confuse


El dia dijous, 6 de maig de 2021 a les 9:38:32 UTC+2, io.se...@gmail.com va escriure:

Sentilo IO

unread,
May 31, 2021, 4:37:54 AM5/31/21
to Sentilo
Yes, maybe something is missing, but hard to tell where is the problem.
If you want, sent us the steps you follow one by one and we'll try to reproduce it.

Regards,


rog...@yahoo.es

unread,
May 31, 2021, 5:08:23 AM5/31/21
to Sentilo
Thanks again,
You should try to follow these two steps:
1. Create provider and component using web catalog page.
2. Send HTTP request using curl or Postman to catalog in order to add a sensor to this component.
I hope it helps!!

If it doesn't work, then, you can try to create first sensor using web catalog page, and then send the HTTP request (but with different sensor name, of course).
El dia dilluns, 31 de maig de 2021 a les 10:37:54 UTC+2, io.se...@gmail.com va escriure:

Sentilo IO

unread,
Jun 3, 2021, 5:58:48 AM6/3/21
to Sentilo
Hi Roger,

When you add the sensors through the console, there is a small delay for the synchronization between the catalog db and the real time db.
If you're invoking the API inmediately you're working with the real time db and maybe the elements haven't been syncronized.
Maybe the issues you reported are related with this matter.

Regards,

rog...@yahoo.es

unread,
Jun 3, 2021, 6:06:18 AM6/3/21
to Sentilo
Hi,
No, it isn't. Provider and components were created several days before. And I was trying to create sensors more than once and different days.
Sorry.
Have you tried to follow the steps as described above?
Thanks,

El dia dijous, 3 de juny de 2021 a les 11:58:48 UTC+2, io.se...@gmail.com va escriure:
Message has been deleted

Sentilo IO

unread,
Jun 8, 2021, 10:54:52 AM6/8/21
to Sentilo
Hi Roger,

We've executed the test and it works fine for us.
Maybe there is something different in the context...

1. First, create the provider:
step1.png
2. Then create the component using the catalog console:
step2.png
3. Configure the client, in this case, we're going to test the API with Postman:
step3.png
4. Send the request to the API, it returned a succesful response:
step4.png
5. Verify that the sensor is accessible from the catalog:
step5.png

Regards, 
Sentilo Team.
Reply all
Reply to author
Forward
0 new messages