Asset change Agent Link to default

I did this process days ago but now I find myself with an error again.

This is the error that the open remote log console throws

Failed to link attribute 'AttributeRef{id='597vSfNfXMDep81HO4r23N', name='temperature'}' to protocol: HTTP Client[api.openweathermap.org/data/2.5] -- java.lang.ClassCastException: org.openremote.model.asset.agent.AgentLink$Default cannot be cast to org.openremote.agent.protocol.http.HTTPAgent$HTTPAgentLink

java.lang.RuntimeException: java.lang.IllegalArgumentException: Missing or invalid base URI attribute: HTTP Client[]

This is the json that I am passing to you following the example of the youtube video

{
 "type": "HttpClientAgentLink",
 "id": "6eKBchXJ3c7Qvxpaju1AJZ",
 "queryParameters": {
   "q": [
     "Rotterdam,nl"
   ],
   "units": [
     "metric"
   ]
 },
 "pollingMillis": 60000,
 "path": "weather",
 "valueFilters": [
   {
     "type": "jsonPath",
     "path": "$.main.temp",
     "returnFirst": true,
     "returnLast": false
   }
 ]
}

Video: Integration with OpenRemote, the 100% open source IoT platform - YouTube

When I have to insert the json in agent link it goes back to default continuously

This json is set by default:

{
  "type": "Default",
  "id": "6eKBchXJ3c7Qvxpaju1AJZ",
  "valueFilters": [
    {
      "type": "jsonPath",
      "path": "$.main.temp",
      "returnFirst": true,
      "returnLast": false
    }
  ]
}

Can anyone help? Thanks

I’m having pretty much exactly the same problem. I have managed to save the correct type" and the “id” of my HttpClientAgent in order to obtain a custom parameter through the HttpClientAgent. But 99.9% of the time “Save” button doesn’t save the changes and reverts the Agent Link to what I have managed to save so far.
The save button doesn’t activate on change either, unless I untick the “Read only” tick box and tick it back.

I have the same problem. It is very unpredictable.

I’m not managing to get anything to stick onto the Agent Link anymore. I’ve deleted the attribute and added it again etc. but nothing seems to help.

I’m not getting it to connect either, @Pekka

Can you share the error that you are throwing ati?

@alvaro.heras, it doesn’t throw any error, or is there some console view somewhere… When I click “save” (after somehow managing to enable the button), it refreshes the page view and the Agent Link window has returned to what it was before I changed it i.e. currently blank.

Update: Just to add, I’m using OR via the Manager UI in my test config and don’t have any log consoles up.

In the menu at the top right (Where the 3 dots) you have a section of logs, you can access it and see the error that is throwing you @Pekka

Thanks @alvaro.heras ! I’ve been at OR for a couple of weeks now on and off and haven’t poked around that much.
Still, it hasn’t logged any of my attempts as errors or anything else for that matter. The last one is “info” level when I deleted the Agent Link just to re-add it earlier today.

I hope it’s okay now. @Pekka

You can replicate the process of trying to bind the http agent and go to the log to see what you have done.

I would like to check if it is the same error as mine.

Thanks

Yup, I have tried to do this a number of times now. It doesn’t seem to log an error each time when trying to connect or use it. It only seems to log when creating the HttpAgentLink.

I’ve just deleted my Building Asset and the HttpClientLink and started again. The most recent error I’ve got on the log is:

Failed to start protocol instance for agent: HttpClientAgent{id='4mCbC3fBWjhebTEoxxxx00', name='Weather', type ='HttpClientAgent', parentId='6mFsxG0AOhn5KFNKQJ5our', realm='Realm'} -- java.lang.IllegalArgumentException: Missing or invalid base URI attribute: HTTP Client[]

I see the Terminal window seems to contain some log data. It seems to be the same what’s shown in the GUI too - nothing extra. I’m a bit stuck with this as I can’t continue further without getting this working.

BTW, I’ve got OR 3.0.

LS,

as we did recently few major updates in the manager it might be that we’ve introduced some problems. Can you please report which docker images are you using?

docker images --filter 'reference=openremote/manager'

Hi all,

I’ve just tried it an it works correctly when I use the type “HTTPAgentLink” as described on the wiki page: User Guide: HTTP Agent · openremote/openremote Wiki · GitHub
This wasn’t correctly updated on the HTTP weather tutorial page (shown as “HttpAgentLink”), fixed now.
Sorry for the confusion!

Does this solve your issues?

Don

