The current Bridge, Light, Sensor, Group, and Scene classes have incorrect, inconsistent, or missing methods for their __repr__ and __str__ attributes. This PR adds consistency to those classes by defining a python-parseable __repr__ value **, and a human-readable __str__ value.
** NOTE: The __repr__ method is meant to return a string that represents that object in a serialized format. If done correctly, that string should be able to be fed back into python (e.g. via eval()) to recreate the original object instance with some level of usefulness. I didn't fully serialize the phue classes, but captured the most important values needed to recreate similar class instances from the __repr__ output.
The current
Bridge
,Light
,Sensor
,Group
, andScene
classes have incorrect, inconsistent, or missing methods for their__repr__
and__str__
attributes. This PR adds consistency to those classes by defining a python-parseable__repr__
value **, and a human-readable__str__
value.** NOTE: The
__repr__
method is meant to return a string that represents that object in a serialized format. If done correctly, that string should be able to be fed back into python (e.g. viaeval()
) to recreate the original object instance with some level of usefulness. I didn't fully serialize the phue classes, but captured the most important values needed to recreate similar class instances from the__repr__
output.Example output with the new methods in place: