Configuring Setpoint

Hi Friends,
I’m running OpenHAB 3.1 on a Raspberry Pi 4 4GB with Raspberry Pi OS.

I have 2 Samsung Air-conditioners in my home that I’m able to control using REST API and the HTTP Binding.
To control my system I usually use Siri commands and the OpenHAB iOS app with a dedicated Sitemap.
I did stumble into a small issue when controlling the AC’s temperature.

I first tried to add a Setpoint line to the Sitemap that will control the AC’s temperature.

Setpoint item=SalonAC_Temperature label="Set Temperature [%.0f °C]" minValue=16 maxValue=30 step=1

However, the changes I make to the AC’s temperature does not actually reflect on the AC, meaning the Setpoing temperature changes are not sent to the AC’s.

However, when I set the temperature control line as Selection the temperature changing commands are properly received by the AC’s.

Selection item=SalonAC_Temperature label="Set Temperature [%.0f °C]" mappings=[16="16°C", 17="17°C", 18="18°C", 19="19°C", 20="20°C", 21="21°C", 22="22°C", 23="23°C", 24="24°C", 25="25°C", 26="26°C", 27="27°C", 28="28°C", 29="29°C", 30="30°C"]

Am I doing something wrong with the Setpoint line?

I could use some help :pray:

Hi, @chrismast.
Do you by chance have an idea what I’m doing wrong?

What’s the Channel configuration like?

1 Like

Hi Miki, sorry, I am not really using sitemaps anymore.
Could be that the sitemap’s setpoint is not translated correctly into the map file?
Does the log show the change of the item (SalonAC_Temperature) to the correct value?

1 Like

Thanks @chrismast ,
Your questions helped me find the problem.
The log displayed these line, which meant the Setpoint’s temperature changing commands were properly received in OpenHAB.

2021-09-28 22:11:02.516 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'SalonAC_Temperature' received command 24.0
2021-09-28 22:11:02.518 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'SalonAC_Temperature' predicted to become 24.0
2021-09-28 22:11:02.524 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SalonAC_Temperature' changed from 23 to 24.0
2021-09-28 22:11:03.226 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'SalonAC_Temperature' received command 25.0
2021-09-28 22:11:03.227 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'SalonAC_Temperature' predicted to become 25.0
2021-09-28 22:11:03.233 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SalonAC_Temperature' changed from 24.0 to 25.0
2021-09-28 22:11:06.648 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'SalonAC_Temperature' changed from 25.0 to 23

Which means, you were correct. The problem was in my AC transformation map file.
My trasformation file had these lines for the temperatures:

16=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[16.0]}]
17=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[17.0]}]
18=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[18.0]}]
19=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[19.0]}]
20=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[20.0]}]
21=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[21.0]}]
22=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[22.0]}]
23=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[23.0]}]
24=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[24.0]}]
25=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[25.0]}]
26=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[26.0]}]
27=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[27.0]}]
28=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[28.0]}]
29=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[29.0]}]
30=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[30.0]}]

meaning, the temperature changes actually did not reflect in the transformation map file, because the Setpoint changes were received as “23.0”, “24.0”, “25.0” whereas the transformation map file had “23”, “24”, “25” as the commands to listen to.

After changing the transformation file to this, the problem was solved and the command passed to the AC:

16.0=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[16.0]}]
17.0=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[17.0]}]
18.0=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[18.0]}]
19.0=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[19.0]}]
20.0=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[20.0]}]
21.0=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[21.0]}]
22.0=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[22.0]}]
23.0=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[23.0]}]
24.0=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[24.0]}]
25.0=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[25.0]}]
26.0=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[26.0]}]
27.0=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[27.0]}]
28.0=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[28.0]}]
29.0=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[29.0]}]
30.0=[{"component":"main", "capability":"thermostatCoolingSetpoint", "command":"setCoolingSetpoint","arguments":[30.0]}]

As always, thank you very much for your help :pray: :pray: :pray: :pray:

Thank you for trying to help, @Udo_Hartmann :pray: :pray:
Using @chrismast questions I was able to find to cause of the problem and fix it.

You might consider using a SCALE transform instead. This works on numbers rather than string matching, so it will deal with 23 or 23.0, or even 23.5, or can also limit out-of-range numbers if you wish.
Makes it more robust.

1 Like

Thank you for the suggestion @rossko57 :pray:
Always good to learn a new OpenHAB feature.
I’ll try it :slight_smile:

You could even use http binding only (given that you don’t need a decimal place, which is very likely)

  - id: testchannel
    channelTypeUID: http:number
    label: testlabel
    description: ""
    configuration:
      commandTransformation: '[{"component":"main",
        "capability":"thermostatCoolingSetpoint",
        "command":"setCoolingSetpoint","arguments":[%2$]}]'

You don’t need a transformation and additional items at all.

1 Like