Open simeneide opened 3 years ago
As far as I know they have changed the "API" / controller interface on newer fans, which apparently is not backward compatible with the old one. I do not own one of the new ones so I'm afraid I can't help you out on this.
I did some quick checking and couldn't find documentation on this new controller interface either. If you are able to find it I can have a look and see if it required a lot of changes to the current library.
Sorry, I completely forgot that someone else actually did put in an issue with a link to the documentation of the new fans. https://github.com/aglehmann/home_assistant_ecovent/issues/10
I had a quick look and it requires a fair bit of modification to the existing library. They have made several changes, including some security features. The actual operation of the fans is quite similar to the existing one. But like I wrote earlier, without owning such a device and not being able to test the implementation it will be difficult for me provide support this new interface.
Thanks for the info. Ive made a first attempt but it does not seem to give me anything but timeouts so I guess I have some parts of it wrong. Will look into further, the current state is like this:
import socket
packet_beginning = "FDFD"
type = "02"
sizeid = "10"
fan_id = "0026001F4741570C"
size_pwd= "04"
#pwd = "01010101"
pwd="31313131"
func = "01"
data = "0102"
#func = "06"
#data = "01000203"
hexstr2tuple = lambda hex_msg: [int(hex_msg[i:(i+2)], 16) for i in range(0,len(hex_msg), 2)]
calc_checksum = lambda hex_msg: sum(hexstr2tuple(hex_msg))
# recieve example
content = f"{type}{sizeid}{fan_id}{size_pwd}{pwd}{func}{data}"
checksum = hex(calc_checksum(content))#.replace("0x","")
print(f"Calculated checksum: {checksum}")
use_checksum = "0100"
msg = f"{packet_beginning}{content}{use_checksum}"
print("Full message: ")
print(msg)
msg_byte = bytes.fromhex(msg)
socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
socket.settimeout(15)
socket.connect(('192.168.80.5', 4000))
print(socket.sendall(msg_byte))
response = socket.recv(256)
Hello, just tested with a Blauberg Vento Expert A50-1 W V.2. - I can confirm, that V2 Vents have different API.
fan_id has to be encoded properly, added byte swapping for checksum.
import socket
packet_beginning = "FDFD"
type = "02"
sizeid = "10"
fan_id ="30303343303033333436333035313034"
size_pwd= "04"
#pwd = "01010101"
pwd="31313131"
func = "01"
data = "0102"
#func = "06"
#data = "01000203"
hexstr2tuple = lambda hex_msg: [int(hex_msg[i:(i+2)], 16) for i in range(0,len(hex_msg), 2)]
calc_checksum = lambda hex_msg: sum(hexstr2tuple(hex_msg))
# recieve example
content = f"{type}{sizeid}{fan_id}{size_pwd}{pwd}{func}{data}"
checksum = hex(calc_checksum(content))#.replace("0x","")
print(f"Calculated checksum: {checksum}")
hexadecimal_string = checksum.replace("0x","").zfill(4)
byte_array = bytearray.fromhex(hexadecimal_string)
use_checksum = hex(byte_array[1]).replace("0x","").zfill(2) + hex(byte_array[0]).replace("0x","").zfill(2)
print(f"byte swapped checksum:")
print(use_checksum)
msg = f"{packet_beginning}{content}{use_checksum}"
print("Full message: ")
print(msg)
msg_byte = bytes.fromhex(msg)
socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
socket.settimeout(15)
socket.connect(('192.168.120.141', 4000))
print(socket.sendall(msg_byte))
response = socket.recv(256)
print ("Response: ")
print (response)
Blauberg Vento Expert A50-1 W V.2. is responding:
Calculated checksum: 0x411
byte swapped checksum:
1104
Full message:
FDFD02103030334330303333343633303531303404313131310101021104
None
Response:
b'\xfd\xfd\x02\x10003C003346305104\x041111\x06\x01\x01\x02\x01\x18\x04'
17:52:56.437135 IP 192.168.120.254.59152 > 192.168.120.141.4000: UDP, length 30
0x0000: 4500 003a 4647 4000 4011 818f c0a8 78fe E..:FG@.@.....x.
0x0010: c0a8 788d e710 0fa0 0026 89fa fdfd 0210 ..x......&......
0x0020: 3030 3343 3030 3333 3436 3330 3531 3034 003C003346305104
0x0030: 0431 3131 3101 0102 1104 .1111.....
17:52:56.443955 IP 192.168.120.141.4000 > 192.168.120.254.59152: UDP, length 32
0x0000: 4500 003c 0183 0000 8011 c651 c0a8 788d E..<.......Q..x.
0x0010: c0a8 78fe 0fa0 e710 0028 80f1 fdfd 0210 ..x......(......
0x0020: 3030 3343 3030 3333 3436 3330 3531 3034 003C003346305104
0x0030: 0431 3131 3106 0101 0201 1804 .1111.......
Any plans to incude V2 API support to pyEcovent?
This is great, thanks for looking further into this @olipir15 ! I tried out with your modified code but I still got a timeout. Being slightly n00b with hex, would this be the correct conversion?
#fan_id = "0026001F4741570C"
fan_id = "30303236303031463437343135373043"
If I get to communicate with the system, I can make an effort so this works :)
My full log after changing fan_id and IP:
Calculated checksum: 0x42c
byte swapped checksum:
2c04
Full message:
FDFD02103030323630303146343734313537304304313131310101022c04
None
Hi @simeneide thanks for testing. Your hex conversion looks good. Is the Fan IP correct and responding to ping? - can you send tcpdump output of sent package? Maybe was default pin (1111) changed to different value?
If someone is interested I'm working on ecoventv2 support on this link: https://github.com/gody01/pyEcovent branch ecoventv2
I have finished complete read protocol for all parameters. One can play with test.py to read all readable parameters from device.
If someone has some experence with python and will to join please do so:)
BTW: It is my first attempt to python programing languague so it is probybly not very optimal.
PS: I used some code from https://github.com/aglehmann/pyEcovent/issues/9, thanks guys.
that is great! :) I havent had time to look at this again, feel free to use my first attempt of course :)
I finished support for v2 api and created pull request #12. It creates new class ecoventv2 so it can coecsist with older api.
Will try to implement home-assistant with api2. It looks like lot's of sensors and switches are available from fans :)
FYI. I renamed fork with V2 support: https://github.com/gody01/pyEcoventV2
@gody01 any chance that you could make your repository HACS compatible?
Have to find time to make HomeAssistant integration first.
Hello,
I prepared HACS compatibile home-assistant integration: https://github.com/gody01/ecovent_v2
It's version 0.0.1 but it has support for all prepared home-assistant fan platform features.
Redame is here. No documentation for HACS yet: https://github.com/gody01/ecovent_v2/blob/main/README.md
hi @gody01, wow, thank you! I'll try it out 👍
Hi@gody01, would you be able to post "dummy" instructions on ow to configure ecovent_v2 on HACS?
I have installed ecovent_v2 on HACS, but not sure at all where/how to configure my fans.
Hello,
I prepared video with instructioins from HACS repo setup, donwload and integration instalation:
https://www.gody.si/home-assistant/ecovent_v2-instalation-video/
Thank you, works well!
Small notes: 1) The video wasn't available to play on mobile devices (iOS) 2) The configuration didn't load on a Rasperry PI 3. Solved by creating a "mirror" (restored from pi backup) virtual box on my PC and running there, then uploading that config to the pi.
(Is there a way to donate to you on github?). Thanks so much for writing this.
(Is there a way to donate to you on github?). Thanks so much for writing this.
Thanks, not at present :) You can always donate to some charity organization and publish here :)
The script is working flawlessly with both "blauberg native expert 50" and the blauberg DUO-fans. However, I bought a couple of vents twinfresh fans in november 2020 that do not integrate. I am able to successfully configure them in the app (vents twinfresh 2.0) and control them over local wifi, but all commands sent from pyEcovent is timing out. Has anyone else tested on more recent fans, and do you have any suggestions for debugging it?