Hi chaps,
To answer @michal ;
"docker images --filter ‘reference=openremote/manager’ " produces:
REPOSITORY TAG IMAGE ID CREATED SIZE
openremote/manager latest 9cf31901e10f 13 days ago 425MB

@Don
No problem. Thanks for harmonising the documentation.
However, the integration video (Integration with OpenRemote, the 100% open source IoT platform - YouTube) shows “HttpClientAgentLink” as the attribute type and the User Guide shows “HTTPAgentLink” for the same, like you said. I’ve tried both and the end result is still the same. It seems like there is something else fundamentally wrong somewhere - perhaps something in my setup somehow which is why it’s not even saving the AgentLink, regardless what’s been put in it.

The strange thing is that when I was creating the Asset for the first time, saving was working as expected. But the operation has deteriorated to such level that the “Save” doesn’t save what’s in the Agent Link anymore at all but clears the text box every time.
Does the UI Manager reject incorrect syntax and the text box gets cleared because of that? At least it is marking “spelling errors”. I’m clutching straws here.

Thank you for the suggestions and help.

KR
Pekka

Hi Pekka,

I’m not a developer so I hope I’m not clouding the discussion too much with my suggestions :slight_smile:
What I do to check the validity of the JSON in the Agent link text box is opening the browsers developer tools console to look for the JSON errors generated (when you lose focus of the text box, so click next to it). Not sure whether you already tried it, might help.

Did you recently pull the latest openremote image? That would also be a good idea.

Don

Good morning everyone @Pekka

I have managed to update the JSON with the type parameter “HTTPAgentLink” as well as indicates @Don

MY JSON:

{
  "type": "HTTPAgentLink",
  "id": "6eKBchXJ3c7Qvxpaju1AJZ",
  "valueFilters": [
    {
      "type": "jsonPath",
      "path": "$.main.temp",
      "returnFirst": true,
      "returnLast": false
    }
  ],
  "queryParameters": {
    "q": [
      "Zaragoza"
    ],
    "units": [
      "metric"
    ]
  },
  "pollingMillis": 60000,
  "path": "weather"
}

But I am currently unable to capture this data. The error has become the following and the parameters and others seem to be correct.

06/03/2021 10:24:57 WARN PROTOCOL HTTPProtocol HTTP Client [api.openweathermap.org/data/2.5]: Exception thrown whilst doing polling request [null]: api.openweathermap.org/data/2.5/weather

I’m looking to try to fix it

Thanks

Hi @Don ,

Oh ok. I’m not a developer either so we’re in the same boat. I don’t think you’re clouding the discussion at all. It was a good shout about the HTTPAgentLink type as that would have been an issue at some point for sure.
Thanks for the console suggestion! I’ve found a couple of issues in there. I also found this in there:

[Exception… “Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsIXPCComponents_Utils.readUTF8URI]” nsresult: “0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH)” location: “JS frame :: resource://gre/modules/L10nRegistry.jsm :: L10nRegistry.loadSync :: line 692” data: no]

I’m not sure if it is related to the AgentLink issue.

Hi @alvaro.heras, Don’t you need the country code after the name of the city? I.e. “Zaragoza,es”

Thanks guys.

This is quite old image and we were doing many updates recently. The best is if you update your image. Note that we have some breaking changes, therefore you need to wipe the database and start clean:

docker pull openremote/manager
docker-compose down
docker volume rm openremote_deployment-data
docker volume rm openremote_postgresql-data
docker-compose up -d
docker system prune

The country parameter is optional, although adding it gives the same problem.

HTTP Client [api.openweathermap.org/data/2.5]: Exception thrown whilst doing polling request [null]: api.openweathermap.org/data/2.5/weather

As if the response was null, but the api returns data as it got to work last week

This would be the request in the api in url mode →

http://api.openweathermap.org/data/2.5/weather?q=Zaragoza&appid=608d0184a6c4b24f4df5df9c1ff48c25

It seems that it does not know how to resolve the json that the API returns or the call is being made incorrectly

I have the last version of 2 days ago it puts me. Should I update it? Have you uploaded new content today or yesterday? @michal @Don @Pekka

No, the last update was 45 hours ago. Just do docker pull openremote/manager to be sure that you have the latest.

Thanks for the suggestion @michal .

I updated the image. It went fine apart from these two commands:

The reponse was:
Error: No such volume: openremote_deployment-data (or ‘postgresql-data’ for the second command).
Also, it didn’t fix the AgentLink syntax not sticking but maybe the missing volumes(?) is the issue. The SAVE button still clears the text box. :expressionless: