MarshFlattsFarm / immerSUN-Proxy-Server

Source code and sample data for immerSUN solar power diverter data logging proxy server
0 stars 0 forks source link

Connection issue #1

Open telemarker73 opened 1 year ago

telemarker73 commented 1 year ago

Great work thanks. I installed the script, and already have an mqtt broker running for a project scraping data off my solis inverter. I set the bind address to my immerSun bridge link IP address And script reports error “cannot assign requested address”

If I leave it as default 0.0.0.0 - Error is “permission denied” I have a lot of network devices, ip cameras, a NAS server running several jails with separate IP

thanks Andrew

485869B6-EEAD-4F64-98EC-5738827E2AF3 277148C8-10A8-452E-84C5-69DE605C5C58

MarshFlattsFarm commented 1 year ago

Hi Andrew. The "permission denied" error means the user you are running the script as doesn't have permission to open UDP port 87. Since that port number is less than 1024, the script needs to run as "root" (e.g. via "sudo").

telemarker73 commented 1 year ago

Thanks for quick response it seems to be running now, but so far nothing being received by mosquito mqtt broker

A6501A63-2AF2-42F8-B04C-2C0C2B3E30CC 5C634C4D-BD53-4484-84F7-6B44C36424BE

MarshFlattsFarm commented 1 year ago

The phrase "artificially directed at this proxy server" in the script header comments sounds simple but needs a fair bit of set-up external to the script.

I'd forgotten how little supporting info I'd included in this repo - it was initially created so I could collaborate with someone else on the script development (who knew all the supporting background already).

There's a bit more background here: https://www.marshflattsfarm.org.uk/wordpress/?page_id=4785

telemarker73 commented 1 year ago

Aha OK So a fair bit of of additional work needed to get it up and running. It’s probably beyond my basic skills. I am an application engineer, but geologist by background, so have a lot to learn

telemarker73 commented 1 year ago

I see from you documents one needs to setup a firewall on the machine/ pi to grab the UDP packets and divert to proxy server. So yes a lot of other external work needed.

telemarker73 commented 1 year ago

I’m attempting to persist with getting your script to work, I assume you have it fully functioning on your setup ?

I envisage I need network setup like this

immerSun bridge > Ethernet cable > raspberry pi > wifi > router/internet

So the pi bridges between immerSun bridge and my internet router, and the pi runs firewall to divert the UDP packets.

I’ve been playing around with shorewall firewall on my pi, but not getting far yet. The pi will also run your script

MarshFlattsFarm commented 1 year ago

Here's a diagram I prepared a while back which might help explain how things are intended to work. The firewall needs to be on the network route between the immerLINK Bridge unit and the Internet, so could be on your main network router (that's what I do) or on a Pi if that's got 2 network interfaces and is acting as a Router for the immerLINK Bridge.

immerSun View

It has been working fine for my setup but has been a bit temperamental recently - not sure if that's due to issues on the immerSUN server end or not.

telemarker73 commented 1 year ago

Cheers that helps

I got my Pi setup as a router dhcp, and shoreall firewall running. The immerSun bridge connected LAN Ethernet to pi then wifi to my BT router and traffic still routed to immerSun server OK and viewable with immerSun “app”

but still nothing when I run your script getting to mosquitto Are there other steps ?

or maybe something I have done with forwarding in iptables messed it up..

I do notice the shore wall rule dnat IP for immerSun server gets modified by ip tables - do you see this ?

changes from 65.108.159.219

to static.219.159.108.65.clients.your-server.de. Which is funky, and doesn’t seem right .. As shown in photos below 2B429ED0-E6C7-4613-A68A-D7B3227A6AFA

0922C0FD-482D-49D7-883C-3CF8FAAAE591

B4B8F916-B407-40C6-9D89-768CFB8C751B

telemarker73 commented 1 year ago

Case closed 😍

got it working at last! Issue was the first picture on my last post, from guide I followed to set my pi up as a router, included some ip table config commands, which were made persistent which routed traffic from eth0 to wlan0 so all the immerSun traffic was fwd by that, and not my shorewall rule… Serves me right for following the guide without thinking about it…

Got it working yesterday the 15mins later broadband internet went down until this afternoon…

data being populated on my grafana dashboard now along with my solar inverter data.

55AFAFC4-44DE-4A42-BB60-420116798A9B ![Uploading 5F77F6A3-0430-4304-B2E0-460161C31F09.jpeg…]()

MarshFlattsFarm commented 1 year ago

Good work; glad to hear you got it working. Thanks for posting back here with the updates and the screenshots; it will help other people facing issues in the future.