Forfatter Emne: API til adurocloud / Aduro Hybrid  (Læst 22623 gange)

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

Offline greatdane

  • Begynder
  • *
  • Indlæg: 8
  • Respekt optjent: +0/-0
API til adurocloud / Aduro Hybrid
« Dato: Apr 10, 2020, 20:29 »
Hej !
Jeg er ny ejer af en Aduro Hybridovn - og er samtidig ihærdig bruger/udvikler på smarthome-løsninger.
Er der nogen der ved om det er muligt at udlæse data fra - samt evt. styre - aduro-hybrid-ovnen vha. http/mqtt eller lign. ?
Jeg er med på at jeg kan logge mig på adurocloud.dk og se min ovns data - men har brug for et simpelt API til at kode mod...
Gode ideer imødeses gerne ;-)

Martin

Offline motoz

  • Top of the pop
  • *****
  • Indlæg: 255
  • Respekt optjent: +18/-0
Sv: API til adurocloud / Aduro Hybrid
« Svar #1 Dato: Apr 12, 2020, 09:30 »
The aduro hybrid apparently uses mostly the same protocol as scotte V7/13, so you can use https://github.com/motoz/nbetest to read and write from/to it. (See https://github.com/motoz/nbetest/issues/4 )

Pellmon with the NBEcom plugin should then also work, and with that running you can use pellmonMQTT to connect pellmon to an mqtt broker and there you have it...

https://github.com/motoz/PellMon
https://github.com/motoz/pellmonMQTT

the 'nbetest' client is crossplatform, pellmon and pellmonmqtt only linux (but you can run in in a virtual machine).

Or you can use NBEtest as 'documentation' to code up your own protocol client in your preferred language. Some info here also: https://github.com/motoz/PellMon/issues/98#issuecomment-460740348

Hope this helps!
Bio Comfort 30kW, compressor cleaning, lambda. Termax 25cr boiler. Matene vertical pellet conveyor. PellMon open source pellet logger: https://github.com/motoz/PellMon

Offline greatdane

  • Begynder
  • *
  • Indlæg: 8
  • Respekt optjent: +0/-0
Sv: API til adurocloud / Aduro Hybrid
« Svar #2 Dato: Maj 18, 2020, 13:21 »
Fantastic - it works !! - I just managed to start and then stop my Aduro H2 using the nbetest script etc.
I will now start exploring how to embed this in my smarthome setup (OpenHab) - probably through PellMon which I have yet to try out
Thanks a million !

Offline greatdane

  • Begynder
  • *
  • Indlæg: 8
  • Respekt optjent: +0/-0
Sv: API til adurocloud / Aduro Hybrid
« Svar #3 Dato: Maj 18, 2020, 14:42 »
Hmm - I ran into a problem getting Pellmon to work - installation on my raspberry pi went fine - and configs are all set. However, NBECom does not connect to my Aduro H2.
I dont seem to be able to find any config where I can set the IP address of my Aduro for Pellmon to look for it ? - it says it will "autodiscover" but that does not seem to work.
When trying out NBETEST as you suggested, I simply used the -a parameter and inserted the local IP (in my case 192.168.10.124) of my Aduro. That worked fine...
Any suggestions ?

Offline motoz

  • Top of the pop
  • *****
  • Indlæg: 255
  • Respekt optjent: +18/-0
Sv: API til adurocloud / Aduro Hybrid
« Svar #4 Dato: Maj 18, 2020, 18:51 »
Hello greatdane. Great that it works, so far...

PellMon only supports autodiscovery. You probably already set your serial number and password in /etc/pellmon/conf.d/plugins/nbecom.conf? https://github.com/motoz/PellMon/blob/master/src/conf.d/plugins/nbecom.conf
And did you install the newest alpha3 release or 0.7.0? https://github.com/motoz/PellMon/releases There was some problems with V13, I think I made some small fix for that a year or so ago. V13 back then at least tripped out if you tried to connect with a port > 9999. Since aduro is new it probably is more similar to V13 than V7, so I think you need the latest alpha. There might be other issues also, you are the first that I know of to try out PellMon with aduro... Pellmon might very well misbehave if the aduro doesn't have all the data that a 'normal' V13 has, but I'm sure we can sort that out if you can help out a bit, since nbetest is already working.
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: 255
  • Respekt optjent: +18/-0
Sv: API til adurocloud / Aduro Hybrid
« Svar #5 Dato: Maj 18, 2020, 19:09 »
If you are into that you can change this line:
https://github.com/motoz/PellMon/blob/3e2511ada9e2cd5715c5c9ad67f45a41ef8d82f3/src/Pellmonsrv/plugins/nbecom/__init__.py#L89
to
Kode: [Vælg]
self.proxy = Proxy(self.password, 8483, 'your.ip.number', serial = self.serial). It still uses the discovery protocol, but it sends the frame directly to that ip instead of broadcasting it. Pellmon is 'fairly easy' to run in debug mode to test and see where things go wrong: https://github.com/motoz/PellMon/wiki/Contributing-to-PellMon
Bio Comfort 30kW, compressor cleaning, lambda. Termax 25cr boiler. Matene vertical pellet conveyor. PellMon open source pellet logger: https://github.com/motoz/PellMon

Offline greatdane

  • Begynder
  • *
  • Indlæg: 8
  • Respekt optjent: +0/-0
Sv: API til adurocloud / Aduro Hybrid
« Svar #6 Dato: Jun 06, 2020, 10:00 »
Hi motoz

Been offline for a few weeks. Have reset my installation to a new ubuntu server 20.04.
However, when installing the pellmon package with gdebi I get;

This package is uninstallable
Dependency is not satisfiable: python-argcomplete

