homeassistant-goecharger-mqtt icon indicating copy to clipboard operation
homeassistant-goecharger-mqtt copied to clipboard

Add MQTT API v1 support

Open alexebner opened this issue 3 years ago • 26 comments

I have configured the Go-Echarger that it ist connected to MQTT. I am seeing a topic ist created with "go-eCharger/001680/status". But the integration does not show any actie entity.

alexebner avatar Feb 23 '22 18:02 alexebner

Do you use the default topic prefix or did you change something?

syssi avatar Feb 23 '22 18:02 syssi

I have used the default topic in the integration

alexebner avatar Feb 23 '22 18:02 alexebner

Perfect! Do you have a linux machine around to verify there is some traffic at the broker

apt-get install mosquitto-clients
mosquitto_sub -h HOSTNAME -u USERNAME -P PASSWORD -t '/go-eCharger/#' -v

syssi avatar Feb 23 '22 18:02 syssi

grafik

alexebner avatar Feb 23 '22 18:02 alexebner

Oh no. This isn't the MQTT V2 API. I assume this is version 1 of the MQTT messages? Could you provide a full dump of the status message? Are there more topics available?

syssi avatar Feb 23 '22 18:02 syssi

The version 2 of the MQTT API looks like this:

$ mosquitto_sub '/go-eCharger/#' -v 
/go-eCharger/072246/alw true
/go-eCharger/072246/acu 16
/go-eCharger/072246/adi true
/go-eCharger/072246/dwo null
/go-eCharger/072246/tpa 0
/go-eCharger/072246/eto 0
/go-eCharger/072246/ccw {"ssid":""}
/go-eCharger/072246/dns {"dns":"0.0.0.0"}
/go-eCharger/072246/rssi -45
/go-eCharger/072246/utc "2022-02-23T18:59:35.789.101"
/go-eCharger/072246/loc "2022-02-23T19:59:35.790.289 +01:00"
/go-eCharger/072246/lbr 29
/go-eCharger/072246/lmo 3
/go-eCharger/072246/ama 16
/go-eCharger/072246/clp [6,10,12,14,16]
/go-eCharger/072246/bac true
/go-eCharger/072246/lbp null
/go-eCharger/072246/amp 16
/go-eCharger/072246/cid "#0000FF"
/go-eCharger/072246/cwc "#FFFF00"
/go-eCharger/072246/cch "#00FFFF"
/go-eCharger/072246/cfi "#00FF00"
/go-eCharger/072246/ust 1
/go-eCharger/072246/fsp false
/go-eCharger/072246/acs 0
/go-eCharger/072246/frc 0
/go-eCharger/072246/rbc 9
/go-eCharger/072246/rbt 447980504
/go-eCharger/072246/car 1
/go-eCharger/072246/err 0
/go-eCharger/072246/cbl 32
/go-eCharger/072246/pha [false,false,false,true,false,false]
/go-eCharger/072246/wh 0
/go-eCharger/072246/trx null
/go-eCharger/072246/fwv "053.1"
/go-eCharger/072246/cdi {"type":1,"value":0}
/go-eCharger/072246/lccfi null
/go-eCharger/072246/lccfc null
/go-eCharger/072246/lcctc null
/go-eCharger/072246/tma [21.625,26.625]
/go-eCharger/072246/amt 32
/go-eCharger/072246/nrg [219,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0]
/go-eCharger/072246/modelStatus 15
/go-eCharger/072246/lmsc 190015373
/go-eCharger/072246/mca 10
/go-eCharger/072246/awp 21
/go-eCharger/072246/awcp {"start":1645639200,"end":1645642800,"marketprice":23.686}
/go-eCharger/072246/att 21600
/go-eCharger/072246/ate 18000
/go-eCharger/072246/ara true
/go-eCharger/072246/pgrid null
/go-eCharger/072246/ppv null
/go-eCharger/072246/pakku null
/go-eCharger/072246/deltap 0
/go-eCharger/072246/var 11
/go-eCharger/072246/spl3 4200
/go-eCharger/072246/psm 2
/go-eCharger/072246/ocu ["052.2","053.0 BETA","053.1 BETA","V 051.9 OUTDATED","V 052.0 OUTDATED","V 052.1 OUTDATED"]
/go-eCharger/072246/fhz 49.897
/go-eCharger/072246/loa null
/go-eCharger/072246/cards [{"name":"User 1","energy":0,"cardId":true},{"name":"User 2","energy":0,"cardId":false},{"name":"User 3","energy":0,"cardId":false},{"name":"User 4","energy":0,"cardId":false},{"name":"User 5","energy":0,"cardId":false},{"name":"User 6","energy":0,"cardId":false},{"name":"User 7","energy":0,"cardId":false},{"name":"User 8","energy":0,"cardId":false},{"name":"User 9","energy":0,"cardId":false},{"name":"User 10","energy":0,"cardId":false}]
/go-eCharger/072246/men false
/go-eCharger/072246/dll "https://data.v3.go-e.io/export?e=redacted"
/go-eCharger/072246/hla false
/go-eCharger/072246/lri null
/go-eCharger/072246/lrc null
/go-eCharger/072246/lrr null

