The idea of this pull request is to improve periodic publishing to include lights, and also send the current state of light and sensor when connect/reconnect. This addresses #22
Changes:
Refactor publishing of sensors and lights to a method each.
_publish_sensor
_publish_light
Allowing to reuse in other parts of the code.
Refactor periodic publish to also publish lights state without
repeating code. Implementing logic to send in the given tele period.
Addition on _connect_forever sending of sensor and light states after
connecting. Therefore keeping the state in sync on reconnections.
If you agree with the changes I can update the readme to reflect this new configuration option. I'm willing to make the changes you consider appropriate in the code.
The idea of this pull request is to improve periodic publishing to include lights, and also send the current state of light and sensor when connect/reconnect. This addresses #22
Changes:
Refactor publishing of sensors and lights to a method each.
Allowing to reuse in other parts of the code.
Refactor periodic publish to also publish lights state without repeating code. Implementing logic to send in the given tele period.
Addition on _connect_forever sending of sensor and light states after connecting. Therefore keeping the state in sync on reconnections.
If you agree with the changes I can update the readme to reflect this new configuration option. I'm willing to make the changes you consider appropriate in the code.