Open challo2018 opened 1 year ago
Currently, VitoWiFi doesn't support sniffing.
VitoWiFi has long been neglected from my side since I didn't use it myself anymore. However, in a couple of months I will move back to a house where I have full control over the (Viessmann) heating and breath new life into this project.
I'm already thinking about creating a version 3 with more flexibility on how to use the library. Suggestions are welcome of course. Sniffing is on the list as extended warranty is definitely something you don't want to sacrifice on expensive equipment.
v3 is more modular and a sniffer is probably within the possibilities to create. not top priority...
Thanks for your answer. Do you have time schedule for V3?
V3 will be very soon. The sniffer features a bit later.
I'm already testing (on a raspberry pi, code is compatible).
Hello bert, any news here? I read that V3 is allready running stable on your system, so i will try it with my heat pump. do you recommend using esp32 or raspberry?
I'm running V3. I'm running on a raspberry pi because it's easier for me for testing. An ESP would be more stable but that has more to do with stability of the system (my RPI sometimes fails because of my power stability).
I'm working on a ESP version that Serial via USB.
Passthrough should also be possible with the separate components of the library. I will think of an example and add it to the repo.
thank you, would be great to test such an version!
Just for my understanding:
Could we start with just the forwarder and have a look at the messages? I don't have a Vitoconnect so I can't test how this device queries the machine (bulk, burst...). So we first create an ESP passthrough device and log the messages to MQTT?
PS To avoid any possible trouble, you should tie GPIO15 to ground to suppress boot messages.
Currently Viessmann OptoLink Adapter (CP2102 Serial Chip) is connected to vitoconnect via USB.
I can build DIY Optolink adapter and connect it to Serial2 and connect ESP32 USB Port(Serial1) to the vitoconnect.
We can start with your suggestion to have first passthrough and logging only.
UNTESTED (Quick and dirty, I don't even know it compiles or not.) MQTT based on https://github.com/bertmelis/espMqttClient
#include <Arduino.h>
#include <WiFi.h>
#include <cbuf.h> // Circular buffer from Espressif Arduino framework
#include <espMqttclient.h>
#define WIFI_SSID "yourSSID"
#define WIFI_PASSWORD "yourpass"
#define MQTT_HOST IPAddress(192, 168, 1, 10)
#define MQTT_PORT 1883
#define USBSerial Serial
#define OptolinkSerial Serial1
#define BUFFERSIZE 256
cbuf txBuffer(BUFFERSIZE);
cbuf rxBuffer(BUFFERSIZE);
uint8_t buf[BUFFERSIZE];
void setup() {
USBSerial.begin(4800, SERIAL_8E2);
OptolinkSerial.begin(4800, SERIAL_8E2);
mqttClient.setServer(config.hostname, config.port)
.setServer(config.hostIP, config.port);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
while (WiFi.status() != WL_CONNECTED) {
delay(5);
}
mqttClient.connect();
}
void loop() {
// 1. read data from USB into txBuffer
int fromUSB = USBSerial.available();
if (fromUSB > 0) {
size_t room = txBuffer.room();
USBSerial.read(buf, room);
txBuffer.write(buf, room);
mqttClient.publish("VitoWiFiPassthrough/fromUSB", 0, false, buf, room);
}
// 2. write txBuffer to Optolink
while (txBuffer.available()) {
if (OptolinkSerial.write(txBuffer.read()) < 1) break;
}
// 3. read data from Optolink into rxBuffer
int fromoptolink = OptolinkSerial.available();
if (fromoptolink > 0) {
size_t room = txBuffer.room();
OptolinkSerial.read(buf, room);
rxBuffer.write(buf, room);
mqttClient.publish("VitoWiFiPassthrough/toUSB", 0, false, buf, room);
}
// 4. write rxBuffer to USB
while (rxBuffer.available()) {
if (USBSerial.write(rxBuffer.read()) < 1) break;
}
}
The above is (or should be) a simple USB <--> Serial forwarder.
Instead of publishing the passed-through message via MQTT, you could parse using VitoWiFiInternals::ParserVS2
and it will give you a (reference to a) VitoWiFi::PacketVS2
.
You can still choose to only parse messages coming from USB or only from Serial or both. Use a separate parser if you want both. Depending on what the data looks like, the data is directly usable or has to be further split up.
If you could test the sample above and let me know how it goes...
Thank you!! I will build up my DIY Optolink and check the code as quick as possible!
closing. feel free to reopen if further help is needed.
Maybe this is a solution for you: https://www.wemos.cc/en/latest/s3/s3.html
If Vitoconnect recognizes the ESP32-S3 as adapter, you could connect the original optolink to the ESP via the OTG port. Then this library could be integrated to communicate with the optolink: https://github.com/bertmelis/USBHostSerial
I have yet to adapt VitoWiFi to be compatible.
i will get an ESP32-S3 and come back to you for test. Thank you!
@bertmelis : I got ESP32-S3 for Testing your suggestion. Can you give me some hint on how to proceed with testing?
Is there any possibilty or any user which used VItoWifi together with viesmann vitoconnect due to longer viessmann guarantee when using vitoconnect?
ESP32 DEV board has CP2102 Serial Chip which is similar to the one from original optolink kabel. So it is possible to connect ESP32 USP directl to the vitoconnect. But It's necessary to extend VItoWifi to put all trafic from IR Serial port to the USB Serial port and other way round.
I'm waiting for my ESP32 Dev boards to try such an implementation. Is there any user who allready tried?