syssi avatar Feb 23 '22 19:02 syssi

It seems that i have no posibility to activate MQTT V2 API.

Hardware Version2 Firmware 041.0

alexebner avatar Feb 23 '22 19:02 alexebner

Could you dump and provide some messages? I would like to support V1 if possible.

syssi avatar Feb 23 '22 19:02 syssi

In my case it's hardware version 3 and firmware version 053.1.

syssi avatar Feb 23 '22 19:02 syssi

In the topic status is:

{"version":"B","tme":"2302222012","rbc":"140","rbt":"2822520","car":"4","amp":"10","err":"0","ast":"0","alw":"1","stp":"0","cbl":"20","pha":"56","tmp":"10","dws":"10450","dwo":"0","adi":"0","uby":"0","eto":"72152","wst":"3","txi":"2","nrg":[227,228,227,2,0,0,0,0,0,0,0,0,0,0,0,0],"fwv":"041.0","sse":"001680","wss":"my-priv.at","wke":"********","wen":"1","cdi":"0","tof":"101","tds":"1","lbr":"201","aho":"3","afi":"7","azo":"0","ama":"16","al1":"0","al2":"0","al3":"0","al4":"0","al5":"0","cid":"16711932","cch":"16711723","cfi":"65280","lse":"1","ust":"2","wak":"","r1x":"2","dto":"0","nmo":"0","sch":"AAAAAAAAAAAAAAAA","sdp":"0","eca":"0","ecr":"0","ecd":"0","ec4":"0","ec5":"0","ec6":"0","ec7":"0","ec8":"0","ec9":"0","ec1":"0","rca":"96D4A2D3","rcr":"","rcd":"","rc4":"","rc5":"","rc6":"","rc7":"","rc8":"","rc9":"","rc1":"","rna":"","rnm":"","rne":"","rn4":"","rn5":"","rn6":"","rn7":"","rn8":"","rn9":"","rn1":"","loe":0,"lot":0,"lom":0,"lop":0,"log":"","lon":0,"lof":0,"loa":0,"lch":2684} 

alexebner avatar Feb 23 '22 19:02 alexebner

