Configured my ESPHome with MCP2515 CAN-Bus for Stiebel Eltron heating pump

Brainstormin, possible solution?
When value > e.g. 65000
256 * 256 = 65536
65536 - value from reading in this case 65526 = 10
10 / 10 *-1 = -0.1 degree celsius

I try this out. Looks promissing

#Außentemperatur

    - can_id: 0x180
      then:
        - lambda: |-
            if(x[0]==0xd2 and x[1]==0x00 and x[3]==0x00 and x[4] == 0x0c) {
              float temperature =float((int16_t((x[6])+( (x[5])<<8))));
              if (temperature > 65000){
                temperature=(temperature-65536);
              }
              temperature=temperature/10;
              id(temperature_outside).publish_state(temperature);
              ESP_LOGD("main", "Aussen-Temperature received over can is %f", temperature);
            }
1 Like

Good evening and good news, it works.

Is anyone seeing the power usage in the energy dashboard?
I already changed* the state_class from measurement to total_increasing as mentioned in the docs.

The data looks correct in HA it just will not update in the energy dashboard :woozy_face:

'* actually I added a sensor and updated the lambda just for testing…

Hi Bartek.

I’ve tryed run your code to my device but without success. When I’m trying compile coded I get message syntax error, end section expected on line number XX. Could you share your whole code together. I want adopt your sollution in my project. I just starter coding in home assistant and yaml.

My advise would be to do it segment by segment, compile and test in between there is likely an indentation, carrage return or open bracket somewhere.

Start with the standard stuff (wifi etc) then when thats done the “globals” from Bartek’s example
Continue with the “switch” then “sensors”, “time”, “spi” & “canbus”.

that should help you find out where the issue lies

Thanks for adviace I will try.

@roberreiter: Is it possible to get in contact with you by email or private message? (I searched for a PM button or similar, but can’t find it here?!)

I have a Stiebel Eltron LWZ 404 and connected an MCP2515 tp the CAN Bus. First I testet it with an ESP8266 without success. Today I tried an Arduino nano also without success. But now, after consulting the author of the used library I was able to fix the bug, and now I’m online. I can write a sketch in the Arduino IDE, compile and upload it, and now I receive messages from the CAN Bus.
The question is: What does it mean? How to extract data from this?

