Integrated Mennekes Amtron Xtra via Modbus

Hi,

took some time to integrate my Mennekes Amtron Xtra Wallbox via Modbus.
If you want to do the same, check my github repo.
https://github.com/mfaust78/AmtronXtraModbus

Feedback is welcome.

2 Likes

That is actually pretty cool, thanks @mfaust78. I have individual modbus sensors and it can indeed sometimes be a bit flaky so I may also try your approach with the structure!
And if you add the two holding registers below in the modbus sensors yaml, you can also modify Customer Current Limitation and change the Charge State from HA by just assigning the right values to these sensors (and with that I was actually able to implement surplus charging in HA via pyscript).

modbus:
  - name: Amtron
    type: tcp
    host: <PutYourAmtronIPhere>
    port: 502
    retry_on_empty: true
    retries: 1
    timeout: 10
    delay: 1
    sensors:
      - name: "Amtron Registers"
        address: 0x0300
        slave: 255
        scan_interval: 120
        lazy_error_count: 1
        input_type: input
        count: 38
        data_type: custom
        structure: ">2h15H22B10H"

      - name: "Amtron Customer Current Limitation"
        unique_id: amtron_customer_current_limitation
        slave: 255
        address: 0x0400
        count: 1
        data_type: uint16
        input_type: holding
        unit_of_measurement: A
        device_class: current

      - name: "Amtron Change Charge State"
        unique_id: amtron_change_charge_state
        slave: 255
        address: 0x0401
        count: 1
        data_type: uint16
        input_type: holding

P.S. any reason you didn’t include the charging session meter count at register at 0x030D-0x030E? I find that also interesting to know.

@whd Thanks for the addition of the two holing registers.I didn’t do that as my car is a bit flaky when Amtron restricts the current - works better if I set the current on the car. I’ll add it to github.

0x030D-0x030E is included. I just used a bit shorter name: “Amtron Energy”.
Works nicely on the HA energy dashboard as individual device to know how much energy was used for charing.

1 Like

Hi,
just tried to use your code and added it in the configuration.yaml.
I own a AMTRON Premium, Software 1.13 is installed, latest HA version installed as well. Amtron IP in your code is set.

I edited the configuration.yaml before successfully for other reasons … i think i did i right this time, too.
nevertheless … i see this errors.
do you have an idea why this is not working?


Logger: homeassistant.config
Source: config.py:1294
First occurred: 3:31:27 AM (1 occurrences)
Last logged: 3:31:27 AM

Invalid config for ‘modbus’ at configuration.yaml, line 27: required key ‘baudrate’ not provided, please check the docs at Modbus - Home Assistant Invalid config for ‘modbus’ at configuration.yaml, line 27: required key ‘bytesize’ not provided, please check the docs at Invalid config for ‘modbus’ at configuration.yaml, line 27: required key ‘method’ not provided, please check the docs at Invalid config for ‘modbus’ at configuration.yaml, line 27: required key ‘parity’ not provided, please check the docs at Invalid config for ‘modbus’ at configuration.yaml, line 27: required key ‘stopbits’ not provided, please check the docs at https Modbus - Home Assistant Invalid config for ‘modbus’ at configuration.yaml, line 28: not a valid value for dictionary value ‘modbus->0->type’, got ‘tcp’, please check the docs at Invalid config for ‘modbus’ at configuration.yaml, line 29: ‘host’ is an invalid option for ‘modbus’, check: modbus->0->host, please check the docs at Invalid config for ‘modbus’ at configuration.yaml, line 31: ‘retry_on_empty’ is an invalid option for ‘modbus’, check: modbus->0->retry_on_empty, please check the docs at /integrations/modbus Invalid config for ‘modbus’ at configuration.yaml, line 48: Amtron Current Limitation: count illegal with data_type: uint16 ‘modbus->0->sensors->1’, got {‘name’: ‘Amtron Current Limitation’, ‘unique_id’: ‘amtron_current_limitation’, ‘slave’: 255, ‘address’: 1024, ‘count’: 1, ‘data_type’: ‘uint16’, ‘input_type’: ‘holding’, ‘unit_of_measurement’: ‘A’, ‘device_class’: ‘current’}, please check the docs at integrations/modbus Invalid config for ‘modbus’ at configuration.yaml, line 57: Amtron Change Charge State: count illegal with data_type: uint16 ‘modbus->0->sensors->2’, got {‘name’: ‘Amtron Change Charge State’, ‘unique_id’: ‘amtron_change_charge_state’, ‘slave’: 255, ‘address’: 1025, ‘count’: 1, ‘data_type’: ‘uint16’, ‘input_type’: ‘holding’}, please check the docs at

configuration.yaml screenshot