My New Motion integration EV Charging from Shell newmotion

Thanks! Also working fine for me again :slight_smile:

Hello,

Here below the way I integrated the NewMotion Advanced 3.0 with DPM module, version with 1 x CT, to Home assistant.

The explanation is quite long, but the hardware and integration are quite short/simple.

Note that if any damages occurs, you might lose the warranty, however, it works very fine for me for a while now.

Good to know before starting: What is a CT?

[Wikipedia] → A Current Transformer is a type of transformer that is used to reduce or multiply an alternating current. It produces a current in its secondary which is proportional to the current in its primary. Current transformers, along with voltage or potential transformers, are instrument transformers.

The Dynamic Power Module

While using the DPM option, the charging station is checking that the current going through the CT at the grid connection doesn’t exceed the Max Current (Defined by your installer or Shell based on your breakers - in my case 40A for the main breaker and 32A breaker for the charging station)
If the current is exceeding the Max current, the changing station current will be progressively reduced to achieve stability (Current through the CT [house current, incl. charging current] = Max current)

E.g: Charging 32A (7.4kW - 230V) + switching ON a load of 10A (2.3kW - 230V) = 42A which is higher than the 40A.
The charger will then decrease the charging current (Called “Limited now”)
→ If the Max Current is not reached, then the charging power is increased until reaching stability or its maximum. (In my case 32A)

When connected by Ethernet cable, the “Max” and “Limited now” currents can be accessed on the charging station. There are a couple of posts explaining how to reach to the data in the My New Motion topic here above.

The integration
Since I didn’t found any available software integration, nor any option on the Shell Recharge App (or official Shell solution), I tested some hardware integrations. The easier/most efficient for me was to simulate a current which will be measured by the DPM.
I’m pretty sure there is also a possibility to replace the DPM by a Ethernet to RS485 converter to make direct communication with the charger, but I didn’t explore this way.

As the CT is generating an AC current to the DPM, I made some tests with generating AC currents. I abandoned this idea when I saw that the DPM was also working with DC currents, which is easier to generate.

As Xemex is warning on Page 7/13 of the datasheet, the DPM can be burned if too much current flows through it. (Very important)
Here the datasheet (The DPM module comes from Xemex)
CSMB - Current Sense Modbus Converter | Xemex

The CT has the following spec : Current range 1A … 80A (if CT ratio = 2000)
The max current going through the DPM with the original CT would be: 80A/2000= 0,040A AC = 40mA AC

Another important thing to know is that it is not allowed to disconnect a CT when current is flowing through its primer. (First remove the CT from the cable, then disconnect the CT wires)
See explanation on the video : Why you should never disconnect current transformer from burden resistor when current is at primary - YouTube

How I make the current? - The Hardware

  • 1 x Stabilized Power Supply DC 24v
    A coil transformer is not suitable as the output voltage will move up and down with the rest the installation.
    The HDR15-24 makes its job: Amazon Parent: MeanWell Series HDR-15. : Amazon.de: DIY & Tools

  • 1 x Shelly RGBW2
    This will generate a pulse voltage (PWM - 24V at 100% and less when the brightness % is decreased)
    See datasheet - Shelly RGBW2
    The OUTPUT of the RGBW2 is the Negative side (Important)
    The 4-white-channels mode is used

  • 1 x 1000 Ohm resistor - 2W
    The value must be close to 1kOhm, mine is just below 1kOhm
    The standard small resistors are getting hot due to the current passing through. (Therefore 2W)
    The resistor will reduce the Voltage/current at the entry of the DPM (Very important to not burn the DPM)

  • 1 x 67uF capacitor - I took a 63V as the voltage will go about 24V and I had this in stock
    I’m not sure this capacitor is absolutely necessary, but I preferred to use it to smooth the PWM of the Shelly

  • 1 x Fuse (Not in the drawing here below - Can be good to protect the DPM :slight_smile: )

I had an old shelly housing (burned Shelly) So I put the resistor and the capacitor inside.

Before connecting the “Home made device”, I would strongly advise to check its working without the DPM first, to be sure it is working as expected and not to burn the DPM.
To test it, a 200 Ohm resistor should be used between the OUTPUTS of the “Home made device” to simulate the DPM (See arrow on the drawings here above) I also put in series with this 200 Ohm, a current meter. About 0mA to 20mA will be read, depending the brightness % of the Shelly.

image

When all Ok, it can be connected to the DPM. There is no direction for both wires there.

When the brightness % of the Shelly is increased (Channel W - it’s channel #4) the green LED “GRID” on the DPM will start to flash. The more the current is, the longer the LED remains lighted in is 1 second cycle.

Integration in Home Assistant.

  1. Installation of the Shelly (Update to last firmware if required)
  2. Installation of the reading of the NewMotion charging station through the Ethernet cable.
    See in previous posts, here above

Useful data to have on the HA dashboard

  1. Make an automation which will control the brightness of the Shelly in order to achieve the desired charging power

As explained earlier, the DPM module expects to read the Grid current.
The automation will simulate this current and based on this, the charging station will reduce or higher the charging current.
→ In other words, its not possible to tell which charging current (power) is wanted but this power will be reached by simulating available GRID current or too high GRID current with the Shelly)

The % of brightness which would higher and lower the current of the charging station must first be searched manually (The car must be connected and charging)
In my case, a brightness of 76% gives a charging current almost stable.
→ The % will depend on the exact voltage of the stabilized 24VDC power supply and of the resistor (±1k Ohm)

Based on the Brightness value, helpers and automation can be done.
Example of Automation YALM (Not my last version - I don’t have access to it right now)
In Brief

  1. There is a Manual mode (useful to avoid high capacitive cost by fixing a defined charging power)
  2. There is a Sun Charging mode (Useful to charge only on sun power. In this case the power from the solar panels are set as setpoint (Small offset is included)
  3. The Green mode is not working yet. (I didn’t spend much time on it but as far as I remember, it was not working due to the difference in refresh time of the different measurement devices)
  4. The Brightness value is updated each second and is defined by the difference between the setpoint and the New Motion Power Limit (The NMPL is the power to which the charging station is tending to go. It’s quick but not immediate).
    To have a good reactivity, I work with 9 different brightness values (See table) Overall, I’m impressed by the reactivity of the system
  5. Important to know:
    • For starting the charge, the brightness value should be low, in my case 50% and this must be stable for a couple second prior to start regulation.
    • To idle the charge, the brightness * should be kept high (E.g 86% - No need to go at max)
    • In case of Sun charging, there must be a minimum charging power defined to avoid the frequent charging Idle/start cycles in case of cloudy weather (Not in the Yalm example here below)
    • The car should be compatible with regulated charging power (Probably the case for most recent cars)

alias: NewMotion Regulation WORKING
description: ""
trigger:
  - platform: time_pattern
    seconds: /1
    enabled: true
condition:
  - condition: state
    entity_id: sensor.evcharger_nmha_carstatus
    enabled: false
    state: Charging
    for:
      hours: 0
      minutes: 0
      seconds: 5
action:
  - choose:
      - conditions:
          - condition: template
            value_template: >-
              {{states('input_number.newmotion_manual_setpoint_power') |int  -
              (states('sensor.newmotion_charging_power_limit') |int) > 75}}
          - condition: template
            value_template: >-
              {{states('input_number.newmotion_manual_setpoint_power') |int  -
              (states('sensor.newmotion_charging_power_limit') |int) < 149}}
        sequence:
          - service: light.turn_on
            data:
              brightness_pct: 75
            target:
              entity_id: light.shellyrgbw2_2c78ec_channel_4
          - service: input_number.set_value
            data:
              value: 75
            target:
              entity_id: input_number.newmotion_shelly_soc
      - conditions:
          - condition: template
            value_template: >-
              {{states('input_number.newmotion_manual_setpoint_power') |int  -
              (states('sensor.newmotion_charging_power_limit') |int) > 150}}
          - condition: template
            value_template: >-
              {{states('input_number.newmotion_manual_setpoint_power') |int  -
              (states('sensor.newmotion_charging_power_limit') |int) < 499}}
        sequence:
          - service: light.turn_on
            data:
              brightness_pct: 73
            target:
              entity_id: light.shellyrgbw2_2c78ec_channel_4
          - service: input_number.set_value
            data:
              value: 73
            target:
              entity_id: input_number.newmotion_shelly_soc
      - conditions:
          - condition: template
            value_template: >-
              {{states('input_number.newmotion_manual_setpoint_power') |int  -
              (states('sensor.newmotion_charging_power_limit') |int) > 500}}
          - condition: template
            value_template: >-
              {{states('input_number.newmotion_manual_setpoint_power') |int  -
              (states('sensor.newmotion_charging_power_limit') |int) < 1499}}
        sequence:
          - service: light.turn_on
            data:
              brightness_pct: 70
            target:
              entity_id: light.shellyrgbw2_2c78ec_channel_4
          - service: input_number.set_value
            data:
              value: 70
            target:
              entity_id: input_number.newmotion_shelly_soc
              
      - conditions:
          - condition: template
            value_template: >-
              {{states('input_number.newmotion_manual_setpoint_power') |int  -
              (states('sensor.newmotion_charging_power_limit') |int) > 1500}}
        sequence:
          - service: light.turn_on
            data:
              brightness_pct: 50
            target:
              entity_id: light.shellyrgbw2_2c78ec_channel_4
          - service: input_number.set_value
            data:
              value: 50
            target:
              entity_id: input_number.newmotion_shelly_soc
      - conditions:
          - condition: template
            value_template: >-
              {{states('input_number.newmotion_manual_setpoint_power') |int  -
              (states('sensor.newmotion_charging_power_limit') |int) < -75}}
          - condition: template
            value_template: >-
              {{states('input_number.newmotion_manual_setpoint_power') |int  -
              (states('sensor.newmotion_charging_power_limit') |int) > -149}}
        sequence:
          - service: light.turn_on
            data:
              brightness_pct: 77
            target:
              entity_id: light.shellyrgbw2_2c78ec_channel_4
          - service: input_number.set_value
            data:
              value: 77
            target:
              entity_id: input_number.newmotion_shelly_soc
      - conditions:
          - condition: template
            value_template: >-
              {{states('input_number.newmotion_manual_setpoint_power') |int  -
              (states('sensor.newmotion_charging_power_limit') |int) < -150}}
          - condition: template
            value_template: >-
              {{states('input_number.newmotion_manual_setpoint_power') |int  -
              (states('sensor.newmotion_charging_power_limit') |int) > -499}}
        sequence:
          - service: light.turn_on
            data:
              brightness_pct: 79
            target:
              entity_id: light.shellyrgbw2_2c78ec_channel_4
          - service: input_number.set_value
            data:
              value: 79
            target:
              entity_id: input_number.newmotion_shelly_soc
      - conditions:
          - condition: template
            value_template: >-
              {{states('input_number.newmotion_manual_setpoint_power') |int  -
              (states('sensor.newmotion_charging_power_limit') |int) < -500}}
          - condition: template
            value_template: >-
              {{states('input_number.newmotion_manual_setpoint_power') |int  -
              (states('sensor.newmotion_charging_power_limit') |int) > -1999}}
        sequence:
          - service: light.turn_on
            data:
              brightness_pct: 82
            target:
              entity_id: light.shellyrgbw2_2c78ec_channel_4
          - service: input_number.set_value
            data:
              value: 82
            target:
              entity_id: input_number.newmotion_shelly_soc
      - conditions:
          - condition: template
            value_template: >-
              {{states('input_number.newmotion_manual_setpoint_power') |int  -
              (states('sensor.newmotion_charging_power_limit') |int) < -2000}}
        sequence:
          - service: light.turn_on
            data:
              brightness_pct: 86
            target:
              entity_id: light.shellyrgbw2_2c78ec_channel_4
          - service: input_number.set_value
            data:
              value: 86
            target:
              entity_id: input_number.newmotion_shelly_soc
    default:
      - service: light.turn_on
        data:
          brightness_pct: 76
        target:
          entity_id: light.shellyrgbw2_2c78ec_channel_4
        enabled: true
      - service: input_number.set_value
        data:
          value: 76
        target:
          entity_id: input_number.newmotion_shelly_soc
    enabled: true
  - choose:
      - conditions:
          - condition: state
            entity_id: input_select.charge_mode
            state: "Green charging "
        sequence:
          - service: input_number.set_value
            data:
              value: "{{states('sensor.max_power_newmotion')|float}}"
            target:
              entity_id: input_number.newmotion_manual_setpoint_power
      - conditions:
          - condition: state
            entity_id: input_select.charge_mode
            state: "Sun charging "
        sequence:
          - service: input_number.set_value
            data:
              value: "{{states('sensor.total_solar_power') |float -500 }}"
            target:
              entity_id: input_number.newmotion_manual_setpoint_power
    enabled: true
mode: single

Dear NMOptimization,

Many many thanks for write down your full approach in these posts. I must say this is quite a daunting project (it must have costed you quite some thinkering and time to get to this successfully! ), but i’m thinking of doing it anyway… too bad i only have place for one more module in my electrical cabinet… :slight_smile:

Kind regards,

Ben

1 Like

Feel free in case of questions :+1:

Regulation in action by cloudy day
→ Purple : Sun power
→ Orange: Setpoint Power (500W below Sun Power)
→ Dark blue: Effective charging power measured by Shelly EM

Hi all, Hi @NMOptimization ,
Your solution is pretty nice. It does what it’s supposed to do. However, I don’t really feel comfortable with the electronics involved so I opted for a slightly different technique to achieve the same result.

I created an ESPHome device that talks Modbus RTU to the Wallbox by emulating the Xemex CSMB.

I first created an Modbus client to pull all data from the Xemex CSMB so that I know - at a later stage - what to return to the Wallbox. That effort is documented here on Github.

Then I created a Modbus Server that emulates the Xemex CSMB. Link here. Once the Modbus Server is created, I used Automation based on NMoptimization created to configure charging speed.

It seems to work quiet well, although I still have ‘Unexplicable behaviour’. See the readme.

Best regards,
Thomas

Best regards,
Thomas

2 Likes

Great Job !!! Thanks also for sharing in details ! :slight_smile:

How did you choose/define the cycle time of your regulation? (4 seconds)

Did you connect to the NewMotion charger by Ethernet to collect the Max Current or you did without it?

When charging I can observe a minimum charging current of 8A before the charging process stops. Is it also the case for you? (Related to the charging station or my car?)

Fun facts the “Inexplicable behaviors”
→ Wrong labeling or trap for those who try to hack the system :wink:

Greetings,

Hi @NMOptimization ,

I first took over the setting used on your automation, but I noticed that I took some time for my charger/car to accept the new settings. Because of that, he would over-correct. On a side note, I think it’s better that the automation first sets the correct manual_setpoint_power and than adapts the charging speed. I just pushed that change. That might already help in the over-correction. I will do some tests to see if I can get the cycle down.

No, I didn’t open my charger to connect the Ethernet cable, so it’s a black box to me. But I know the real-time power consumption of my wallbox thanks to a Shelly 3EM sensor. I use it in the automation like this “sensor.shelly3em_laadpaal_power”.

Your question about the minimal charging current. Yes, I observe the same with 2 different brands of cars. In my automation I have that minimal power defined as a input_number.shellrecharge_min_setpoint_power. Tests have shown that I have to keep it on 2000. If lower than around 1800, the charging stops completely. That corresponds to 8A.

On the fun facts: yeah, really strange. Note that I also built a device to query the Xemex, so I know exactly what he returns. Still, I fail to understand it. I even having debugging on the UART set to enabled, just to make sure that the Shell Recharge is not querying any undocumented registers, but still… no idea.

i have exactly the same, found a solution yet?

Evening all, getting “Expired API Token”, followed by “Error! No Token” when running {“action”:“setup”}

Login details are correct, anyone else having issues?

Hi @thomase1234 ,

Did you had the opportunity to make your experience with your setup? (Lot of use?)

Are you fully satisfied or do you still think about some improvements?

Did you use it on days with cloudy spells?

Greetings

Did anybody try to read out the charging values directly from the modbus enable meter that sits INSIDE the charging pole? I believe it is this type and related code:

It would make the integration for this pole cheaper as no additional 3 phase meter would be required.

I don’t have the charger yet, but if you could talk modbus directly to the charger, by use of an esp32 of maybe another home automation, would you still require the actual DPM module?

Does the modbus communication need to be activated somehow by Shell or can you do that yourself or does it work out of the box?

1 Like

Hi @NMOptimization

I’m happy with the solution as it is right now. Earlier today I merged the latest changes into master.

The unexplicable behaviour that I experienced earlier is now fixed. All good now. Now it’s working very similar to your solution where it imitates a certain load on the CT. By going over the configured max ( 38 in my case ), the car starts to charge slower. By going under 38 Amps, the charge speed will increase again.

Best regards,
Thomas

Hi @hill2butt

I’m doing exactly what your explaining in this Github project. An ESP32 module that talks modbus to the charger.

Yes, Shell has to activate the modbus communication on the Charge pole and configure a max load. This needs to be done by the installer, or by the Shell helpdesk. AFAIK, you cannot do that yourself.

Best regards,
Thomas

Hi. I’m new to nodered. Got the @e35 stuff working. But now I’m stuck at the reading chargepole. I have connected it with a cable but how do I find the ip address?

hi Thomase,

Thank you for this write down. I have replicated your work and can confirm it is fully working. Many many thanks.

kind regards,

Ben

(a fellow Belgian trying to opmize their electricity costs… :slight_smile:

1 Like

hi Hill,

So no, you don’t need the DPM module anymore, this is fully taken over by the solution of Thomase (an ESP32 module with an RS485 module, that serves as a modbus server providing the values that are red by the charging pole).

Kind regards,

Ben

Hi,

I am trying to access the link provided by only receive the following picture:

Any idea why that is?