Is it possible to close a port e.g.502 opened on startup solar.yaml config, LIVE

Hi,

Is it possible to run a modified yaml file live from HA, via a button or something, without using settings & restarting HA, full or just configs.

I am reading modbus information for my data logger & Solis solar inverter.
Get all the data great (using fboundy github excellent work).

It opens port 502 on HA startup in config.yaml & solis.yaml.

However 502 can only be accessed by one method at a time, So HA has control.

I would like to open the same port & inverter information using python script & pymodbus but it is refused as already open.

Ideally would like to click on a HA page & e.g. press a button & this port & inverter close & cease to read the information. I would think if possible by reloading a yaml but guess this is very unlikely to work without a restart?
Ideally an option then to reload without a restart.

I suspect I am asking something impossible & unusual but would be great.

My other option & not too keen on, is I think the inverter/data logger can send mqtt information, use this somehow to be sent to HA to read the information as if coming from the inverter direct. I don’t have mqtt server set up yet (not sued before) Not sure yet if this ties up the port also or if can be relatively easily read into HA.

Thanks I/A

Bear in mind that I do not use Solis and had never heard of it before your post, however I’m gonna try to answer your questions:

MQTT uses port 1883, so you should be fine on that aspect. As to whether it can be easily read with HA, provided your inverter lets you change the MQTT topic, then it should be able to communicate with HA.

Alternatively, there seem to be 2 custom integrations for Solis in HACS (which you would also have to install).