VaRest help with writing variables to

Hello , so I have all setup with an external channel where I read data and visualize it in unreal , I have temperature and humidity data, I get those and I can visualize , but I want also now to send a feedback back to external site writing the data, so I got the write key and setup all like this :slight_smile:

this should in my desires not only write the value , 0 or 1 into the correct fields which should be both 4rth and 5th field but also update the icon colors … well seems nothing works , nothing is written out and the icons aren’t updated, as a condition I put that the values must be above 20 , since are actually 30 or so they should work but they don’t and I dunno why ,

What happens is , after a few secs the temp and hum values are read and the icon turns red ( Temp read is 28 and condition is for beeing > of 20 to turn red ) but after a while the icon turns green and the readings disappear setting all to null into the external website …
Also getting this error in code after closing app…

perhaps you can help me ?

to resume fields 1 and 2 hold the actual read values, and field 4 and 5 should get the written 1 and 0 values by unreal .

loks like in the branch section there is an issue with the data, when the data is not arriving it sets the whole thing to null even on excternal site and then after the cycle seconds when the new read is coming from the external sensor data its written in and updated, then after a new cycle it all gets to null again …

how to fix?

Afer further testing I come to the evidence that the problem is the function called is notvalid but why?

So, we meet again… :smiley:
Aggiornarmento Allarme Temp: Empty Reference
IsValid check in the last picture: Empty Reference => Always invalid

I would first create the part where you get the values and check if this always works. You can also use a different method instead of CallURL => Process URL.

1 Like

Here I oversimplified to debug,

I removed the calls to write into the json stuff …

I still get invalid, I recreated the function just as custom event, it alwyas gives me invalid …

the values coming as condition are numeric string that is converted to value , its usually ranging between 20 and 30 .
according to this code, since it finds not valid it always prints the numbers on screen.

You have to use an InputObject on your IsValid node

Yes I connected the image as object reference … the invalidity check gets passed and so it works changing the icon colors…

Now I want to add it so that I can change specific fields only values … but this turns out to be a problem apparently. I have to get a new function or use the one created with the object reference as image?

So wen I connect the Json api stuff … I want to change only a single field but instead it overwrites all setting to null all others and a value in the field 3 …

how I do avoid it to mess with the other values?


Can you try this?
You have to change the URL in ProcessURL (that is a site to test those requests)

what Url I place?

That would be your url you used before: https://api.thingspeak.com/update?api_key=XXXXXXXXX where XXXXXXXX is your api key

Ok I did that but in this case doesn’t updates at all .

also how you do the color green and red and so to set to true or false?

How do I set this part?

What I posted is an alternative to your branch. The TEMP float would be your temperature string you convert to a float and check if it is greater than 20. Here I just use a SELECT node. When you drag off of the input pin from the SetBrushTintColor or the SetStringField you can type Select and place that node. Depending on the boolean value of “Is Temp greater than 20” the Select node selects the False or True input/value. The select node will use the right type of variables when you drag off of the input off the node, e.g. SlateColorStructure for SetBrushTintColor or String for SetStringField. You can than drag off of the False or True pin and promote this to a variable (GreenColor, RedColor)

those are the selects I get ?

Ok I managed to copy it all …

But I get no update, nor in color , nor in the values on the field …

Did you set the TEMP float? The TEMP float was just an example / placeholder, in your case it was this
https://i.gyazo.com/adb364a8081e2b68ab4847f8b837b47f.png where on the left the string gets converted to float.

I converted the value from there to a temp float , so should get the correct value …

I forgot to add & in the url , after I added though I get the same results or worst ?

Also got this :slight_smile: