Openhab2, Tasmota B1 Color Temperature Slider

tasmota
light-b1
sonoff-b1
Tags: #<Tag:0x00007f1e576a8c28> #<Tag:0x00007f1e576a8ac0> #<Tag:0x00007f1e576a8980>
(onacvooe) #1
  • Platform information:
    • Hardware: Intel I5 8250U/x64/8Gb/320Gb
    • OS: Ubuntu 18.04LTS
    • Java Runtime Environment:
openjdk version "1.8.0_202"
OpenJDK Runtime Environment (Zulu 8.36.0.1-CA-linux64) (build 1.8.0_202-b05)
OpenJDK 64-Bit Server VM (Zulu 8.36.0.1-CA-linux64) (build 25.202-b05, mixed mode)
  • openHAB version: 2.4
  • Issue of the topic:
    Getting Color temperature to work on Openhab2 and a tasmota 5.13.1 flashed sonoff B1-R2 light bulb.
  • Please post configurations (if applicable):
    • Items:
     Switch lamp001_schakelaar  "Lamp Aan/Uit" { channel="mqtt:topic:lamp001:PowerSwitch" }
     Dimmer lamp001_dimmer      "Lamp Dimmer"  { channel="mqtt:topic:lamp001:dimmer" }
     Dimmer lamp001_kleurtemp   "Lamp temp"    { channel="mqtt:topic:lamp001:kleurtemp" }
  • Sitemap:
	Frame label="Lamp VB VR 01" {
		Switch	item=lamp001_schakelaar
		Slider  item=lamp001_dimmer
		Slider  item=lamp001_kleurtemp
	} // end of Frame
  • Rules: No Rules configured for this item
  • Services: No Services configured for this item
  • If logs where generated please post these here using code fences:

Log show communication with the temperature settings of the bulb but a slider goes from value 0 - 100 and the temperature is done with 153-500. So that is whats is going wrong. Is there any way to change the slider values (minValue/maxValue/step) don’t work on the slider. They also don’t do anything on the Setpoint declaration.

I have been going at this all night. And searched on in the community and on google and on the tasmota github pages but nothing seems to work.

Any help would be nice.

Thank you,

0 Likes

(onacvooe) #2

Nobody? Not possible? Currently I have set it up as a switch but that is not what I want…

Anybody?

0 Likes

(Ron) #3

You defined the ‘kleurtemperatuur’ item as a standard dimmer, and that will not understand anything other than ON/OFF or a value between 0 (=OFF) and 100 (=ON) AFAIK. It is basically a percentage.

For most light bulbs that support color temperature like IKEA TRÄDFI or Philips/Signify Hue, there is support in the binding for color temperature. For instance, the Hue binding translate the value for color temperature to a value between 0=‘cold’ up to 100=‘warm’. This is not going to help your configuration as it communicates via a generic MQTT topic.

You could define the item as a Number and use Setpoint in the sitemap; may not be very user friendly. Also a ‘proxy item’ could work, combined with a rule that converts values, or even a simple transformation of values.
It may be advisable to start creating predefined values (or ‘scenes’ as they are often called) to simplify the UI.

0 Likes

(onacvooe) #4

Thank you for your extensive reply. I appreciate it. I hoped a more ‘elegant’ solution would be available but unfortunately it seems that its not. I also thought about creating ‘scenes’ as an alternative but I wished there was a more elegant solution. Thanks!

0 Likes

(Ron) #5

Well, a simple (and therefor somewhat elegant?) way would be a transform. And by using a tiny JavaScript snippet to do a conversion from 0…100 to 153…500, you will loose some granularity, obviously, but otherwise it is as straightforward as a binding that has color temperature support built-in.

0 Likes

(onacvooe) #6

Thnx, I haven’t worked with transformations yet. So I don’t know how that works.

0 Likes

(Ron) #7

Looks like outgoing transformations on MQTT topics are only included in the latest snapshot releases of OH 2.5 as stated in this post. These are not recommended for ‘production’ use as the whole platform is being reworked at the moment.

So, I propose to wait for a 2.5.0.M2 relaese before implementing a JavaScript transform for this.

0 Likes

(Johannes) #8

At least in the 2.5M1 build I use is quite stable it’s only the snapshots after that which are not recommended. You may not need a transformation as you can configure an absolute minimum and maximum in the properties of a mqtt thing dimmer channel in paper ui. These map to 0 and 100% of the dimmer channel. I use this for the CT channel of my shelly bulb which expects 3000 to 6500 and it works great.

0 Likes

(Johannes) #9

Incase you want to use a transformation anyway. Install Javascript Transformation and save something like this:

(function(i) {
    var input1 = parseInt(i, 10);
    var input2 = input1 * 3.47;
    var output = Math.round(input2) + 153;
    return output;
})(input)

as a Javascript file in your transformation folder and call it as an outgoing transformation. But as I said in the post before that’s probably not necessary. This will only work under 2.5 and later when the outgoing transformations were added.

0 Likes

(Ron) #10

I was not aware of the min/max option. Thanks for pointing that out.

From the thread I refered to, I had the impression that the mqtt binding that supports outgoing transformation was not yet part of M1…

1 Like

(Johannes) #11

They are definitely there in M1 as I use them :slight_smile:

0 Likes

(onacvooe) #12

Aah thank you all for your answers. I’m still on 2.4 stable so it does not yet apply to me. Thank you for pointing out de javascript option. I’ll look into it. Thanks

0 Likes