mkaiser / Sungrow-SHx-Inverter-Modbus-Home-Assistant

Sungrow SH Integration for Home Assistant for SH3K6, SH4K6, SH5K-20, SH5K-V13, SH3K6-30, SH4K6-30, SH5K-30, SH3.RS, SH3.6RS, SH4.0RS, SH5.0RS, SH6.0RS, SH5.0RT, SH6.0RT, SH8.0RT, SH10RT, SH5.0RT-20, SH6.0RT-20, SH8.0RT-20, SH10RT-20, SH5.0RT-V112, SH6.0RT-V112, SH8.0RT-V112, SH10RT-V112, SH5.0RT-V122, SH6.0RT-V122, SH8.0RT-V122, SH10RT-V122, SH4.6R
304 stars 79 forks source link

MAC Adress instead IP #245

Open mega-hz opened 5 months ago

mega-hz commented 5 months ago

Hi Martin,

can you manage it one can use instead of IP-Adress of ModbusTCP to use the MAC Adress? In secrets.yaml ?

The reason i recommend this : When Fritzbox DHCP give new IP Adresses to some Devices and Sungrow becomes a different one, the whole Integration won't work anymore.

Another option could be to let search for AC:19:9F:::** so it would find it itself?

regards, Wolfram.

jhegewald commented 5 months ago

Hi Wolfram,

You can configure your Fritzbox in a way, that it always assigns the same IP to the Sungrow inverter. (Heimnetz > Netzwerk then pick the device and you can select that option under "Adressen im Heimnetz").

Best, Jan

mega-hz @.***> schrieb am Mi., 31. Jan. 2024, 19:56:

Hi Martin,

can you manage it one can use instead of IP-Adress of ModbusTCP to use the MAC Adress? In secrets.yaml ?

The reason i recommend this : When Fritzbox DHCP give new IP Adresses to some Devices and Sungrow becomes a different one, the whole Integration won't work anymore.

Another option could be to let search for AC:19:9F:::** so it would find it itself?

regards, Wolfram.

— Reply to this email directly, view it on GitHub https://github.com/mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant/issues/245, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMSMDKIPM5RYU63SBTCNVFTYRKHVRAVCNFSM6AAAAABCTSUK32VHI2DSMVQWIX3LMV43ASLTON2WKOZSGEYTANZWGEZDINI . You are receiving this because you are subscribed to this thread.Message ID: @.*** com>

mega-hz commented 5 months ago

Hi, i know this way. at my place i made right that. But at my neighbour that fritzbox doesn’t support this button.

Would it be possible to use mac?

Regards, Wolfram. Von: jhegewald @.> Gesendet: Mittwoch, 31. Januar 2024 22:56 An: mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant @.> Cc: mega-hz @.>; Author @.> Betreff: Re: [mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant] MAC Adress instead IP (Issue #245)

Hi Wolfram,

You can configure your Fritzbox in a way, that it always assigns the same IP to the Sungrow inverter. (Heimnetz > Netzwerk then pick the device and you can select that option under "Adressen im Heimnetz").

Best, Jan

mega-hz @. <mailto:@.> > schrieb am Mi., 31. Jan. 2024, 19:56:

Hi Martin,

can you manage it one can use instead of IP-Adress of ModbusTCP to use the MAC Adress? In secrets.yaml ?

The reason i recommend this : When Fritzbox DHCP give new IP Adresses to some Devices and Sungrow becomes a different one, the whole Integration won't work anymore.

Another option could be to let search for AC:19:9F:::** so it would find it itself?

regards, Wolfram.

— Reply to this email directly, view it on GitHub https://github.com/mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant/issues/245, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMSMDKIPM5RYU63SBTCNVFTYRKHVRAVCNFSM6AAAAABCTSUK32VHI2DSMVQWIX3LMV43ASLTON2WKOZSGEYTANZWGEZDINI . You are receiving this because you are subscribed to this thread.Message ID: @. <mailto:@.>
com>

— Reply to this email directly, view it on GitHub https://github.com/mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant/issues/245#issuecomment-1920041490 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBI7E6BFTCMFZAGNXJU3MTYRK4VXAVCNFSM6AAAAABCTSUK32VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRQGA2DCNBZGA . You are receiving this because you authored the thread. https://github.com/notifications/beacon/AFBI7EY5RWY3NYQ7FWFH4BTYRK4VXA5CNFSM6AAAAABCTSUK32WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTSOGBBE.gif Message ID: @. @.> >

mega-hz commented 5 months ago

maybe HA can scan for the MAC-Adress and change it in secrets.yaml?

mega-hz commented 5 months ago

BTW: wird die secrets.yaml nur einmal eingelesen oder regelmäßig?

mkaiser commented 4 months ago

hi,

the YAML is only parsed on HA startup (or if you select the restart option to only parse yaml).

The modbus integration does not support devices by mac address. So unfortunately, there is no way to make the MAC <> IP mapping by Home assistant.

For finding devices in my network, I often use the freeware "Zenmap" (a GUI for nmap)

Gnarfoz commented 1 month ago

A MAC address is not a replacement for an IP address, they work on different levels of the networking stack. Scanning for MAC addresses, resolving them (ARP), and using the result could work, but only on the same network segment. That would be far beyond the scope of a YAML-configuration-based integration like this and would require quite a bit of extra logic.

If your router does not offer an option to always assign the same IP address to a device (odd, haven't heard of Fritz!Box models that don't have this option), you can go the other way: Configure your inverter to use a static IP address instead of DHCP. I think the way to do that is to connect to the local WiFi hotspot the WiNet-S dongle provides, log into the interface there (admin / pw8888) and change the inverter's network configuration to a fixed address. Ideally, make sure this address is outside of the IP range the router uses for DHCP. You can change that range on Fritz!Boxes.

(Also: maybe that particular Fritz!Box is on an older Fritz!OS version and you first need to activate the advanced mode in the UI? I'm not sure if that particular setting is hidden behind that mode. Maybe check the vendor documentation.)