devctrl.gui.devices.get_dict_value#
- get_dict_value(value, d: dict)[source]#
Helper function gets a value from a dictionary. If the key does not exist, None is returned and an error is logged. This is intented to be used for the state_parser of StateSwitcher widgets to transform internal values to nicer strings, for example to turn ‘1’ and ‘0’ to ‘on’ and ‘off’.
Use this function over dict.get(<key>, None) because the log message might be helpful for debugging.