bertmelis / VitoWiFi

Communicate with Viessmann boilers using the optolink for ESP8266 and ESP32
MIT License
118 stars 39 forks source link

Callback with old value after write datapoint #52

Closed maihacke closed 5 years ago

maihacke commented 5 years ago

I create a bridge between vitowifi and openhab via mqtt. Therefore I implemented a method which publishes all read values via mqtt as global callback. Therefore I call readAll values in the esp loop. Then the global callback of vitowifi publishes all values via mqtt. That works quite well. For writing thr sketch listens to mqtt and call writeDataPoint accordingly. The problem is, that immediately after the write the global callback is called with the old value and this outdated value gets published via mqtt.

Is there a reason why vitowifi calls the callback with the old value after a write? I think the callback should not be invoked at all for writes.

What do you think?

bertmelis commented 5 years ago

It shoudn't return the old value but the newly written value. If not, it's a bug. (KW or P300 protocol?)

If it returns the newly written value, you get a confirmation that the heater accepted your action.

I could also completely disable but then you'll have to reread it yourself for confirmation. (I'm working on an update which also includes an onError()-callback)

maihacke commented 5 years ago

Im using KW. I will double check what happens and report it here.

maihacke commented 5 years ago

It was just an error in my type conversion logic. Btw: Thanks for this cool project.

FulvioSpelta commented 5 years ago

@maihacke nice idea, do you like to share your code ? Have a nice day f

maihacke commented 5 years ago

Code is here: https://github.com/maihacke/vitohab Please notice it is heavily in progress. Writing is not ready yet...

FulvioSpelta commented 5 years ago

Thank you very much. I'd like to have a red-only device at the moment.

maihacke commented 5 years ago

I will write a readme for openhab item definitions etc when I find the time...

bertmelis commented 5 years ago

For the record: there's an example in issue 45.

I'm running a service on my RPI3 (Raspbian latest) with the code in this repo: Mqtt2InfluxDB