JuiceRescue / juicepassproxy

Proxy UDP requests to/from Juicebox EV chargers to MQTT discoverable by Home Assistant
Apache License 2.0
86 stars 12 forks source link

add extra option on documentation without changing DNS #50

Closed ivanfmartinez closed 5 months ago

ivanfmartinez commented 9 months ago

I'm still using the official homeassistant integration that is working, but I want to test this proxy without making changes to my juicebox device settings, because I still need the functionality of integration that allow to set maximum current (I use this to control charging current based on solar panel generation).

The documentation show 2 options https://github.com/snicker/juicepassproxy/blob/master/README.MD?plain=1#L28 , but there are a 3rd one without creating DNS and without changing data on the device

No need to configure an specific DNS entry or change juicebox to use different address, this option requires that router supports redirection and masquerade, and can easily disabled to return to direct use of enel x services.

What should be done :

# This are the mikrotik rules for my case
# 10.1.12.230 - juicebox
# 10.1.0.22 - juicepassproxy
add action=dst-nat chain=dstnat comment=juicebox dst-port=8042 protocol=udp src-address=10.1.12.230 to-addresses=10.1.0.22 to-ports=8042
#
add action=masquerade chain=srcnat comment=juicebox dst-address=10.1.0.22 dst-port=8042 protocol=udp src-address=10.1.12.230
Scott8586 commented 8 months ago

I also have this working via a pair of NAT rules: dst-nat+masquerade on an edgerouter x (without using UPDATE_UDPC). I can provide examples and screenshots of the rules GUI if desired. The only gotcha I encountered was having to stream_close the current open streams on the juicebox

Snuffy2 commented 5 months ago

Feel free to submit a PR explaining the alternate setup option in the readme.