root@ae-nas01:~# mosquitto_sub -h ******** -u ****** -P ****** -t 'go-eCharger/#' -v
go-eCharger/001680/status {"version":"B","tme":"2302222016","rbc":"140","rbt":"3079975","car":"4","amp":"10","err":"0","ast":"0","alw":"1","stp":"0","cbl":"20","pha":"56","tmp":"10","dws":"10450","dwo":"0","adi":"0","uby":"0","eto":"72152","wst":"3","txi":"2","nrg":[226,228,227,1,0,0,0,0,0,0,0,0,0,0,0,0],"fwv":"041.0","sse":"001680","wss":"my-priv.at","wke":"********","wen":"1","cdi":"0","tof":"101","tds":"1","lbr":"201","aho":"3","afi":"7","azo":"0","ama":"16","al1":"0","al2":"0","al3":"0","al4":"0","al5":"0","cid":"16711932","cch":"16711723","cfi":"65280","lse":"1","ust":"2","wak":"","r1x":"2","dto":"0","nmo":"0","sch":"AAAAAAAAAAAAAAAA","sdp":"0","eca":"0","ecr":"0","ecd":"0","ec4":"0","ec5":"0","ec6":"0","ec7":"0","ec8":"0","ec9":"0","ec1":"0","rca":"96D4A2D3","rcr":"","rcd":"","rc4":"","rc5":"","rc6":"","rc7":"","rc8":"","rc9":"","rc1":"","rna":"","rnm":"","rne":"","rn4":"","rn5":"","rn6":"","rn7":"","rn8":"","rn9":"","rn1":"","loe":0,"lot":0,"lom":0,"lop":0,"log":"","lon":0,"lof":0,"loa":0,"lch":2942}
go-eCharger/001680/status {"version":"B","tme":"2302222016","rbc":"140","rbt":"3084989","car":"4","amp":"10","err":"0","ast":"0","alw":"1","stp":"0","cbl":"20","pha":"56","tmp":"9","dws":"10450","dwo":"0","adi":"0","uby":"0","eto":"72152","wst":"3","txi":"2","nrg":[227,227,227,2,0,0,0,0,0,0,0,0,0,0,0,0],"fwv":"041.0","sse":"001680","wss":"my-priv.at","wke":"********","wen":"1","cdi":"0","tof":"101","tds":"1","lbr":"201","aho":"3","afi":"7","azo":"0","ama":"16","al1":"0","al2":"0","al3":"0","al4":"0","al5":"0","cid":"16711932","cch":"16711723","cfi":"65280","lse":"1","ust":"2","wak":"","r1x":"2","dto":"0","nmo":"0","sch":"AAAAAAAAAAAAAAAA","sdp":"0","eca":"0","ecr":"0","ecd":"0","ec4":"0","ec5":"0","ec6":"0","ec7":"0","ec8":"0","ec9":"0","ec1":"0","rca":"96D4A2D3","rcr":"","rcd":"","rc4":"","rc5":"","rc6":"","rc7":"","rc8":"","rc9":"","rc1":"","rna":"","rnm":"","rne":"","rn4":"","rn5":"","rn6":"","rn7":"","rn8":"","rn9":"","rn1":"","loe":0,"lot":0,"lom":0,"lop":0,"log":"","lon":0,"lof":0,"loa":0,"lch":2947}
go-eCharger/001680/status {"version":"B","tme":"2302222016","rbc":"140","rbt":"3090005","car":"4","amp":"10","err":"0","ast":"0","alw":"1","stp":"0","cbl":"20","pha":"56","tmp":"9","dws":"10450","dwo":"0","adi":"0","uby":"0","eto":"72152","wst":"3","txi":"2","nrg":[227,227,227,1,0,0,0,0,0,0,0,0,0,0,0,0],"fwv":"041.0","sse":"001680","wss":"my-priv.at","wke":"********","wen":"1","cdi":"0","tof":"101","tds":"1","lbr":"201","aho":"3","afi":"7","azo":"0","ama":"16","al1":"0","al2":"0","al3":"0","al4":"0","al5":"0","cid":"16711932","cch":"16711723","cfi":"65280","lse":"1","ust":"2","wak":"","r1x":"2","dto":"0","nmo":"0","sch":"AAAAAAAAAAAAAAAA","sdp":"0","eca":"0","ecr":"0","ecd":"0","ec4":"0","ec5":"0","ec6":"0","ec7":"0","ec8":"0","ec9":"0","ec1":"0","rca":"96D4A2D3","rcr":"","rcd":"","rc4":"","rc5":"","rc6":"","rc7":"","rc8":"","rc9":"","rc1":"","rna":"","rnm":"","rne":"","rn4":"","rn5":"","rn6":"","rn7":"","rn8":"","rn9":"","rn1":"","loe":0,"lot":0,"lom":0,"lop":0,"log":"","lon":0,"lof":0,"loa":0,"lch":2952}
go-eCharger/001680/status {"version":"B","tme":"2302222016","rbc":"140","rbt":"3095019","car":"4","amp":"10","err":"0","ast":"0","alw":"1","stp":"0","cbl":"20","pha":"56","tmp":"9","dws":"10450","dwo":"0","adi":"0","uby":"0","eto":"72152","wst":"3","txi":"2","nrg":[228,228,228,2,0,0,0,0,0,0,0,0,0,0,0,0],"fwv":"041.0","sse":"001680","wss":"my-priv.at","wke":"********","wen":"1","cdi":"0","tof":"101","tds":"1","lbr":"201","aho":"3","afi":"7","azo":"0","ama":"16","al1":"0","al2":"0","al3":"0","al4":"0","al5":"0","cid":"16711932","cch":"16711723","cfi":"65280","lse":"1","ust":"2","wak":"","r1x":"2","dto":"0","nmo":"0","sch":"AAAAAAAAAAAAAAAA","sdp":"0","eca":"0","ecr":"0","ecd":"0","ec4":"0","ec5":"0","ec6":"0","ec7":"0","ec8":"0","ec9":"0","ec1":"0","rca":"96D4A2D3","rcr":"","rcd":"","rc4":"","rc5":"","rc6":"","rc7":"","rc8":"","rc9":"","rc1":"","rna":"","rnm":"","rne":"","rn4":"","rn5":"","rn6":"","rn7":"","rn8":"","rn9":"","rn1":"","loe":0,"lot":0,"lom":0,"lop":0,"log":"","lon":0,"lof":0,"loa":0,"lch":2957}
go-eCharger/001680/status {"version":"B","tme":"2302222016","rbc":"140","rbt":"3100029","car":"4","amp":"10","err":"0","ast":"0","alw":"1","stp":"0","cbl":"20","pha":"56","tmp":"9","dws":"10450","dwo":"0","adi":"0","uby":"0","eto":"72152","wst":"3","txi":"2","nrg":[227,228,228,1,0,0,0,0,0,0,0,0,0,0,0,0],"fwv":"041.0","sse":"001680","wss":"my-priv.at","wke":"********","wen":"1","cdi":"0","tof":"101","tds":"1","lbr":"201","aho":"3","afi":"7","azo":"0","ama":"16","al1":"0","al2":"0","al3":"0","al4":"0","al5":"0","cid":"16711932","cch":"16711723","cfi":"65280","lse":"1","ust":"2","wak":"","r1x":"2","dto":"0","nmo":"0","sch":"AAAAAAAAAAAAAAAA","sdp":"0","eca":"0","ecr":"0","ecd":"0","ec4":"0","ec5":"0","ec6":"0","ec7":"0","ec8":"0","ec9":"0","ec1":"0","rca":"96D4A2D3","rcr":"","rcd":"","rc4":"","rc5":"","rc6":"","rc7":"","rc8":"","rc9":"","rc1":"","rna":"","rnm":"","rne":"","rn4":"","rn5":"","rn6":"","rn7":"","rn8":"","rn9":"","rn1":"","loe":0,"lot":0,"lom":0,"lop":0,"log":"","lon":0,"lof":0,"loa":0,"lch":2962}

