Forfatter Emne: http get / post  (Læst 154 gange)

0 Medlemmer og 1 Gæst læser dette emne.

Offline lassewt

  • Begynder
  • *
  • Indlæg: 6
  • Respekt optjent: +0/-0
http get / post
« Dato: Aug 06, 2017, 15:50 »
Hej

Findes der "simple " http post kommandoer til at ændre på fyrets settings, så man kan sende en "kommando " via web og ændre fyret istedet for at skulle ind manuelt og ændre det ?

Offline motoz

  • Top of the pop
  • *****
  • Indlæg: 210
  • Respekt optjent: +15/-0
Sv: http get / post
« Svar #1 Dato: Aug 07, 2017, 09:35 »
The controller does not contain an http server. You can use stokercloud, or if you want a local solution then you could use pellmon eg. on a raspberry or any old pc with linux, or in a virtual machine running linux on your windows pc.

Pellmon contains a webserver where you can GET settings with eg:
Kode: [Vælg]
GET /pellmon/getparam/boiler-tempwhich return the JSON data:
Kode: [Vælg]
value "65"
param "boiler-temp"

and change settings with POST, eg:
Kode: [Vælg]
POST /pellmon/setparam/alarm-max_shaft_temp
with params:
data: "50"

setparam/ requires a logged in user, so you need to POST username and password to /pellmon/auth/login and keep track of the session_id cookie.

Another option would be to set up a webserver pretending to be stokercloud, and a dns server to fool the burner to talk to your 'stokercloud' instead of the real one. But that's a lot of trouble and won't ever be nearly as good as just using the existing nice and fast UDP protocol.
Bio Comfort 30kW, compressor cleaning, lambda. Termax 25cr boiler. Matene vertical pellet conveyor. PellMon open source pellet logger: https://github.com/motoz/PellMon

Offline lassewt

  • Begynder
  • *
  • Indlæg: 6
  • Respekt optjent: +0/-0
Sv: http get / post
« Svar #2 Dato: Aug 07, 2017, 12:44 »
thanks for the reply

is there a simpel way to change settings on the burner from stokercloud.
im already getting status from stocker cloud via json outputtet..
Hope there is af oneline simpel command to stocker cloud. :)

Offline motoz

  • Top of the pop
  • *****
  • Indlæg: 210
  • Respekt optjent: +15/-0
Sv: http get / post
« Svar #3 Dato: Aug 07, 2017, 13:06 »
You can use the developer tools in your browser (ctrl-shift-k in firefox) and look at the network tab when changing a setting in stokercloud to see what it does.
Bio Comfort 30kW, compressor cleaning, lambda. Termax 25cr boiler. Matene vertical pellet conveyor. PellMon open source pellet logger: https://github.com/motoz/PellMon

Offline motoz

  • Top of the pop
  • *****
  • Indlæg: 210
  • Respekt optjent: +15/-0
Sv: http get / post
« Svar #4 Dato: Aug 14, 2017, 17:54 »
Did you give up? Anyway, here are some pointers to get you a bit further:

Using CURL to login to stokercloud:
Kode: [Vælg]
curl 'http://www.stokercloud.dk/dev/yourusername.html' -H 'Host: www.stokercloud.dk' --cookie-jar ./somefile --data 'username=yourusername&password=urlencodedpassword&action=login&tpg='
And then change hopper contents to 500 kg:
Kode: [Vælg]
curl 'http://www.stokercloud.dk/dev/updateajax.php?mac=yourusername&panel=2' --cookie ./somefile -H 'Host: www.stokercloud.dk' -H 'Content-Type: application/x-www-form-urlencoded' -H 'X-Requested-With: XMLHttpRequest' --data 'data=%7b%22field9%22%3a%22300%22%7d'
And to logout:
Kode: [Vælg]
curl 'http://www.stokercloud.dk/dev/yourusername.html' --cookie ./somefile -H 'Host: www.stokercloud.dk' --data 'logout=logout'
The password and form field data is urlencoded.
Bio Comfort 30kW, compressor cleaning, lambda. Termax 25cr boiler. Matene vertical pellet conveyor. PellMon open source pellet logger: https://github.com/motoz/PellMon