Entering Configuration Mode Successful!
Setting Baudrate Successful!
MCP2515 Initialized Successfully!
MCP2515 Library Receive Example...
Standard ID: 0x69F       DLC: 7  Data: 0x31 0x00 0xFA 0x00 0x0C 0x00 0xB0
Standard ID: 0x180       DLC: 7  Data: 0xD2 0x1F 0xFA 0x00 0x0C 0x00 0x28
Standard ID: 0x69F       DLC: 7  Data: 0x61 0x01 0xFA 0x00 0x11 0x00 0xB0
Standard ID: 0x301       DLC: 7  Data: 0xD2 0x1F 0xFA 0x00 0x11 0x00 0xD3
Standard ID: 0x69F       DLC: 7  Data: 0x31 0x00 0xFA 0x00 0x0E 0x00 0xB0
Standard ID: 0x180       DLC: 7  Data: 0xD2 0x1F 0xFA 0x00 0x0E 0x01 0xF2
Standard ID: 0x180       DLC: 7  Data: 0xD0 0x3C 0xFA 0x01 0x24 0x16 0x00
Standard ID: 0x180       DLC: 7  Data: 0xD0 0x3C 0xFA 0x01 0x26 0x0F 0x00
Standard ID: 0x180       DLC: 7  Data: 0xD0 0x3C 0xFA 0x01 0x23 0x0C 0x00
Standard ID: 0x180       DLC: 7  Data: 0xD0 0x3C 0xFA 0x01 0x25 0x10 0x00
Standard ID: 0x69E       DLC: 7  Data: 0x31 0x00 0xFA 0x00 0x0C 0x00 0xB0
Standard ID: 0x180       DLC: 7  Data: 0xD2 0x1E 0xFA 0x00 0x0C 0x00 0x28
Standard ID: 0x69E       DLC: 7  Data: 0x61 0x01 0xFA 0x00 0x0F 0x00 0xB0
Standard ID: 0x301       DLC: 7  Data: 0xD2 0x1E 0xFA 0x00 0x0F 0x00 0xF9
Standard ID: 0x69E       DLC: 7  Data: 0x61 0x01 0xFA 0x00 0x11 0x00 0xB0
Standard ID: 0x301       DLC: 7  Data: 0xD2 0x1E 0xFA 0x00 0x11 0x00 0xD3
Standard ID: 0x69F       DLC: 7  Data: 0x31 0x00 0xFA 0x00 0x0C 0x00 0xB0
Standard ID: 0x180       DLC: 7  Data: 0xD2 0x1F 0xFA 0x00 0x0C 0x00 0x28
Standard ID: 0x69F       DLC: 7  Data: 0x61 0x01 0xFA 0x00 0x11 0x00 0xB0
Standard ID: 0x301       DLC: 7  Data: 0xD2 0x1F 0xFA 0x00 0x11 0x00 0xD3
Standard ID: 0x69F       DLC: 7  Data: 0x31 0x00 0xFA 0x00 0x0E 0x00 0xB0
Standard ID: 0x180       DLC: 7  Data: 0xD2 0x1F 0xFA 0x00 0x0E 0x01 0xF3
Standard ID: 0x69E       DLC: 7  Data: 0x31 0x00 0xFA 0x00 0x0C 0x00 0xB0
Standard ID: 0x180       DLC: 7  Data: 0xD2 0x1E 0xFA 0x00 0x0C 0x00 0x28
Standard ID: 0x69E       DLC: 7  Data: 0x61 0x01 0xFA 0x00 0x0F 0x00 0xB0
Standard ID: 0x301       DLC: 7  Data: 0xD2 0x1E 0xFA 0x00 0x0F 0x00 0xF8
Standard ID: 0x69E       DLC: 7  Data: 0x61 0x01 0xFA 0x00 0x11 0x00 0xB0
Standard ID: 0x301       DLC: 7  Data: 0xD2 0x1E 0xFA 0x00 0x11 0x00 0xD3
Standard ID: 0x69F       DLC: 7  Data: 0x31 0x00 0xFA 0x00 0x0C 0x00 0xB0
Standard ID: 0x180       DLC: 7  Data: 0xD2 0x1F 0xFA 0x00 0x0C 0x00 0x28
Standard ID: 0x69F       DLC: 7  Data: 0x61 0x01 0xFA 0x00 0x11 0x00 0xB0
Standard ID: 0x301       DLC: 7  Data: 0xD2 0x1F 0xFA 0x00 0x11 0x00 0xD3
Standard ID: 0x69F       DLC: 7  Data: 0x31 0x00 0xFA 0x00 0x0E 0x00 0xB0
Standard ID: 0x180       DLC: 7  Data: 0xD2 0x1F 0xFA 0x00 0x0E 0x01 0xF2
Standard ID: 0x69E       DLC: 7  Data: 0x31 0x00 0xFA 0x00 0x0C 0x00 0xB0

Any hint is welcome!

My goal is to push the data in my volkszähler database.

Thank you and best regards,
Chris

Hi themanfrommoon

Each line is data encoded with a pattern already described in this thread (CAN ID sender, information or command type message, message).
If you don’t find here what you’re looking for (specially the last bits which map message type and ID) you could check this table: http://juerg5524.ch/data/ElsterTable.inc

Regards,
Adrien

Hi All,

First I would like to thank the community.
Your help was amazing!
My ESP32 + MPC2515 retrieve all the information in my HA setup.

However, I’d like to know if you were able to get the error messages from the heatpump?
Like HEISSGAS_TEMP threshold reach.
I know I could use a threshold in HA for this metric however I’d rather have the error emitted by the heatpump, log them and emit an alert in return. I would also prefer to have all kinds of known and future unknown alerts.

Thanks,
Adrien

Hi,

