S0 pulse output home assistant

Hi. I wonder if anyone knows how to generate S0 pulses based on energy readings from a P1 port and output them from HA. I have a heating system from Daikin that need S0 pulses. Now I have all the data in HA through p1 port but is it possible som generate the pulses instead of adding even more meter to my electrical central. I need a s0 for the total and also for each phase.

The Same for me too. I Have all values in Homeassistant, with two Shelly 3EM, but i need Surplus Output in S0 for my Heatpump. The thing is, it is not possible to get a connection by wire to my Energy Meter, So im not able to install a S0 energy Meter. Is that possible to create a S0 Output in my Homeassistant Raspberry Pi?

Hi
I have exactly the same question.
I also have all the values in HomeAssistant, but my energy meter also does not have a S0 output which the heatpump requires.
The best information I’ve found so far by searching was with an internet search where I’ve this description “S0 - Signal mit Wemos D1 Mini erzeugen”. It’s for ioBroker however and is not a too detailed description.
Does anyone have any further information?
Thank you!

Hi @Eistee and @pretori
Is this still relevant for you?
I’m getting closer to a solution. I’m using an ESP32 with I’ve connected through MQTT to transfer the kW information to generate the corresponding pulses. I’m currently working on the hardware. Do you have some information about which diodes etc. should be used to generate an S0 signal? Thank you!

At this moment not for me, but all the guys with heat pumps need this to module Power…

Has anyone found a solution?

Hello,

I’ve been trying to generate S0 pulses for controlling the power limitation of my heat pump (daikin altherma) based on my solar panel output. At the moment it’s not working (my heat pump does not detect the signal).

I use an ESP module with ESPhome to control a relay (or an optocouple, I tried both) on/off at the frequency of the pulse I want to generate. If I manage to make it work I’ll post it here, but so far my S0 signal looks good to me but my heat pump does not seem to detect it so not sure what I’m doing wrong…

Hi,

I think I’ve managed to make it work. I try to detail below what I’ve done, but don’t hesitate to ask me if anything is unclear.

I use a NodeMCU (8266) with ESPHome linked to a relay board with (at least) 3 relays. The first two relays are used to control the smart grid contact on the daikin altherma 3 heat pump (contacts 5-6 and 9-10 on the X5M connector on my model). This is the standard smart grid control detailed in different projects (see for instance ESPAltherma).

I then use the third relay (an optocoupler would be better but I didn’t have one available at the moment) and connect it to the Smart grid pulse meter input of the daikin heat pump (connectors 3-4 of the X5M connector on my model).

I use the following configuration for ESPhome:

esphome:
  name: espSmartGrid
  
  on_loop:
    then:
      - lambda: |-
          static uint32_t last_time = 0;
          static uint32_t start_pulse = 0;
          // 1000 imp/kWh =
          uint32_t pulse_width_ms = 1000*(3600*1000/1000)/(id(simu_power).state);
          uint32_t now = millis();

          if ((pulse_width_ms) > 0) {  
            if (now - last_time > (pulse_width_ms)) {
                last_time = now;
                start_pulse = now;
                id(out_power_pulse).turn_on();
                ESP_LOGD("loop", "pulse_width_ms: %d", (pulse_width_ms));
            }
          }

          if (now - start_pulse > id(pulse_duration).state) {
                id(out_power_pulse).turn_off();
          }
  
  platform: ESP8266
  board: nodemcuv2

wifi:
  ssid: YourSSID
  password: YourPassword

api:

ota:

number:
  - platform: template
    id: simu_power
    name: "S0 Pulse Simulated Power"
    optimistic: true
    min_value: 0
    max_value: 4000
    step: 1
    initial_value: 0
  - platform: template
    id: pulse_duration
    name: "So Pulse Duration"
    optimistic: true
    min_value: 0
    max_value: 800
    step: 1
    initial_value: 200

output:
  - platform: gpio
    id: out_power_pulse
    pin: GPIO5
    inverted: true
  - platform: gpio
    id: relay_1
    pin: GPIO15
    inverted: true
  - platform: gpio
    id: relay_2
    pin: GPIO13
    inverted: true

select:
  - platform: template
    name: Smart Grid
    id: smart_grid
    options:
     - "Normal"
     - "Recommended On"
     - "Forced Off"
     - "Forced On"
    initial_option: "Normal"
    optimistic: true
    set_action:
      - logger.log:
          format: "Chosen option: %s"
          args: ["x.c_str()"]
    on_value:
      then:
      - lambda: |-
          if ( x == "Normal") {
            id(relay_1).turn_off();
            id(relay_2).turn_off();
          }
          else if ( x == "Recommended On") {
            id(relay_1).turn_on();
            id(relay_2).turn_off();
          }
          else if ( x == "Forced Off") {
            id(relay_1).turn_off();
            id(relay_2).turn_on();
          }
          else if ( x == "Forced On") {
            id(relay_1).turn_on();
            id(relay_2).turn_on();
          }

This configuration should generate a device with 3 entities:

  • one drop down which enable to select the smart grid setting (normal, recommended on, forced off, forced on)
  • a number input to enter the power value you want to simulate with the pulse (in watts)
  • a number input (default at 200 ms) to enter the length of the pulse you want to simulate (in ms)

when a power value other than 0 watts is entered, the ESP board starts to pulse the relay at the required frequency to generate 1000 pulses/ kWh.

On my ESP I use the GPIO 5, 13 and 15 to control the 3 relays, but you need to adapt this to the pins you use on your own board.

On the daikin the Smart Grid needs to be activated in the configuration:

  • “benefit kWh power supply” (menu item 9.8.4 for me) needs to be set to smart grid
  • “Limit setting kW” (menu item 9.8.8 for me) is on 0 (not sure this is really needed)
  • “Electricity meter 2” (menu item 9.A.2 for me) is set to “1000 pulses / kWh for PV panel”

Once you’ve plugged everything and configured a simulated power value, you need to let the pulse meter run for a good while (I think it took around 1h) for the heat pump to detect it. To check if it’s detected, you need to activate the smart grid to “recommended on” and then go to the information / operation modes menu to see what is the power limitation. Once it is detected, the heat pump seems to react well to changing the simulated power value (within 30 seconds here).

I’ve only managed to make it work today so maybe what is above will need to be adapted when I understand a bit better how it really works. Also at the moment I have not been able to test much since the heating / cooling is not needed here.

This is a very early test so what is above may not work well (or even at all) … and for the usual warning: if you tinker with your heat pump, there is risk of damage to it and I take no responsibility at all :sweat_smile:

The information above is mainly a compilation of the various posts I’ve read online from the ESPAltherma project , the P1P2MQTT project and from this post on ESPhome. Thanks to all of these super projects for enabling this fine control of my heat pump.