Adding setpoint control
As a first step to turn your coordinator into a thermostat, you will need some way to control the setpoints. In this example, a single setpoint for the entire house is used, but it should be easy to add one per room and adapt the code to check each room temperature against the appropriate setpoint.
To store the setpoint, create a new channel in Beebotte called House
. Inside, add a Setpoint
resource, using the temperature
type from the dropdown.
For this resource, you should enable the Send on Subscribe (SoS) option. Normally, when you subscribe to a resource, you will only receive new values published to it. For the setpoint, this will mean that the coordinator will get notified whenever the setpoint is changed. However, when the coordinator Arduino is first turned on or resets, it will not know about the current setpoint until it changes. The SoS option solves this by automatically sending the current value of the setpoint whenever the coordinator subscribes to it...