alexebner avatar Feb 23 '22 19:02 alexebner

Thanks!

syssi avatar Feb 23 '22 19:02 syssi

{
   "adi" : "0",
   "afi" : "7",
   "aho" : "3",
   "al1" : "0",
   "al2" : "0",
   "al3" : "0",
   "al4" : "0",
   "al5" : "0",
   "alw" : "1",
   "ama" : "16",
   "amp" : "10",
   "ast" : "0",
   "azo" : "0",
   "car" : "4",
   "cbl" : "20",
   "cch" : "16711723",
   "cdi" : "0",
   "cfi" : "65280",
   "cid" : "16711932",
   "dto" : "0",
   "dwo" : "0",
   "dws" : "10450",
   "ec1" : "0",
   "ec4" : "0",
   "ec5" : "0",
   "ec6" : "0",
   "ec7" : "0",
   "ec8" : "0",
   "ec9" : "0",
   "eca" : "0",
   "ecd" : "0",
   "ecr" : "0",
   "err" : "0",
   "eto" : "72152",
   "fwv" : "041.0",
   "lbr" : "201",
   "lch" : 2942,
   "loa" : 0,
   "loe" : 0,
   "lof" : 0,
   "log" : "",
   "lom" : 0,
   "lon" : 0,
   "lop" : 0,
   "lot" : 0,
   "lse" : "1",
   "nmo" : "0",
   "nrg" : [
      226,
      228,
      227,
      1,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0
   ],
   "pha" : "56",
   "r1x" : "2",
   "rbc" : "140",
   "rbt" : "3079975",
   "rc1" : "",
   "rc4" : "",
   "rc5" : "",
   "rc6" : "",
   "rc7" : "",
   "rc8" : "",
   "rc9" : "",
   "rca" : "96D4A2D3",
   "rcd" : "",
   "rcr" : "",
   "rn1" : "",
   "rn4" : "",
   "rn5" : "",
   "rn6" : "",
   "rn7" : "",
   "rn8" : "",
   "rn9" : "",
   "rna" : "",
   "rne" : "",
   "rnm" : "",
   "sch" : "AAAAAAAAAAAAAAAA",
   "sdp" : "0",
   "sse" : "001680",
   "stp" : "0",
   "tds" : "1",
   "tme" : "2302222016",
   "tmp" : "10",
   "tof" : "101",
   "txi" : "2",
   "uby" : "0",
   "ust" : "2",
   "version" : "B",
   "wak" : "",
   "wen" : "1",
   "wke" : "********",
   "wss" : "my-priv.at",
   "wst" : "3"
}

