question

dolflombard avatar image
dolflombard asked

Openevse Car charger reading MQTT values from CCGX

I have an Openevse charger and I use its MQTT to read from my Colour Control so it can control the charge current.

The problem is I cannot "see" the right value I can use.

Can someone point me in the right direction? I need to see the values for when I am exporting excess power into the grid.


Thanks

Dolf


MQTT
1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

dolflombard avatar image dolflombard commented ·

Ok I found the problem.

My charger sees the right values but can only interpret a numeric value like =745 not the value that it gets from the CCGX in this format "{"value": 745.60000000000002}"

How do I translate or strip that away for it to only see =754.

I setup a flow on node-red to get the value and post it back again but cannot yet get value in the right format.

tx for any help.

0 Likes 0 ·
2 Answers
Stefanie avatar image
Stefanie answered ·

You should be able to add some javascript within your node, using

Math.trunc()

That should return the integer part of a number by removing the fractional numbers.

I highly recommend to visit the Node-Red Forum. Plenty of very helpful people there.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

dolflombard avatar image
dolflombard answered ·

I got it sorted.

Here is my solution if anybody want to try something similar.

I injected a mqtt publish value to CCGX broker to keep it alive with 60s intervals.

I then subscribed to the value I needed and used the change function to strip the Json format to end up with the value I needed, I then published it back to the CCGX broker with topic openevsebridge/power to create a new value so my openevse charger could read from there. The Charger also injected its topics. I highlighted it below.

Below is how the charger adapts the charge current according to my Solar power. The Solar value obviously changed since I took the above screenshots.

I would actually want to use the value of my excess power which I am grid-feeding but the problem I have is that our power producer has scheduled loadsheddings to manage demand and then that reading falls away and my solar generation falls to what my current consumption is.

This was a dummy' solution as I got lost with the python code. Node-red is a winner!


node-red.jpg (63.0 KiB)
ccgx-broker.jpg (109.9 KiB)
openevsecc.jpg (13.3 KiB)
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.