class
pylnlib.Sensor.Sensor(address, state=None)
Represents a sensor state.
Parameters
address— int The sensor address.state(optional) — The sensor state, one of {None, "ON", "OFF"}
Raises
ValueError— if the state is an unknown literal and not None.
method
toJSON()
Returns an object suitable for serialiazing as JSON.
Returns (dict)
A dictionary with the object attributes.
method
__str__()
Returns a string representation of a Sensor object.
Note
The address shown is 1 larger than the actual address as is customary. (The address is indeed offset 0, but modellers are not accustomed to that)
Returns (str)
the string representation of a Sensor object with its state and address.
method
__eq__(other)
Compares a Sensor object to another object.
Parameters
other(object) — any other object
Returns (bool)
True if sensor address and states are the same