abrlox / home-assistant-phoenix-ev-charger

Home Assistant Integration for communicating with Phoenix Contact EV Charge Controllers found e.g. in ESL "Walli LIGHT" and "Walli LIGHT pro" wallboxes. Communication s done via Modbus TCP.
MIT License
2 stars 1 forks source link

Add switch for Enabling/Disabling Charging #5

Open abrlox opened 3 years ago

abrlox commented 3 years ago

This should be usable via Hass, so automations can do this (e.g. time controlled) Until now, the complete integration is viewer only.

wills106 commented 3 years ago

Did you manage to work out how to implement switches?

I'm working on a Solar Inverter over Modbus integration and need to add switches as well, so I was wondering if you have any code to share yet?

nhondong commented 6 months ago

do you know what to send via modbus, so that we can enable / disable charging? i even would like to set the maximum ampere.

nhondong commented 6 months ago

I am not that familiar with integrating switches into homeassistant, but this code enables charging:

from pymodbus.client import ModbusTcpClient

client = ModbusTcpClient(host=host, port=port, timeout=5)
client.connect()

chargestate_data = client.read_coils(address=400,count=1,slave=0)
charging = chargestate_data.bits[0]
if charging != True:
    writingregdata = client.write_coil(address=400,value=True)

I will try my best to get this into your code and create a pull request ;)

nhondong commented 6 months ago

I created a pull request. For my EV Charger (Wallbe Pro 22kw) this works fine.