When trying to install argcomplete there seem to be a complication as python-argcomplete won't install as python3-argcomplete is already installed. Somehow however, the gdebi package does not recognize this

Have you heard about this before - and do you have suggestions for how to bypass/resolve ?

Offline motoz

  • Top of the pop
  • *****
  • Indlæg: 255
  • Respekt optjent: +18/-0
Sv: API til adurocloud / Aduro Hybrid
« Svar #7 Dato: Jun 07, 2020, 15:49 »
PellMon is python 2 only, and I think in ubuntu 20.04 there is only python3 installed by default, so you have to install python2. I think that they also made the 'python' command start python3, which of course breaks all existing scripts that were made for python2. There seem to be a way to configure it however, see e.g.  https://linuxconfig.org/how-to-change-from-default-to-alternative-python-version-on-debian-linux
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: 255
  • Respekt optjent: +18/-0
Sv: API til adurocloud / Aduro Hybrid
« Svar #8 Dato: Jun 08, 2020, 09:21 »
I realize my answer is a bit vague... I don't know if the current pellmon package can be made to work or not on ubuntu 20.04. Installing from source probably works after manually installing python 2 and configuring it to be the default python. Pellmon needs to be ported to python 3 at some point, but I'm struggling to find motivation for that at the moment.
Bio Comfort 30kW, compressor cleaning, lambda. Termax 25cr boiler. Matene vertical pellet conveyor. PellMon open source pellet logger: https://github.com/motoz/PellMon

Offline greatdane

  • Begynder
  • *
  • Indlæg: 8
  • Respekt optjent: +0/-0
Sv: API til adurocloud / Aduro Hybrid
« Svar #9 Dato: Jun 11, 2020, 16:01 »
OK - installed a fresh Ubuntu and got it installed and it is running with the latest alpha - but is still not finding my Aduro.
Is there nowhere in the installation where I can make the update to search for my specific IP - instead of building a whole new install ?

Offline darboo

  • Begynder
  • *
  • Indlæg: 4
  • Respekt optjent: +0/-0
Sv: API til adurocloud / Aduro Hybrid
« Svar #10 Dato: Jun 12, 2020, 00:03 »
Hello,
Thanks for the information i also want to control my Aduro directly.
I'm trying to convert it in php (i want only the udp command) and i only block on the encryption, the others things works.
Do you have more information about the RSA encryption done ?

Offline motoz

  • Top of the pop
  • *****
  • Indlæg: 255
  • Respekt optjent: +18/-0
Sv: API til adurocloud / Aduro Hybrid
« Svar #11 Dato: Jun 12, 2020, 06:36 »
Greatdane: This is python, you can just edit the installed python file in /usr/lib/python2.7/dist-packages/Pellmonsrv/plugins/nbecom/
(But running in 'debug mode' without daemonizing enables you to add print statements here and there to see what's happening and what's not happening).

Darboo: I'm afraid what I have left is only what's in the code:
Here it reads the public key from the controller:
https://github.com/motoz/nbetest/blob/a572ecf0050e341f6c41256a52812e641e08b1c8/protocol.py#L71
And here it uses it to encrypt the payload in the 'set' command:
https://github.com/motoz/nbetest/blob/a572ecf0050e341f6c41256a52812e641e08b1c8/frames.py#L84
But you can ask for more info from Jens (boinkuser).

You can also set a key for the simpler xtea chiper (using RSA), and then encrypt using xtea after that. This was never fully implemented in the nbetest program, only in PellMon. It's a way to speed up changing settings, as the RSA chipher in very slow in the controller.
Bio Comfort 30kW, compressor cleaning, lambda. Termax 25cr boiler. Matene vertical pellet conveyor. PellMon open source pellet logger: https://github.com/motoz/PellMon

Offline darboo

  • Begynder
  • *
  • Indlæg: 4
  • Respekt optjent: +0/-0
Sv: API til adurocloud / Aduro Hybrid
« Svar #12 Dato: Jun 14, 2020, 00:00 »
Nice it works, the RSA encryption must be done with no padding.
I have also implemented the xtea encryption and indeed it's faster.

Now i can have the status of my Aduro, start & stop it and change the settings. Thanks a lot it will be easier to use it next winter !!

Offline motoz

  • Top of the pop
  • *****
  • Indlæg: 255
  • Respekt optjent: +18/-0
Sv: API til adurocloud / Aduro Hybrid
« Svar #13 Dato: Jun 14, 2020, 18:49 »
Great!
Does the discovery protocol work or do you have to give the IP of the controller? No padding means you are encrypting only the payload and not padding it to 64 bytes? The V7/13 controllers used textbook RSA which is not secure without padding, maybe the aduro used a better chipher? OAEP?  Or maybe I'm mixing things up, I haven't looked at this in a long time. Are you going to post the code somewhere? Would be great to have a look...
Bio Comfort 30kW, compressor cleaning, lambda. Termax 25cr boiler. Matene vertical pellet conveyor. PellMon open source pellet logger: https://github.com/motoz/PellMon

Offline darboo

  • Begynder
  • *
  • Indlæg: 4
  • Respekt optjent: +0/-0
Sv: API til adurocloud / Aduro Hybrid
« Svar #14 Dato: Jun 15, 2020, 11:49 »
Yes the discovery protocol works with the Aduro hybrid.

For the RSA encryption, default library (openssl_public_encrypt in php) add automatically the padding for secure reason, so for the 512 bit key size the max size of the encrypted string is 52 Bytes. The size of the Aduro payload can be more than 52 bytes and in your software the padding is done directly by the software. So to work the encryption must be set without padding but there is a padding done by the software.