Http api can I put more values?

Hello everyone, I have a question about the api http, how can I write more values ​​on a single Pin? In the guide there is the example for the put method, but speaks of a single value. Thanks for the answers.

One pin can only ever have one value at any given time. A fraction of a second later you can write another value.

Maybe explain what you would like to do so we can provide an answer to your real problem.

2 Likes

I would write more values ​​as the bridge function where I can write more values ​​on a Pin and then retrieve it via paramasint method but through http api

The solution for now would be to use multiple pins. I think they are working on making this possible though. It’s a much wanted feature, I could do with it too for my Lamp projects :slight_smile:

1 Like

@Thomas and @Lichtsignaal wouldn’t you be able to code the same effect of a pin having multiple values?

So for example if you wanted to send speed and direction to a motor a pin could hold something like 100C for 100 rpm in a clockwork direction and 140A for 140 rpm in an anti clockwork direction.

1 Like

Current HTTP API was designed for widgets handling. So in other words if you don’t have widget you are not able to store/get value. But idea is good. I’ll implement it soon. I created ticket for that.

2 Likes

It’s possible, but you have to create your own “protocol” for that. I’m facing similar issues with my Lego Trains, I still have no idea how to fix that.

At this point I’m considering using the infamous DCC protocol and build decoder for Lego Trains based on that. In the end I can probably control my trains using standard railroad modeling software like iTrain or maybe even the Roco MultiMouse and such.

Practically, I would like to convey 12 values from a Python application residing on Rapberry PI (which is also the installayto Blynk server) to the thermostat / Arduino, I thought I could use the pins as a communication channel via http api, since Python has no libraries for Blynk.
Anyway thanks again for the support, I’ll wait for this to be implemented.

@Thomas do you need just last stored values? Or you need also history data for those values?

@Costas @Thomas @Lichtsignaal by the way feature is already implemented for 0.16.4 server.

1 Like

through a program in Python on raspberry where also stay Blynk server, I get data from internet and would like to make them available to all devices connected to Blynk server, it would be able to enter up to 12 values ​​at Pin, but I do not need the history

Great! Really thank you

Hi,
Is this feature confirmed to be working?

I am trying it out on local sever 0.16.4 but it only works if I have a widget with the Vpin on my dashboard.

I can write multiple values to the single Vpin which is great.

Blynk.virtualWrite(V120, 1111,1234,6969);
Blynk.syncVirtual(V120);

Then I’m expecting this function to run and give me a serial output, but it only works if I have the Vpin 120 allocated on my dashboard.

BLYNK_WRITE(V120)
{ 
int x = param[0].asInt();
int y = param[1].asInt();
int z = param[2].asInt();
Serial.print("Read from V120 x value - ");
Serial.print(x);
Serial.print(" y value - ");
Serial.print(y);
Serial.print(" z value - ");
Serial.println(z);
}

@NickMurray hello. This feature you are describing is called Sync for Non widget pins and it was implemented as part of Sync bridge feature :slight_smile: and will be available in 0.17.0. 0.17.0 release will come in few days.

1 Like

Very nice work. @Dmitriy
Thanks

Really sorry but I can not communicate with the server api, which port should I use? If I start the call by a program who is on the same Blink server machine it works?
(ps I use the 17 blink server version)

Default port is 8080 for http and 9443 for https.

Yes.

1 Like

Thank you @Dmitriy, I try but I always get “connection refuse”

I use this code get from apiary on blink api section.

`from urllib2 import Request, urlopen

values = “”"
[
“1”,
“2”
]
“”"

headers = {
‘Content-Type’: ‘application/json’
}
request = Request(‘http://192.168.0.200/authid/pin/V11:8080’, data=values, headers=headers)
request.get_method = lambda: ‘PUT’

response_body = urlopen(request).read()
print response_body`

I’ve modified with my authid and my ip Blink server address

Update: I’ve modified the code and now I get error 400
Thi is the code:
`from urllib2 import Request, urlopen

values = “”"
[
“1”,
“2”
]
“”"

headers = {
‘Content-Type’: ‘application/json’
}
request = Request(‘http://192.168.0.200:8080/authid/pin/V11’, data=values, headers=headers)
request.get_method = lambda: ‘PUT’

response_body = urlopen(request).read()
print response_body`

@Thomas what exactly error says?