This project provides an all-in-one solution to proxy and parse the data sent from an Enphase Envoy appliance to the Enphase server. Most of the classes in the non-envoy packages can be used in similar projects.
The project assumes deployment to a Unix platform but will work on any other platform that supports java with only minor modifications (i.e. path to the logging directory).
All external API dependencies are managed via maven, which is needed for compilation.
To re-direct communications from the Envoy appliance, iptables or similar is needed.
Out of the box, the project is configured to save data to a mysql database running on the same host as the proxy server. The project uses torque as the object-relational-model layer, which supports several other RDBMS.
Change the user name and password as well as the database name in both
pom.xml
andsrc/main/resources/torque.properties
.Generate the executable jar:
mvn package
Create the envoy database:
echo "create database envoy;" | mysql -u<user> -p<pass>
Generate the schema:
mvn sql:execute
You will need to set up an iptables REDIRECT
rule in order to
intercept the outbound connections:
iptables -t nat -A PREROUTING -s <your_envoy_address> \ -p tcp --dport 443 -j REDIRECT --to-ports 7777
This will accept packets from your Envoy to port 443 and redirect them to port 7777.
The main class in the one-jar jar generated in target/EnvoyProxyServer.jar
accepts the following run-time arguments:
Option Description ------ ----------- --help display help text --load-files load files from optional directory or default directory if none given --local-host local host address to bind to (default: localhost) --local-port <Integer> local port to listen to (default: 7777) --remote-url remote URL to proxy (default: https://reports.enphaseenergy.com) --spool-dir spool directory to save files to (default: /var/spool/envoy)
To execute, you may want to turn off one-jar logging completely:
java -Done-jar.silent=true -jar EnvoyProxyServer.jar --local-port 7777 \ --local-host 10.0.0.1
Many thanks to @larsks envoy-tools project, which gave me most of the information I needed to roll my own.