Interface > Interface til varme systemer

V7/V13 UDP protocol client in python

(1/11) > >>

motoz:
Jens told me that the new UDP protocol for local communication with the V7/13 box is nearing final, so if you have an updated V7 box you can try to talk to it with a test program I put up on github. It's written in python so it works on windows/mac/linux (and with some effort http://pythoncentral.io/python-for-android-the-scripting-layer-sl4a/ on android).  The test code implements a simple command line client that sends one request to the controller and prints the response.

https://github.com/motoz/nbetest

Use like this:


--- Kode: ---python client.py -a address -p password functioncode payload
--- afslutning på kode ---
or

--- Kode: ---python client.py -v -a address -p password functioncode payload
--- afslutning på kode ---
for a more verbose output.

If the address is left out the controller is discovered automatically on the local network

NBE kindly provides a public test box on v7testbox.stokercloud.dk with password 6464111183 that I have used to test the code since I don't (yet) have a V7 controller.

Read some settings from the text box:

--- Kode: ---python client.py -a v7testbox.stokercloud.dk -p 6464111183 1 boiler.*
--- afslutning på kode ---

You need python installed which can be downloaded here https://www.python.org/downloads/windows/. Both 2.7 and 3.5 work fine.

Ask Jens "BoinkUser" for more details on the protocol if you are interested.

BoinkUser:
Hi Motoz

Thats just splendid  8)

Works like a charm.

Yes, any questions just ask, we also have Android code and Java (PC/Mac/Linux you name it) code, that are free for any interested. Anyone particulary interested in iOS we also have that. But Motoz' code is also a good choice for your preferred platform.

Regards Jens


 

motoz:
Now I have a V7 box to play with...

Looks like the latest released (not beta) firmware has an older version of the protocol (no sequence numbers). I made a change to the nbetest client so it works with 7.0612 when using the --noseqnum option on the command line:


--- Kode: ---python client.py --noseqnum -p xxxxxxxxxx 4 *
time=22120
boiler_temp=22.2
smoke_temp=999.9
return_temp=999.9
dhw_temp=999.9
external_temp=999.9
forward_temp=999.9
t7_temp=999.9
distance=0
photo_level=0
shaft_temp=999.9
milli_ampere=0
oxygen=15.4
...

--- afslutning på kode ---

On linux and mac you need to escape the wildcard character '*' (otherwise the shell will expand it to filenames from the current directory):

--- Kode: ---python client.py --noseqnum -p xxxxxxxxxx 4 \*
--- afslutning på kode ---

This is fun... ;D

motoz:
I fleshed out the test client a bit yesterday. Now there is a 'get' and a 'set' command and a 'raw' command to send raw frames as before.

--- Kode: ---$ python client.py get
settings/
operating_data/
advanced_data/
consumption_data/
event_log/
--- afslutning på kode ---


--- Kode: ---$ python client.py get settings
settings/boiler
settings/hot_water
settings/regulation
settings/weather
settings/oxygen
settings/cleaning
settings/hopper
settings/fan
settings/auger
settings/ignition
settings/pump
settings/sun
settings/vacuum
settings/misc
settings/alarm
settings/manual
settings/bbq_smoke
settings/bbq_rotation
settings/bbq_grill
settings/bbq_meat
settings/bbq_afterburner
settings/bbq_div
--- afslutning på kode ---


--- Kode: ---$ python client.py get settings/auger
settings/auger/forced_run=0
settings/auger/auger_capacity=2200
settings/auger/auto_calculation=1
settings/auger/auger_10=5.72
settings/auger/auger_50=12.9
settings/auger/auger_100=21.9
settings/auger/kw_min=6.0
settings/auger/kw_max=23
settings/auger/runs_minute=6
settings/auger/min_dose=5.0
--- afslutning på kode ---


--- Kode: ---$ python client.py get settings/auger/auger_capacity
2200
--- afslutning på kode ---

And set:

--- Kode: ---$ python client.py set settings/auger/auger_capacity 2300
OK
--- afslutning på kode ---

As you may have noticed the controller does not (yet?) check that the password supplied is correct so it can be skipped.

motoz:
Added a small gui to the test code (gui.py)



https://github.com/motoz/nbetest/archive/master.zip

Navigering

[0] Emneindeks

[#] Næste side

Skift til fuld version