[myenergi] MyEnergi Binding

logo

myenergi Binding

This binding allows openHAB to communicate with the public API from myenergi Ltd. (https://myenergi.info), a manufacturer of electric vehicle chargers (Zappi) and solar energy diverters (Eddi):

  • Retrieval of current energy readings (grid, solar, EV charger)
  • Control charging status and boost modes for Zappi
  • Control of Eddi manual boost

This binding has been tested with a Harvi, a Zappi and an Eddi.

Supported Things

This binding supports the following thing types

Thing Thing Type Discovery Description
bridge Bridge Manual A single connection to the myenergi API
eddi Thing Automatic A solar energy diverter
zappi Thing Automatic An EV Charger (EVSE)
harvi Thing Automatic A remote power clamp reader

Discovery

Once the bridge is configured with myenergi username and password, the various devices will be discovered automatically and added to the Inbox.

Thing Configuration

Manual configuration

For the identifier of the devices, the corresponding serial number is used.

Bridge myenergi:bridge:api "MyEnergi API Bridge" [ username="<my username>", password="<my password>", refreshInterval=24 ] {
  Thing zappi 21287642 "MyEnergi Zappi" [ refreshInterval=30 ]
  Thing harvi 87263212 "MyEnergi Harvi" [ refreshInterval=30 ]
}

Channels

The following channels are defined. Except for the bridge refresh channel, all are read-only.

Bridge

none

Zappi

channel type description
lastUpdatedTime DateTime The time the readings have last been updated.
supplyVoltage Number:ElectricPotential The supply voltage to the Zappi
supplyFrequency Number:Energy The amount of energy measured by the clamp.
numberOfPhases Number The identifier of the phase (for 3-phase installations).
lockingMode Number Indicates when the connector to the EV is locked in position
chargingMode Number Boost, Fast, Eco, Eco+ or Stop
status Number Describes what the charger is doing
plugStatus String Describes state of connection to EV
commandTries Number 0-10 Trying, 253 Failed, 254 OK, 255 No command sent
diverterPriority Number Priority for solar energy relative to other myenergy devices
minimumGreenLevel Number Minimum proportion of solar energy used
gridPower Number:Power Power taken from grid
generatedPower Number:Power Power gererated by solar panels
divertedPower Number:Power power used by charger
chargeAdded Number:Energy charge added in this or the last charing session
smartBoostTime Number length of time for smart boost
smartBoostCharge Number:Energy charge added by smart boost
timedBoostTime Number length of time of timed boost
timedBoostCharge Number:Energy charge added by timed boost
clampName1 String A name for the clamp (set through app, e.g. “Solar Generation”.
clampPower1 Number:Power The power measured by the clamp.
clampName2 String A name for the clamp (set through app, e.g. “Solar Generation”.
clampPower2 Number:Power The power measured by the clamp.
clampName3 String A name for the clamp (set through app, e.g. “Solar Generation”.
clampPower3 Number:Power The power measured by the clamp.
clampName4 String A name for the clamp (set through app, e.g. “Solar Generation”.
clampPower4 Number:Power The power measured by the clamp.
clampName5 String A name for the clamp (set through app, e.g. “Solar Generation”.
clampPower5 Number:Power The power measured by the clamp.
clampName6 String A name for the clamp (set through app, e.g. “Solar Generation”.
clampPower6 Number:Power The power measured by the clamp.

Eddi

channel type description
lastUpdatedTime DateTime The time the readings have last been updated.
supplyVoltage Number:ElectricPotential The supply voltage to the Eddi
supplyFrequency Number:Frequency The supply frequency to the Eddi
status String describes whet the Eddi is currently doing
diverterPriority Number Priority for solar energy relative to other myenergy devices
phase Number Number of phases
gridPower Number:Power Power taken from grid
boostMode String Boost ON or OFF
energyTransferred Number:Energy Energy transferred to heater today
generatedPower Number:Power Power generated by solar panels
divertedPower Number:Power Power consumed by heater(s)
consumedPower Number:Power Power consumed by whole installation
boostRemaining Number time left for current boost
activeHeater Number the heater no currently in use
heaterPriority Number the heater no to be used first
heaterName1 String the name of the heater
heaterName2 String the name of the heater
temperature1 Number the temperature (in Celsius) of water tank 1
temperature2 Number the temperature (in Celsius) of water tank 2
clampName1 String A name for the clamp (set through app, e.g. “Solar Generation”.
clampPower1 Number:Energy The amount of energy measured by the clamp.
clampName2 String A name for the clamp (set through app, e.g. “Solar Generation”.
clampPower2 Number:Energy The amount of energy measured by the clamp.
clampName3 String A name for the clamp (set through app, e.g. “Solar Generation”.
clampPower3 Number:Energy The amount of energy measured by the clamp.

Harvi

channel type description
lastUpdatedTime DateTime The time the readings have last been updated.
clampName1 String A name for the clamp (set through app, e.g. “Solar Generation”.
clampPower1 Number:Energy The amount of energy measured by the clamp.
clampPhase1 Number The identifier of the phase (for 3-phase installations).
clampName2 String A name for the clamp (set through app, e.g. “Solar Generation”.
clampPower2 Number:Energy The amount of energy measured by the clamp.
clampPhase2 Number The identifier of the phase (for 3-phase installations).
clampName3 String A name for the clamp (set through app, e.g. “Solar Generation”.
clampPower3 Number:Energy The amount of energy measured by the clamp.
clampPhase3 Number The identifier of the phase (for 3-phase installations).

Actions

Zappi
setChargingMode(ZappiChargingMode chargingMode)
setTimedBoost(int slot, DayOfWeek dayOfWeek, int startHour, int startMinute, Duration duration)

Eddi
setBoost(int heater, int duration)
cancelBoost(int heater)

Examples

myenergi.things

Bridge myenergi:bridge:api "MyEnergi API Bridge" [ username="<my username>", password="<my password>", refreshInterval=24 ] {
  Thing zappi 21287642 "MyEnergi Zappi" [ refreshInterval=30 ]
  Thing harvi 87263212 "MyEnergi Harvi" [ refreshInterval=30 ]
}

myenergi.items

Group                    dgMyEnergi [ "Equipment" ]

DateTime                 Zappi_LastUpdatedTime    "MyEnergi Zappi Last Updated Time [%1$td.%1$tm.%1$tY %1$tH:%1$tM:%1$tS]" <time>    (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:lastUpdatedTime" }
Number:ElectricPotential Zappi_SupplyVoltage      "MyEnergi Zappi Supply Voltage [%.1f %unit%]"                            <energy>  (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:supplyVoltage" }
Number:Frequency         Zappi_SupplyFrequency    "MyEnergi Zappi Supply Frequency [%.1f %unit%]"                          <energy>  (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:supplyFrequency" }
Number                   Zappi_NumberOfPhases     "MyEnergi Zappi Number of Phases [%d]"                                   <energy>  (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:numberOfPhases" }
Number                   Zappi_LockingMode        "MyEnergi Zappi Locking Mode [%d]"                                                 (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:lockingMode" }
String                   Zappi_ChargingMode       "MyEnergi Zappi Charging Mode [%s]"                                                (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:chargingMode" }
String                   Zappi_Status             "MyEnergi Zappi Status [%s]"                                                       (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:status" }
String                   Zappi_PlugStatus         "MyEnergi Zappi Plug Status [%s]"                                                  (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:plugStatus" }
Number                   Zappi_CommandTries       "MyEnergi Zappi Command Tries [%d]"                                                (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:commandTries" }
Number                   Zappi_DiverterPriority   "MyEnergi Zappi Diverter Priority [%d]"                                            (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:diverterPriority" }
Number                   Zappi_MinimumGreenLevel  "MyEnergi Zappi Minimum Green Level [%d %%]"                                       (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:minimumGreenLevel" }
Number:Power             Zappi_GridPower          "MyEnergi Zappi Grid Power [%.1f %unit%]"                                <energy>  (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:gridPower" }
Number:Power             Zappi_GeneratedPower     "MyEnergi Zappi Generated Power [%.1f %unit%]"                           <energy>  (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:generatedPower" }
Number:Power             Zappi_DivertedPower      "MyEnergi Zappi Diverted Power [%.1f %unit%]"                            <energy>  (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:divertedPower" }
Number:Energy            Zappi_ChargeAdded        "MyEnergi Zappi Charge Added [%.1f %unit%]"                              <energy>  (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:chargeAdded" }
String                   Zappi_SmartBoostTime     "MyEnergi Zappi Smart Boost Time [%s]"                                   <time>    (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:smartBoostTime" }
Number:Energy            Zappi_SmartBoostCharge   "MyEnergi Zappi Smart Boost Charge [%.1f %unit%]"                        <energy>  (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:smartBoostCharge" }
String                   Zappi_TimedBoostTime     "MyEnergi Zappi Timed Boost Time [%s]"                                   <time>    (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:timedBoostTime" }
Number:Energy            Zappi_TimedBoostCharge   "MyEnergi Zappi Timed Boost Charge [%.1f %unit%]"                        <energy>  (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:timedBoostCharge" }
String                   Zappi_ClampName1         "MyEnergi Zappi Clamp Name 1 [%s]"                                                 (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:clampName1" }
Number:Power             Zappi_ClampPower1        "MyEnergi Zappi Clamp Power 1 [%.1f %unit%]"                             <energy>  (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:clampPower1" }
String                   Zappi_ClampName2         "MyEnergi Zappi Clamp Name 2 [%s]"                                                 (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:clampName2" }
Number:Power             Zappi_ClampPower2        "MyEnergi Zappi Clamp Power 2 [%.1f %unit%]"                             <energy>  (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:clampPower2" }
String                   Zappi_ClampName3         "MyEnergi Zappi Clamp Name 3 [%s]"                                                 (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:clampName3" }
Number:Power             Zappi_ClampPower3        "MyEnergi Zappi Clamp Power 3 [%.1f %unit%]"                             <energy>  (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:clampPower3" }
String                   Zappi_ClampName4         "MyEnergi Zappi Clamp Name 4 [%s]"                                                 (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:clampName4" }
Number:Power             Zappi_ClampPower4        "MyEnergi Zappi Clamp Power 4 [%.1f %unit%]"                             <energy>  (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:clampPower4" }
String                   Zappi_ClampName5         "MyEnergi Zappi Clamp Name 5 [%s]"                                                 (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:clampName5" }
Number:Power             Zappi_ClampPower5        "MyEnergi Zappi Clamp Power 5 [%.1f %unit%]"                             <energy>  (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:clampPower5" }
String                   Zappi_ClampName6         "MyEnergi Zappi Clamp Name 6 [%s]"                                                 (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:clampName6" }
Number:Power             Zappi_ClampPower6        "MyEnergi Zappi Clamp Power 6 [%.1f %unit%]"                             <energy>  (dgMyEnergi)  { channel="myenergi:zappi:api:21287642:clampPower6" }

DateTime                 Harvi_LastUpdatedTime    "MyEnergi Harvi Last Updated Time [%1$td.%1$tm.%1$tY %1$tH:%1$tM:%1$tS]" <time>    (dgMyEnergi)  { channel="myenergi:harvi:api:87263212:lastUpdatedTime" }
String                   Harvi_ClampName1         "MyEnergi Harvi Clamp Name 1 [%s]"                                                 (dgMyEnergi)  { channel="myenergi:harvi:api:87263212:clampName1" }
Number:Power             Harvi_ClampPower1        "MyEnergi Harvi Clamp Power 1 [%.1f %unit%]"                             <energy>  (dgMyEnergi)  { channel="myenergi:harvi:api:87263212:clampPower1" }
Number                   Harvi_ClampPhase1        "MyEnergi Harvi Clamp Phase 1 [%d]"                                      <energy>  (dgMyEnergi)  { channel="myenergi:harvi:api:87263212:clampPhase1" }
String                   Harvi_ClampName2         "MyEnergi Harvi Clamp Name 2 [%s]"                                                 (dgMyEnergi)  { channel="myenergi:harvi:api:87263212:clampName2" }
Number:Power             Harvi_ClampPower2        "MyEnergi Harvi Clamp Power 2 [%.1f %unit%]"                             <energy>  (dgMyEnergi)  { channel="myenergi:harvi:api:87263212:clampPower2" }
Number                   Harvi_ClampPhase2        "MyEnergi Harvi Clamp Phase 2 [%d]"                                      <energy>  (dgMyEnergi)  { channel="myenergi:harvi:api:87263212:clampPhase2" }
String                   Harvi_ClampName3         "MyEnergi Harvi Clamp Name 3 [%s]"                                                 (dgMyEnergi)  { channel="myenergi:harvi:api:87263212:clampName3" }
Number:Power             Harvi_ClampPower3        "MyEnergi Harvi Clamp Power 3 [%.1f %unit%]"                             <energy>  (dgMyEnergi)  { channel="myenergi:harvi:api:87263212:clampPower3" }
Number                   Harvi_ClampPhase3        "MyEnergi Harvi Clamp Phase 3 [%d]"                                      <energy>  (dgMyEnergi)  { channel="myenergi:harvi:api:87263212:clampPhase3" }

Changelog

Version 0.4

  • support for openHAB 4.x (tested with 4.1)

Version 0.3

  • support for Zappi STOP charging mode

Version 0.2

  • support for Eddi Solar Diverter
  • writable channel for Zappi Charging Mode and corresponding Action

Version 0.1

  • initial release

Resources

JAR (Version 0.4): org.openhab.binding.myenergi-4.2.0-SNAPSHOT.jar

JAR (Version 0.3): org.openhab.binding.myenergi-3.4.3-SNAPSHOT.jar

Sources: (https://github.com/renescherer/openhab-addons/tree/myenergi_binding/bundles/org.openhab.binding.myenergi)

2 Likes

Thanks!

Looks stable after some hrs running on openHAB 3.3.0 (harvi and two zappi).

I did try to initialize a manual boost over e.g. 5 kwh. I can set a boost charge (energy), but how to start the manual boost? Is there something missing in the API? Thx!

Hello,
I´m a new user from OpenHAB. Could you please help me? How can I install the Binding in OpenHAB 3.3.0? I cannot find the Binding on the System. Which files do I need and in wich folder I have to copy it?

Steffen
Copy the jar file linked above to /usr/share/openhab/addons. Seems to work for me on OpenHAB 3.3.0 but I do have a problem which I’m about to post a question about.

I’ve installed this binding on OpenHAB 3.3.0. I have an eddi and harvi with the eddi acting as the gateway (the latest eddi model has network connectivity built in). I can configure the bridge (although the app password didn’t work - I got a new API key through my myenergi account) and I then see the eddi and harvi in the inbox. I have sucessfully added the harvi as a thing and I’m able to monitor the power reported by the harvi*.

When I try to add the eddi as a thing I get the message “Error during thing creation: conflict”.

The log shows this:

2022-11-09 17:22:06.410 [ERROR] [nhab.core.thing.binding.ThingFactory] - Thing factory (class org.openhab.binding.myenergi.internal.MyEnergiHandlerFactory) returned null on create thing when it reports to support the thing type (myenergi:eddi).
2022-11-09 17:22:06.416 [WARN ] [g.discovery.internal.PersistentInbox] - Cannot create thing. No binding found that supports creating a thing of type myenergi:eddi.

I notice that if you try to add the eddi manually the binding doesn’t show the eddi in the list of devices.

*As an aside, I wonder how the harvi can report power if it has no way of measuring the voltage.

Thank you for the tip
I run OpenHAB in a Docker on a Synology. If I copy the Jar in Openhab\addons, I could not find the binding in Openhab. I have tried to restart, but nothing happend.

I can´t see the Binding if I want to add a thing.

To answer my own question, the code for supporting the Eddi is not in the sources linked above. Having a go at the code myself and so far can at least get an eddi thing added.

I’m able to readout all params and config, but cannot make adjustments – e.g. changing the charging mode from fast to eco.

Anyone else facing this issue as well, or is this a picnic problem?

Thanks for this binding.

Given its definitions, all values are read-only.

What I noticed is, that the clamp names are not presented by the relevant channels.

The API result:

2022-11-12 22:08:45.252 [INFO ] [.myenergi.internal.MyEnergiApiClient] - Api response: {"zappi":[{"sno":16181239,"dat":"12-11-2022","tim":"12:08:44","ectp2":36,"ectp3":-15,"ectt1":"Internal Load","ectt2":"Grid","ectt3":"Generation","bsm":0,"bst":0,"cmt":254,"div":0,"frq":50.02,"fwv":"3560S3.162","gen":-10,"grd":38,"pha":1,"pri":1,"sta":1,"tz":9,"vol":2444,"che":29.08,"bss":0,"lck":16,"pst":"B1","zmo":4,"pwm":1015,"zs":13570,"rdc":4,"rac":12,"zsh":53,"zsl":2,"ectt4":"None","ectt5":"None","ectt6":"None","mgl":50,"sbh":17,"sbk":5}]}

… as seen here:

The clamp numbering seems to go from 6 to 1, rather than the other way around.

In my case the clamps are 1 = grid, 2 = generation.

same here. not able to start any kind of charging proces

with the version 3.3 I could add things via OH3 standard way adding things via running bridge.

can you find the brigde within the add things dialogue?

Tx. Am using curl requests for now to change charging mode and boost setting.

2 Likes

oh, cool. thx. how does it work? do you have an example? thanks in advance!

now I find the bridge in the Thing dialog. But By the Binding Installation I get an error.

When I create the Bridge, I get the following error: Invalid API key or account number.
I use the Hub Serial Number and the correct password.

What could I do?

look under Findings at GitHub - twonk/MyEnergi-App-Api: Investigation of the MyEnergi App

Works for me.

Rene @scherer I’ve implemented support for the Eddi solar energy diverter and submitted a pull request.

My first time with GitHub, OpenHab code and Java so I hope what I’ve done makes sense.

1 Like

I had to create a new API key before my bridge could log in. The instruction to use the same credentials as you use with the phone app seem to be wrong. Make sure you have registered your products at myenergi account and then click on the Advanced button by your gateway product. Create a new API key and use that as your password.

thank you for your help, now with the new api key the binding works :smiley: :+1:

Thank you all, now the binding nd the Channels work, but I can´t transform the Value to kWh.
I tried

(function(i) {
   return parseFloat(i) / 100;
})(input)

but nothing happend. This code works for me for transformations with Temperature as a js file. Does somebody know how I can transform the value of the power to kWh?

Thanks for the great initiative on the MyEnergi Binding.
I’m testing it currently and trying to get the CT clamps monitored.
In the channels, I’m missing the clamps 1,2 and 3.

checking the latest THINGS.XML, I noticed that these are missing in there.
Is that correct

Zappi
MyEnergi Zappi device

	<channels>
		<channel id="lastUpdatedTime" typeId="lastUpdatedTimeType"/>
		<channel id="supplyVoltage" typeId="voltageType"/>
		<channel id="supplyFrequency" typeId="frequencyType"/>
		<channel id="numberOfPhases" typeId="numberOfPhasesType"/>
		<channel id="lockingMode" typeId="lockingModeType"/>
		<channel id="chargingMode" typeId="chargingModeType"/>
		<channel id="status" typeId="statusType"/>
		<channel id="plugStatus" typeId="plugStatusType"/>
		<channel id="commandTries" typeId="commandTriesType"/>
		<channel id="diverterPriority" typeId="diverterPriorityType"/>
		<channel id="minimumGreenLevel" typeId="minimumGreenLevelType"/>
		<channel id="gridPower" typeId="gridPowerType"/>
		<channel id="generatedPower" typeId="generatedPowerType"/>
		<channel id="divertedPower" typeId="divertedPowerType"/>
		<channel id="consumedPower" typeId="consumedPowerType"/>
		<channel id="chargeAdded" typeId="chargeType"/>
		<channel id="smartBoostTime" typeId="boostEndTimeType"/>
		<channel id="smartBoostCharge" typeId="chargeType"/>
		<channel id="timedBoostTime" typeId="boostEndTimeType"/>
		<channel id="timedBoostCharge" typeId="chargeType"/>
		<channel id="clampName4" typeId="CTType"/>
		<channel id="clampName5" typeId="CTType"/>
		<channel id="clampName6" typeId="CTType"/>
		<channel id="clampPower4" typeId="clampPowerTypeL4"/>
		<channel id="clampPower5" typeId="clampPowerTypeL5"/>
		<channel id="clampPower6" typeId="clampPowerTypeL6"/>
	</channels>