elupus / esphome-nibe

Esphome components for nibe heat pumps
MIT License
65 stars 20 forks source link

Unacked data from Nibe VVM225 - Modbus Alarm #54

Open bgarderhagen opened 10 months ago

bgarderhagen commented 10 months ago

Hi.

As mentioned in other posts, i have struggled with modbus alarms from time to time. I thought i have resolved it by replacing my M5Atom RS485 with a LillyGo CANRS485.

However i got a new alarm this morning precisely 07:00.

I did not fully trust this ESP replacement so i had a Modbus logger running on the same bus.

07:00 5c 0 20 68 50 44 9c 15 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 0 0 0 0 0 0 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 d5 6 8c 2 c 80 0 0 0 07:00 5c 0 20 69 0 49 0 0 0 0 0 0 0 c0 88 17 63 a4 17 0 0 47 15 0 0 2 f5 0 78 0 0 0 0 e2 31 6 0 0 0 87 6 07:00 5c 2 d8 6 07:00 5c 0 20 6b 0 4b 6 0 0 0 0 0 0 6 07:00 5c 2 27 2 c 2 07:00 5c 2 84 6 07:00 5c 15 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 d5 0 0 0 0 0 0 0 15 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 d5 6 0 0 0 0 0 0 0 07:00 5c 0 20 69 0 49 0 0 0 0 0 0 0 c0 88 17 63 a4 17 0 0 47 15 0 0 2 f8 0 78 0 0 0 0 e2 31 6 b 0 0 81 6 07:00 5c 2 db 6 07:00 5c 0 20 6e 1 1 4e 0 0 0 0 0 0 6 07:00 5c 2 27 2 e 2 07:00 5c 2 86 6 07:00 5c 15 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 d5 0 0 0 0 0 0 0 15 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 d5 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 07:00 5c 2 27 2 e 2 07:00 5c 2 86 6 07:00 5c 0 20 69 0 49 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 46 15 0 0 2 f8 0 78 0 0 0 0 e2 31 6 6 0 0 8d 6 07:00 5c 2 27 2 c 2 07:00 5c 2 84 6 0 0 0 0 0 0 0 8a 6 07:00 5c 0 20 68 50 44 9c 15 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 0 0 0 0 0 0 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 d5 c9 8c 2 c 80 0 0 15 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 0 0 0 0 0 0 0 0 ff ff 0 0 ff ff 0 0 ff ff 0 0 d5 6

So.

5C 02 27 02 0E 02

This is not acked.

Can anyone tell me what this code is, and is it possible to expand the NibeGW code to do so ? I do not have the skills to patch the code myself.

Thanks a lot :-)

Best regards Bjørn Tore Garderhagen

elupus commented 10 months ago

Well if network freezes it might freeze. You could disable the network transmission by hacking NibeGwComponent::loop() to always keep isconnected as false.

It currently does call network functions in some bad spots.

bgarderhagen commented 10 months ago

image

elupus commented 10 months ago

My double 5c check is wrong. Ive missed a case. I will figure out a fix and report back.

elupus commented 10 months ago

I've published a fix in https://github.com/elupus/esphome-nibe/releases/tag/v2.2.1 please upgrade and try again.

bgarderhagen commented 10 months ago

Fantastic. Thanks. Running now ;-)

bgarderhagen commented 10 months ago

Hi.

Spent a lot of time debugging here. The code change from 3 days ago did not help.

Updated my logger again, and found out that the nibegw code is actually misses ack very frequently on the 0x5c 0x00 0x20 frames. Randomly generating an alarm on my VVM225.

This made me deep into the frame start detection method. I have made a fork of the code, and updated this part. Now it's more strict for how to identify frame start.

Caveat: NibeGW code will not process any other frames recieved on the RS-485 bus not starting with 0x5c 0x00 and the accessories added in ESP Home config.

This solved my issue.

My changes can simply be tested using this following "external_componentes" section in ESPHome config:

external_components:

gerbenvl commented 10 months ago

I've published a fix in https://github.com/elupus/esphome-nibe/releases/tag/v2.2.1 please upgrade and try again.

Are you sure this didn't create side effects for others? I was running fine since beginning of October on my SMO40. Never got the modbus errors al all.

But since the last week it's raining modbus errors all of a sudden. Today even 10-15 errors. I didn't change anything in my wiring or setup. Reboot doesn't help.

It's colder here though (freezing a bit) but not sure if that could be related?

elupus commented 10 months ago

I've published a fix in https://github.com/elupus/esphome-nibe/releases/tag/v2.2.1 please upgrade and try again.

Are you sure this didn't create side effects for others? I was running fine since beginning of October on my SMO40. Never got the modbus errors al all.

But since the last week it's raining modbus errors all of a sudden. Today even 10-15 errors. I didn't change anything in my wiring or setup. Reboot doesn't help.

It's colder here though (freezing a bit) but not sure if that could be related?

It should not cause side effects. Do you know which version you where running before? You can change your config to use the old version of the component. Would be good to check.

gerbenvl commented 10 months ago

Guess a 2.1.x version, can I see that somewhere?

You can change your config to use the old version of the component. Would be good to check.

Yeah like to give that a go. How can I force the config to an older version? (sorry esphome noob).

elupus commented 10 months ago

Yeah like to give that a go. How can I force the config to an older version? (sorry esphome noob).

https://esphome.io/components/external_components.html

Add the ref tag with one of the releases here: https://github.com/elupus/esphome-nibe/releases for example:

external_components:
  - source: 
      type: git
      url: https://github.com/elupus/esphome-nibe.git
      ref: v2.1.3
    components: [ nibegw ]
gerbenvl commented 10 months ago

Thanks, moved back to 2.1.3. Will update here to see if it helps.

elupus commented 10 months ago

Seems i managed to push the wrong branch for v2.2.1 release. So it did not contain the expected fixes. I've pushed v2.2.2 now. Thanx @gaaf for the heads up.

elupus commented 10 months ago

@bgarderhagen think you can try my latest release?

bgarderhagen commented 10 months ago

Sure :-)

bgarderhagen commented 10 months ago

No, My change is not included yet.

gerbenvl commented 10 months ago

Thanks, moved back to 2.1.3. Will update here to see if it helps.

The modbus errors fully disappeared with this version. Will await a couple of days to see if it stays stable.

Will move back to the latest version after that to see if the modbus errors come back.

bgarderhagen commented 10 months ago

Hi. Yes. Was to quick while looking for my change keeping more bytes in buffer. Sorry.

The change you made works perfect, and does not have the same limitation.

No missing Ack and therefore no Modbus alarms :-)

Thank you.