Http POST formula help

#1

Hey guys I am in need of a little help. So I have a project that has a web interface from 2007. it's very insecure and what I have done is sniff the packets on it and have been able to replicate login, turn on, turn off, change volume, change input.
This is all done with a button that sends a value it is then formatted into a POST string then sends it to the final http request node. I have this all working perfectly and its FANTASTIC.
The one thing I haven't been able to get work is the brightness because it has two variables that change instead of just one and they are SUPER weird and make no logical sense. For example the volume goes from -32 to 32...... WHHHHY why not 0-100 clearly it has to do with some binary system that I dont understand as thats 64 spacing however i digress.
Anyway. When I sniff the packets to change the brightness here is what an HTTP post string looks like
http://192.168../picture.html?V3=1&D300=96&D3=-32

So after changing values on the projector interface V3 Never changes but D300 and D3 change. Again the D3 goes from -32 to 32 and D300 goes from 96 to 160 ... both of them 64 long. So say i want lowest brightness I would issue the above command. If I want the highest brightness I would issue
http://192.168../picture.html?V3=1&D300=160&D3=32

My problem is ... how to calculate that and put that into a function node. the only logical way I could think of is just have a giant array and have it pick from there.
The brightness slider I have goes from -32 to 32 and sends it to a function node it takes it and appends it to D3 as it would look like "V3=1&D300=96&D3="
This does not work because D300 doesn't change :frowning: is there any mathmatical forumal that you can think of to always derive what D300 is given D3 has a range of -32 to 32?
Any suggestions would be appreciated

0 Likes

#2

Maybe something like

msg.payload = "V3=1&D300=“+(msg.payload+128)+”&D3="+msg.payload;
0 Likes

#3

oh man! im an idiot of course! haha basic math... i will try this :slight_smile:

0 Likes