stefan-kaestle / openhab2-addons

Add-ons for openHAB 2.x
Eclipse Public License 2.0
16 stars 1 forks source link

Feature/3 thermostat #9

Closed coeing closed 4 years ago

coeing commented 4 years ago

This feature should make Bosch Thermostat devices available in openHAB.

Just a first draft to discuss some things and to link it to the issues it belongs to :)

GerdZanker commented 4 years ago

The target branch should be "bosch-shc-2.5" to see the expected amount of commits.

coeing commented 4 years ago

@GerdZanker You're right, thanks for the hint :)

coeing commented 4 years ago

In this feature branch I added two services for the thermostat device:

Both are created, initialized and registered inside the ThermostatHandler::initialize method. This creates the connection between the service state and the channels of the handler.

Through this registration there is several state handling which can be done automatically:

The handling of state updates from the bridge happens like this:

  1. Read the name of the service the state is from
  2. Let the registered service with this name handle the state
  3. The registered service converts the JSON to a concrete service state object
  4. The registered service calls the state update callback of the handler
  5. Now the handler only has to update its channels from the data of the service state object

For an example check out the feature branch and have a look at the ThermostatHandler.

This should be a good foundation for the service architecture (Issue #8 )