I think you can mask the messages to ranges for the Elster index numbers > 07a4 and < 0835
But it is a bit hard to guess, if all errors are within this range. There seem to be more messages in the table. And the elster-table is not completely exact. There are values that are not listed in it or differ a bit.

Maybe it would be possible to find a contact to elster-kromschroeder - This seems to be a company that made these CAN-bus bindings for Stiebel Eltron. But I’m not sure if they would provide a new list. I couldn’t find any contact yet.

Hi All,

I’ the new one. I ordered ESP32 and MCP2515 hardware and already connected it to my Stiebel Eltron WPE-I 06 heat pump by usind CAN-B with 50kbps. The communication working so far. For testing purposes I used the code from BartekTK - thank’s a lot!
I can see some valid data, but most of answers contain values like 32768. So I assume that I’m reading wrong CAN ID’s.

Maybe someone has the same WPE-I pump as me and can share the correct CAN ID’s?

Thanks a lot!!!

I speand a lot of time and found most data, which I need, comming from CAN_id 514.
As soon as I’m using heat pump HMI I can receive the data and decode it.
So now I know the right CAN_id and can addresses. Just need to find out how to change canbus.send request.

How to request data from CAN_ID 514?

Update: got it working.

Hello,
Can you share your code from ESPHome YAML?
Thanks,
BR

Great project! Took some while to get it working on my WPC13, got there in the end with bitrate 20kbps and no resistor. Anything else and I wasn’t getting any data.

I get most of the data like temperature etc. from can_id 0x180, however none of the power readings come through. This is what I get:

