OpenEVSE MQTT Device

I have an OpenEVSE with the older ESP8266 v2 WiFi module. Its HTTP API is a bit flakey but MQTT works fine. So I set up a custom device using MQTT discovery. Using an MQTT client like mosquitto_pub or MQTT Explorer send the following payloads to their respective topic.

Change the hexnumber to something unique. I used its MAC address.

Also if you have another topic prefix than ‘openevse’ then change that too.

The min and max of the pilot current might need to be changed for how much your circuit breaker can handle.

homeassistant/sensor/openevse-84f3eb948235/charge_current/config

{
	"name": "OpenEVSE charge current",
	"device": {
		"identifiers": [
			"openevse_84f3eb948235_mqtt"
		],
		"name": "OpenEVSE"
	},
	"device_class": "current",
	"unit_of_measurement": "A",
	"unique_id": "openevse-84f3eb948235-charge-current",
	"state_topic": "openevse/amp",
	"value_template": "{{ float(value) / 1000.0 }}",
	"icon": "mdi:ev-station"
}

homeassistant/sensor/openevse-84f3eb948235/state/config

{
	"name": "OpenEVSE state",
	"device": {
		"identifiers": [
			"openevse_84f3eb948235_mqtt"
		],
		"name": "OpenEVSE"
	},
	"unique_id": "openevse-84f3eb948235-state",
	"state_topic": "openevse/state",
	"value_template": "{% set evsestates = {'0':'unknown', '1':'not connected', '2':'connected', '3':'charging', '4':'vent required', '5':'diode check failed', '6':'gfci fault', '7':'no ground', '8':'stuck relay', '9':'gfci self-test failure', '10':'over temperature', '254':'sleeping', '255':'disabled'} %}{{ evsestates[value] if value in evsestates else 'unknown' }}",
	"icon": "mdi:ev-station"
}

homeassistant/sensor/openevse-84f3eb948235/total_energy/config

{
	"name": "OpenEVSE total energy",
	"device": {
		"identifiers": [
			"openevse_84f3eb948235_mqtt"
		],
		"name": "OpenEVSE"
	},
	"device_class": "energy",
	"state_class": "total_increasing",
	"unit_of_measurement": "kWh",
	"unique_id": "openevse-84f3eb948235-total-energy",
	"state_topic": "openevse/wh",
	"value_template": "{{ float(value) / 1000.0 }}",
	"icon": "mdi:ev-station"
}

homeassistant/number/openevse-84f3eb948235/pilot_current/config

{
	"name": "OpenEVSE pilot current",
	"device": {
		"identifiers": [
			"openevse_84f3eb948235_mqtt"
		],
		"name": "OpenEVSE"
	},
	"device_class": "current",
	"unit_of_measurement": "A",
	"unique_id": "openevse-84f3eb948235-pilot-current",
	"state_topic": "openevse/pilot",
	"command_topic": "openevse/rapi/in/$SC",
	"icon": "mdi:ev-station",
	"min": 6,
	"max": 16
}

homeassistant/button/openevse-84f3eb948235/disable/config

{
	"name": "OpenEVSE disable",
	"device": {
		"identifiers": [
			"openevse_84f3eb948235_mqtt"
		],
		"name": "OpenEVSE"
	},
	"unique_id": "openevse-84f3eb948235-disable",
	"command_topic": "openevse/rapi/in/$FD",
	"icon": "mdi:ev-station"
}

homeassistant/button/openevse-84f3eb948235/enable/config

{
	"name": "OpenEVSE enable",
	"device": {
		"identifiers": [
			"openevse_84f3eb948235_mqtt"
		],
		"name": "OpenEVSE"
	},
	"unique_id": "openevse-84f3eb948235-enable",
	"command_topic": "openevse/rapi/in/$FE",
	"icon": "mdi:ev-station"
}
1 Like

Hi Fredrik,

I’ve just got my OpenEVSE charger working. I’d anticipated using OCPP to control the charger from Home Assistant, but finding it flakey as. So moving on to see if MQTT is more stable.

The configuration you’ve given above is not familiar to me. Excusing my ignorance - where would I add this config?

Thanks.

The devil is in the details. “Using an MQTT client like mosquitto_pub or MQTT Explorer send the following payloads to their respective topic.”.

There is not a file or anywhere in the UI to put these snippets. You must publish them as payloads via MQTT. It is part of Home Assistant discovery protocol.

1 Like

Thanks Frederik, that’s clearly a detail I overlooked.

For your information, there is a quite compete mqtt based suite contributed by Mathieu Carbou
https://gist.github.com/mathieucarbou/92a3d5e0dc38d6b68aa1bdaf153a80c5