smlx / goodwe-exporters

Prometheus Exporters for Goodwe Energy Monitors (smart meters) and Solar Inverters
Apache License 2.0
13 stars 0 forks source link

Point the DNS of tcp.goodwe-power.com to the IP of the exporter; or #55

Open Sn0w3y opened 7 months ago

Sn0w3y commented 7 months ago

Does not work globally as if we do so we get:

sems_mitm_exporter: error: couldn't resolve "tcp.goodwe-power.com:20001": lookup tcp.goodwe-power.com on 192.168.178.1:53: no such host

smlx commented 7 months ago

Ah yes. It isn't clear in the README, but the idea is to selectively spoof DNS only for certain clients (i.e. the Goodwe device).

I have my IoT stuff isolated on 192.168.18.0/24 so here's a snippet showing how I do this with Knot:

-- send goodwe hardware to mitm
modules = { 'view' }
view:addr('192.168.18.0/24',
  policy.suffix(
    policy.ANSWER(
        { [kres.type.A] = { rdata=kres.str2ip('192.168.16.8'), ttl=300 } }
    ),
    { todname('tcp.goodwe-power.com') }
  )
)

This approach does require that you have a reasonably configurable local DNS server.

I'll update the README to explain this better.

Sn0w3y commented 7 months ago

BTW: I have another topic on another GoodWe and Chinese Inverter also using the LPT270 amd LPT370 and LPT100

Maybe we can set up something else for other Inverters aswell together?

@smlx Could you please be so kind and somehow message me ? :)

FYI: https://github.com/Sn0w3y/goodwe-battery-exporter

Greetings