i have following challenge in the homekit binding with Color Item.
iOS home app sends HUE and saturation as separate requests at the same time.
Currently i do following to
State state = item.getState();
item.send(new HSBType(new DecimalType(newHue),
State state = item.getItem().getState();
item.send(new HSBType(((HSBType) state).getHue(),
new PercentType(newSaturation), ((HSBType) state).getBrightness()));
the issue is - both methods get executed almost at the same time so that i have 2 commands:
one with new HUE but old saturation
another one with new saturation but old hue.
depending in which orders commands get executed, either new hue or new saturation get lost.
the only solution i can think of is to put setState() directly after send(). setState makes update faster and hence reduces the risks that one will read before another one is done with update. but this would probably lead to some issue with rule triggers.
are there any better options?
is there a way to check whether an item has commands in queue ?