richibrics / IoTuring

Your Windows, Linux, macOS computer as MQTT and HomeAssistant integration
https://pypi.org/project/IoTuring/
GNU General Public License v3.0
82 stars 6 forks source link

App settings again #90

Closed infeeeee closed 6 months ago

infeeeee commented 11 months ago

This PR monster will be separated to smaller separate requests:

Changes:

Changes for existing users:

Secondary Update interval is commented out yet. I figured out that you cannot change the update interval on sensor level, only on entity level, and I think it would make more sense if it could be changed on a sensor level. That way an entity could have one frequent sensor and one infrequent. What do you think?

Retry #84

TODO: ~- [x] Logging starts with a default log level before loading the configuration~ ~- [x] After config loaded log level changes to the one in setting~ ~- [x] Add setting to enable/disable file logging~ ~- [x] Add setting for path to logdir~ ~- [x] Logging should be saved to some cache at the beginning. If file logging is enabled, save the cache to file, so nothing is lost. If file logging is not enabled drop the cache.~ ~- [ ] Implement secondary update interval in some sensors.~

infeeeee commented 10 months ago

@richibrics Take a look, I think it's working now. I copied the code for the default Logs folder paths from #61

I will update the top posts with listing what actually changed. E.g. you can edit settings in the UI now.

richibrics commented 9 months ago

Hi @infeeeee , sorry for the late reply. I though I wanted to check if what I did in the Path configuration classes was correct but I have never found the time for it unfortunately. Do you think we could integrate the classes I was preparing or keep them away for now ?

infeeeee commented 9 months ago

Keep them away for now.

I'm not sure they are needed at all, simply using pathlib solves most of the problems, and I use it everywhere where I have to work with paths. But let's see at the end.

infeeeee commented 9 months ago

Rewrote ClassManager.

Settings work similarly to Warehouses and Entities. Settings are loaded to the SettingsManager singleton on startup, entities can ask configuration from there. Log settings loaded separately to Logger.

@richibrics Take look, I consider this ready to be pulled now.

infeeeee commented 9 months ago

@richibrics This PR grew huge. Should I separate it to smaller ones, so it's easier to review? I can create 2 or maybe 3 smaller PRs instead of this beast. What do you think?

richibrics commented 9 months ago

Well if it's splittable it would be better for the understanding, but is it doable ?

infeeeee commented 9 months ago

Yes, I think I can separate to these parts:

I won't close this so I can track changes in the other PRs.