[00:43:14][D][main:707]: el_aufnahmeleistung_heiz_tag_kwh received over can is 32768.000000
[00:43:14][D][main:810]: Antwort von 180 Hex: d2 0 fa 9 1f 80 0
[00:43:14][D][main:811]: Antwort von 180 Float: 32768.000000
[00:43:14][D][main:812]: Antwort von 180 Dez.: 128 0
[00:43:14][D][canbus:033]: send extended id=0x680 rtr=FALSE size=7
[00:43:14][D][canbus:070]: received can message (#1) std can_id=0x180 size=7
[00:43:14][D][main:684]: el_aufnahmeleistung_heiz_total_kWh received over can is 32.768002
[00:43:14][D][main:810]: Antwort von 180 Hex: d2 0 fa 9 20 80 0
[00:43:14][D][main:811]: Antwort von 180 Float: 32768.000000
[00:43:14][D][main:812]: Antwort von 180 Dez.: 128 0
[00:43:14][D][canbus:033]: send extended id=0x680 rtr=FALSE size=7
[00:43:14][D][canbus:070]: received can message (#1) std can_id=0x180 size=7
[00:43:14][D][main:715]: el_aufnahmeleistung_heiz_total_mWh received over can is 32768.000000
[00:43:14][D][main:810]: Antwort von 180 Hex: d2 0 fa 9 21 80 0
[00:43:14][D][main:811]: Antwort von 180 Float: 32768.000000
[00:43:14][D][main:812]: Antwort von 180 Dez.: 128 0

I see others here have mentioned using can_id 0x514, however I’m only seeing data from 0x301 (FEK) and 0x601 (?, I don’t see anyone mentioning that ID here). Not sure if I should be using another CAN ID or if my unit doesn’t support this, as I am not able to see any power usage stats in the menu options either when looking at the FEK or module (WPM?) in the heatpump.

Tried a few more things, including requesting it from CAN_ID 500, 514 or 601. I only get data back from the latter, but it’s the same as from 180 above and seems ‘out of bounds’. Guess that 180 is the source anyway.

For those that get energy usage details, are those available in the FEK or heatpump unit menu as well for you as my WPC13 is from 2007 and might just not have the option available?

Hello Hasselhoff,

the energy usage details are in the heatpump unit.
If you don’t see the power usage in the module of the heatpump, then maybe you don’t have this data.
But you can try 0x601, I found this in some code I have seen from another integration.
601 would be C1 01 for the read packets and C0 01 for the write packets

Hi,
I just made some changes in the code, that should make it easier to change the CAN-IDs of the heat pump and - if needed - also for the can-bus controller.
I put the code in a github repository this time.
https://github.com/roberreiter/StiebelEltron-heatpump-over-esphome-can-bus

I didn’t achieve to push every reference to the can_id 680 into global variables, but at least the lambdas are now declared by the following global variables in one single position.

#CAN read address for heat pump manager  
  - id: PumpCANread_id
#CAN write adress for heat pump manager
  - id: PumpCANwrite_id
#CAN_ID of FEK
  - id: FekCANread_id
        
#CAN ID of esp-home device is set to 680 here, change this if you have to change the CAN-id
#Don't forget to also change the CAN-ID below
  - id: internalResponse_id

You can send me some feedback on the code if changes are required.

2 Likes

Dear all,

I only managed to get basic information (energy consumption) out of my LWZ304, but for now that satisfies my needs.
But: as long as it works, it doesn’t have enough functions…

I see that Roberreiter and others started on modifying operation parameters. Did anyone of you tried to influence ventilation parameters?
That would really be an improvement!
E.g. reduced air exchange when indoor humidity is low (and abs. outdoor humidity, too) or vise versa… Or active cooling during summer night. Or activation linked to air quality. or…

First step should be, to get ventilation parameters out of LWZ…

Any ideas on how to get this working?

BR Jens

Hi Jens,

i managed to set the ventilation steps on my THZ504 with:

select:
  - platform: template
    name: "Lüftungstufe Tag"
    id: lueftungsstufe_tag
    optimistic: true
    options:
      - "1"
      - "2"
      - "3"
    set_action:
      then:
          - delay: 500ms
          - if:
              condition:
                - lambda: |-
                    return (id(lueftungsstufe_tag).state) == "1";
              then:
                - canbus.send: 
                    data: [ 0x30, 0x00, 0xfa,0x05,0x6c,0x00,0x01 ]
                    can_id: 0x6a2
          - if:
              condition:
                - lambda: |-
                    return (id(lueftungsstufe_tag).state) == "2";
              then:
                - canbus.send: 
                    data: [ 0x30, 0x00, 0xfa,0x05,0x6c,0x00,0x02 ]
                    can_id: 0x6a2
          - if:
              condition:
                - lambda: |-
                    return (id(lueftungsstufe_tag).state) == "3";
              then:
                - canbus.send: 
                    data: [ 0x30, 0x00, 0xfa,0x05,0x6c,0x00,0x03 ]
                    can_id: 0x6a2
          - delay: 500ms
          - canbus.send: 
              data: [ 0x31, 0x00, 0xfa,0x05,0x6c,0x00,0x00 ]
              can_id: 0x6a2

  - platform: template
    name: "Lüftungstufe Nacht"
    id: lueftungsstufe_nacht
    optimistic: true
    options:
      - "1"
      - "2"
      - "3"
    set_action:
      then:
          - delay: 500ms
          - if:
              condition:
                - lambda: |-
                    return (id(lueftungsstufe_nacht).state) == "1";
              then:
                - canbus.send: 
                    data: [ 0x30, 0x00, 0xfa,0x05,0x6d,0x00,0x01 ]
                    can_id: 0x6a2
          - if:
              condition:
                - lambda: |-
                    return (id(lueftungsstufe_nacht).state) == "2";
              then:
                - canbus.send: 
                    data: [ 0x30, 0x00, 0xfa,0x05,0x6d,0x00,0x02 ]
                    can_id: 0x6a2
          - if:
              condition:
                - lambda: |-
                    return (id(lueftungsstufe_nacht).state) == "3";
              then:
                - canbus.send: 
                    data: [ 0x30, 0x00, 0xfa,0x05,0x6d,0x00,0x03 ]
                    can_id: 0x6a2
          - delay: 500ms
          - canbus.send: 
              data: [ 0x31, 0x00, 0xfa,0x05,0x6d,0x00,0x00 ]
              can_id: 0x6a2
2 Likes