[amazonalexacontrol] Add upperSetpoint and lowerSetpoint to ThermostatController

I keep my thermostat in Auto mode, which means it has a lowerSetpoint property and an upperSetpoint property, but no targetSetpoint property (Alexa.ThermostatController Interface | Alexa Skills Kit). The behavior I see in OpenHAB is consistent with this: the actual temperature mapped to the Alexa.TemperatureSensor works great, while the TargetSetpoint is undefined.

Although it is a bit over my head, I looked through the binding code on GitHub, and I see a few places where the upper and lower setpoints would need to be addressed.

In the openhab-addons/thing-types.xml at main · openhab/openhab-addons · GitHub file, only the targetSetpoint channel-type ID is defined.

The meat of the thermostat is handled here:

This would need to be updated to handle upper and lower setpoints.

And a ChannelTypeUID of would need to be defined for each in openhab-addons/Constants.java at main · openhab/openhab-addons · GitHub , after
// channel types public static final ChannelTypeUID CHANNEL_TYPE_TEMPERATURE = new ChannelTypeUID( AmazonEchoControlBindingConstants.BINDING_ID, "temperature"); public static final ChannelTypeUID CHANNEL_TYPE_TARGETSETPOINT = new ChannelTypeUID( AmazonEchoControlBindingConstants.BINDING_ID, "targetSetpoint");

There is probably more to it than what I could figure out. I wish I knew more and could help add it to the binding.

After reviewing the code, I believe that at least the following changes are needed:

  1. Define channel types for the new parameters

Add the following channel types to Constants.java
Below the existing

    // channel types
    public static final ChannelTypeUID CHANNEL_TYPE_TEMPERATURE = new ChannelTypeUID(
            AmazonEchoControlBindingConstants.BINDING_ID, "temperature");
    public static final ChannelTypeUID CHANNEL_TYPE_TARGETSETPOINT = new ChannelTypeUID(
            AmazonEchoControlBindingConstants.BINDING_ID, "targetSetpoint");

Add

    public static final ChannelTypeUID CHANNEL_TYPE_UPPERSETPOINT = new ChannelTypeUID(
            AmazonEchoControlBindingConstants.BINDING_ID, "upperSetpoint");
public static final ChannelTypeUID CHANNEL_TYPE_LOWERSETPOINT = new ChannelTypeUID(
            AmazonEchoControlBindingConstants.BINDING_ID, "lowerSetpoint");
public static final ChannelTypeUID CHANNEL_TYPE_THERMOSTATMODE = NEW ChannelTypeUID(thermostatMode, "thermostatMode");

  1. to thing-types.xml add below
<!-- Alexa.ThermostatController -->
<channel-type id="targetSetpoint">
	<item-type>Number:Temperature</item-type>
	<label>Target Setpoint</label>
	<description>Target Setpoint</description>
	<state pattern="%.1f %unit%"/>
</channel-type>

Add:

<channel-type id="upperSetpoint">
	<item-type>Number:Temperature</item-type>
	<label>Cooling Setpoint</label>
	<description>Cooling Setpoint</description>
	<state pattern="%.1f %unit%"/>
</channel-type>
<channel-type id="lowerSetpoint">
	<item-type>Number:Temperature</item-type>
	<label>Heating Setpoint</label>
	<description>Heating Setpoint</description>
	<state pattern="%.1f %unit%"/>
</channel-type>
<channel-type id="thermostatMode">
	<item-type>String</item-type>
	<label>Cooling Setpoint</label>
	<description>Cooling Setpoint</description>
	<state pattern="%.1f %unit%"/>
</channel-type>
  1. To HandlerThermostatController.java, below
// Channel definitions
    private static final ChannelInfo TARGET_SETPOINT = new ChannelInfo("targetSetpoint" /* propertyName */ ,
            "targetSetpoint" /* ChannelId */, CHANNEL_TYPE_TARGETSETPOINT /* Channel Type */ ,
            ITEM_TYPE_NUMBER_TEMPERATURE /* Item Type */);

Add:

    private static final ChannelInfo UPPER_SETPOINT = new ChannelInfo("upperSetpoint" /* propertyName */ ,
            "upperSetpoint" /* ChannelId */, CHANNEL_TYPE_TARGETSETPOINT /* Channel Type */ ,
            ITEM_TYPE_NUMBER_TEMPERATURE /* Item Type */);

    private static final ChannelInfo LOWER_SETPOINT = new ChannelInfo("lowerSetpoint" /* propertyName */ ,
            "lowerSetpoint" /* ChannelId */, CHANNEL_TYPE_TARGETSETPOINT /* Channel Type */ ,
            ITEM_TYPE_NUMBER_TEMPERATURE /* Item Type */);

    private static final ChannelInfo THERMOSTAT_MODE = new ChannelInfo("thermostatMode" /* propertyName */ ,
            "thermostatMode" /* ChannelId */, CHANNEL_TYPE_THERMOSTATMODE /* Channel Type */ ,
            ITEM_TYPE_NUMBER_STRING /* Item Type */);

There may be more.