Things - value transformation question

Hi there what would be the best way to achieve working termostat target temp value transformation.

Tuya thermostat hs 2 channels:

Current temp - values temp_current(5 - 500℃) which need to be divided by 10 to achieve proper reading.

I did it in links/Termostat_Salon_Temp_Current/temp_current using profile “Divide” from smarthome/j addon. It’s working ok

but in case of Target temperature i need to multiply the value from item by 10 and send it to the channel not sure how to achieve it

use uom! if your values need to be divided by 10 to give you a celsius value, it means that they are in deci celsius. Just mark the channel with deci celsius unit, and your item as celsius.

it depends right now i have a different tuya thermostat which send values multiplied by “2”. I need to divide by 2 when receving but multiply by 2 when sending new temp set

If you have a “divide” profile, then just divide by 0.5 to multiply by 2.

or you can use script profile, e.g.

DSL: |Float.parseFloat(input) * 2
JS: |parseFloat(input) * 2
RB: |input.to_f * 2

yeah but i was wondering if this could be done on one item depending if :slight_smile:

a) value received from external (tuya binding) → divide by 2

b) value received from openhab item → multiply by 2 and send to the channel

For now i will make a technical item to multiply and send to the channel

take a look at the doc https://www.openhab.org/docs/configuration/transformations.html#script-transformation-profile

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.