I am a bit wiser or – how to combine dictionaries and see what changed

I am a bit wiser or – how to combine dictionaries and see what changed

I currently had the problem of handling updates with partial settings of RGB lights through MQTT and HomeAssistant. As The setting has to be complete at all times in the running system, so my first solution were multiple if else clauses and changed flags. It works, but it is ugly and over-complicated. I didn’t use…

Is it a bird? Is it a plane? Nah – just a Python class behaving like a dictionary.
|

Is it a bird? Is it a plane? Nah – just a Python class behaving like a dictionary.

For a container class with a dictionary with config values (among other members) I wanted easy reading access as if it was a dict itself. For that you only have to implement the __getitem__ method. You can extend the provided dict functionality for your class if needed like the following: All but the update method…