Zigbee binding

Chris, I know i’ve mentioned it before but I am still baffled that no one else is revolting against this entire ‘undef’ state that the binding is putting the color channel into while the bulb is in ‘white mode’ - Apparently no one else does logic based on the bulb state? (or never uses white…idk). Regardless this has nearly driven me away from openhab as it renders your binding completely useless for me :frowning: Luckily I’ve found an osram binding that works the old way. Anyway - my question is - can you point me to the discussion location for these types of things. Is it on github? I really would love to get back onto your binding rather than have multiple zigbee networks (osram hubs only allow 50 devices) .

The horror - I even almost contemplating going over to home assistant but I found my auto white color temperature programming would take a lot more work over there afaik - still have it running and my experiment but I do like the overall structure of openhab better.

Thanks for your help!

i don’t disagree, but if I remember correctly, this system was “agreed” (or mandated) as it was consistent with other bindings (Hue or Tradfri if I remember correctly). Personally I’d prefer to see a new channel type that properly handles the white color mode, but this is what I was told to do.

Yes.

1 Like

I have resorted to always keeping the lights in color mode.
I have created a dummy channel for color temperature, and use a rule to “translate” commands to that channel into HSB commands. That way, I can always be sure what the state of the light is.

What formula have you used? I saw a reference to that idea elsewhere on these forums (perhaps it was even yours) but I didn’t feel it did well at representing the color temperatures. I’d love to see what you use!

rule "Color Temperature HSB translator"
    //translate CT to HSB so we never operate lamps in CT mode 
    //this will provide reliable state information always in the HSB channel
when
    Member of gLampCT received command  
then
    //construct corresponding color item
    val itemName = triggeringItem.getName().replace("_ColorTemperature", "_Color") 
    var lampColor = gLampColor.members.filter[lamp|lamp.name == itemName].head

    if ( lampColor !== null) {
        //convert CT to color value (hue 45, saturation 0.6*CT, brightness as is)
        //actual rule is *0.6 + 1, so that saturation never hits 0 when commanded by CT slider.
        //This is to distinguish this operation from Alexa "White" command, which triggers a rule to change color temp.
        val targetSaturation = new PercentType ((receivedCommand as PercentType) * 0.6 + 1)
        val targetBrightness =  new PercentType ((lampColor.state as HSBType).getBrightness().intValue() )
        val targetColor = new HSBType( new DecimalType(45), targetSaturation, targetBrightness) 
        logInfo("CT to HSB", "a CT Command was executed as HSB")
        sendCommand( lampColor, targetColor)
    }
    else {
        logWarn("CTConvert", "The color item to adjust color temperature " + itemName + " could not be found")
    }
end

The dummy CT item needs to end with _ColorTemperature and be part of group gLampCT
The Color channel item needs to start with the same name, but end with _Color and be part of group gLampColor
You can adjust the color to your liking by editing the 45 number. I found with the Hue hub, it needs a lower hue.

1 Like

Btw.: What is the Zigbee binding in the marketplace?
image
Did I miss something?:wink:

I’m not sure - maybe it’s a really (really!) old version. It’s been a long time since I looked at the marketplace, but it was in there a few years ago so it’s probably that version.

Hi
I am trying to get org.openhab.binding.zigbee.cc2531 to active state. Along with this binding I have included the following dependency bindings as mentioned in the previous comments

1. org.openhab.binding.zigbee
2. com.zsmartsystems.zigbee
3. com.zsmartsystems.zigbee.dongle.cc2531

The openhab packaging sample version that i am using is 2.5.0-SNAPSHOT

 After adding all these bindings when I am trying to start the installed zigbee bindings getting the following error : 

So, what is the dependency I am missing out or there is any version miss match with the openhab packaging sample and the zigbee bindings.

Please help me out in doing this.

Thank you

Hi guys,

I have a question regarding zigbee devices state persistence.

If a device disconnect and reconnect should the last state stored is send to the device?

For simplicity I am using mapDB, I have a zigbee light bulb if I turn the real switch off cutting the power the device go offline if the last state was “OFF” when the real switch turn on the light goes on and stayed “ON”.

This happens if general power outage the server go OFF and the last state of the light bulb was OFF when the server is up again and the light bulb remain with a ON

does the persistence can be apply to zigbee devices or i need to create a rule for rejoin loading the last state?

Regards,

Cesar

No - the binding won’t send commands to the device. Instead it will poll the device under some such circumstances so that the binding knows the state.

Thanks for the quick reply.

Can a I use a rule with a zigbee device to set a default value when rejoin?

I’m not sure - you might be able to make it work, but it’s not super simple I suspect. When the device comes back online, the binding polls the device so that it gets the current state. If you want to set hte current state, then you have a race condition that you will need to manage as you may set it before or after the binding has updated the state.

You can trigger a rule when a Thing status changes to ONLINE and use persistence to get the previous state.

1 Like

As I said though, this won’t necessarily work as there is a race condition. If the binding updates the item state before the rule triggers following the thing online update then it won’t work.

This is likely because the binding will automatically update the state of the device when it comes back online.

Couldn’t you use a timer to ensure the binding updates the new state and then use item.previousState.state to set the state back to where it was?

Why not managin cc2531 and all related with generic MQTT binding?
Thought zigbee bindining was designed for gateway integration

I’m not sure what that means, but the ZigBee binding is designed to attach to ZigBee devices - there is no gateway required.

Personally I would not recommend the TI device as the firmware is no longer supported by the manufacturer.

Are you sure?Where did you read this
What I read si about shepard libraries no more considered but the Project itself stil evolve and proceed

I think you are mixing up different things. The zigbee2mqtt project which is separate from openhab but can be connected via mqtt actually only works with cc2531usb stick. The Openhab Zigbee Binding manages a number of different sticks you can find in the documentation like the ember based ones directly. @chris is saying that the cc2531 will work and is easy to get but will do to missing manufacturer support not receive abilitys like for example dealing with zigbee 3.0 devices which will become more common in the future. So it is a limiting choice compared to other available sticks that work with the Openhab binding.
Johannes

1 Like