syssi avatar Feb 23 '22 19:02 syssi

https://github.com/goecharger/go-eCharger-API-v1/blob/master/go-eCharger%20API%20v1%20DE.md#parameter

syssi avatar Feb 24 '22 17:02 syssi

Hi syssi, i would love to see V1-support too. Are there any news about that or can i do anything to help you with the implementation?

alexkiddde avatar Jun 26 '22 19:06 alexkiddde

The most exhausting part of the job is a the entity description per API key. You could help by providing these blocks:

https://github.com/syssi/homeassistant-goecharger-mqtt/blob/main/custom_components/goecharger_mqtt/definitions/sensor.py#L130-L139

We need one description per Home Assistant entity. You can find all API v2 definitions here:

https://github.com/syssi/homeassistant-goecharger-mqtt/tree/main/custom_components/goecharger_mqtt/definitions

syssi avatar Jun 26 '22 19:06 syssi

Hi, I also have API Version v1. All entities are unavailable, but I don't understand why. Because some API Calls are the same between v1 and v2.

For example, the reboot counter: image

v1 docu: image

v2: docu: image

Maybe someone can provide an example API Key for v1, and with this information I can try to start with the other api keys. Is it possible to start a new definition file in the definition directory? Like sensors_v1.py ?

Thanks.

cnu80 avatar Jul 14 '22 08:07 cnu80

Some of the API keys are equal and some are different. The implementation of the API v1 will also be different because the values can be retrieved as bundle (json object) from a single topic. At the API v2 each api key has an dedicated topic.

syssi avatar Jul 14 '22 09:07 syssi

I seem to have also this version. Any progress on this?

hiekkis123 avatar Jan 18 '23 18:01 hiekkis123

It seems that i have no posibility to activate MQTT V2 API.

Hardware Version2 Firmware 041.0

got the same hardware and firmware combination. would be great, having v1 api supported.

Thanks in advance and regards

Jakob

JakobTewes avatar Apr 11 '23 20:04 JakobTewes

Same problem here V1 support would be fantastic :)

peregrines2 avatar May 08 '23 07:05 peregrines2

As a workaround you can configure the go-e charger V1 to use the MQTT Server you may already have running on HomeAssistant and grab the essential values from there. Example mqtt.yaml is attached (you need to merge with your existing mqqt.yaml if you already use mqtt sensors). Replace 012345 with serial number of your charger. mqtt.yaml.txt

rolandsteinmeyer avatar May 10 '23 13:05 rolandsteinmeyer

thanks for sharing @rolandsteinmeyer. looks promising and can maybe be expanded with other sensors/switches :-)

JakobTewes avatar May 10 '23 20:05 JakobTewes

There seems to be another integration for the v1 (but not v2) API.

https://github.com/cathiele/homeassistant-goecharger

Maybe that can be useful in some way for implementing the V1 API?

eikowagenknecht avatar Sep 06 '23 13:09 eikowagenknecht

I went back to exactly this integration @eikowagenknecht and it works really great.

JakobTewes avatar Sep 06 '23 16:09 JakobTewes

@JakobTewes But this integration has no controlling features :-( I have a HW-V2 with firmware 0.41 here to ... no V2 API support here :cry:

+1 for V1 API Support :pray:

Edit: Bought a HW-V3 and dont regret it :grimacing:

rene-bayer avatar Oct 13 '23 07:10 rene-bayer