Twinkly Binding

Sure, I will play around with it a little bit. I’m not sure if you saw the last thing I added about Google Assistant.

Now if I would add the switch I would only be able to turn on/off. If I add the dimmer I would only be able to dim, not turn on/off. The optimal would be to bind the dimmer to Google Assistant but then the binding would have to be changed to use these on/off events I think.

Because I do not need to care if it’s movie/effect when using the dimmer slider. It simply works on both devices. If that could be sorted out I think the experience would be better :slight_smile: I can see if I have to to have a look as well some day. Time is rare…

If you’re using GA you can use both Switch and Dimmer, please look here for more information:

For your Icicle you should be able to combine both existing Items as described.
For your Gold you can use something like that:

String GoldMode { channel="twinklytree:twinkly:gold:mode" }
Dimmer GoldDimmer { channel="twinklytree:twinkly:gold:brightness", ga="Gold" }
Switch GoldSwitch { ga="Gold" }

with rule:

rule "Gold Switch" 
when 
    Item GoldSwitch received command
then 
    if (receivedCommand == ON) {
        GoldMode.sendCommand("effect")
    } else {
        GoldMode.sendCommand("off")
    } 
end

Before you clear away your Twinkly for the season:

Anybody besides me seeing this?

Sorry, I couldn’t reproduce your issue on my setup. My main server is stable after many restarts, long runtime, plugging and unplugging the lights. On a clean OH 3.2 it starts with offline lights without any issues.
This binding is pretty basic and I’m not aware of any possible conflict with OH core.
Uninstalling the binding should not leave any junk behind.
As I’ve read, you had some other small issues, maybe the impossible stuff combined :slight_smile:
If anyone else encounters the same issue, please enable debug and send me an excerpt.

log:set DEBUG org.openhab.binding.twinklytree

Pav

Strange thing…
What happened was that I cleared away X-mas so the Twinkly became offline.
A few days later, when I was hit be JJS OOM error, I did the first reboot after removing Twinkly.

I tried numerous reboots, power-cycles. Upgraded to latest snapshot, downgraded again, because the snapshot is unstable. Many restart once again.
Always ended up in the same state:

213 │ Active   │  75 │ 3.2.0                 │ openHAB Core :: Bundles :: Thing XML
214 │ Active   │  80 │ 3.2.0                 │ openHAB Core :: Bundles :: Transformation Service
215 │ Active   │  80 │ 3.2.0                 │ openHAB Core :: Bundles :: UI
216 │ Active   │  80 │ 3.2.0                 │ openHAB Core :: Bundles :: UI Icon Support
217 │ Active   │  80 │ 3.2.0                 │ openHAB Core :: Bundles :: Voice
218 │ Active   │  80 │ 3.2.0                 │ openHAB UI :: Bundles :: Main UI
225 │ Active   │  80 │ 1.0.0.201802012106    │ org.osgi:org.osgi.service.jaxrs
226 │ Active   │  80 │ 1.5.0                 │ ThreeTen-Extra
227 │ Active   │  80 │ 1.27.0                │ SnakeYAML
228 │ Active   │  80 │ 2.1                   │ SI Units
229 │ Active   │  80 │ 2.1.0                 │ SI Quantities
230 │ Active   │  80 │ 4.2.1                 │ Stax2 API
231 │ Active   │  80 │ 2.1.2                 │ Units of Measurement Reference Implementation
232 │ Active   │  80 │ 2.1.0                 │ Units of Measurement Common Library for Java
233 │ Active   │  80 │ 1.4.18                │ XStream Core
234 │ Active   │  80 │ 3.2.0.202112051225    │ openHAB Add-ons :: Bundles :: TwinklyTree Binding
235 │ Starting │  80 │ 5.9.0                 │ jna
236 │ Resolved │  80 │ 5.9.0                 │ jna-platform
237 │ Resolved │  80 │ 1.6.2                 │ JavaMail API
238 │ Resolved │  80 │ 1.0.1                 │ IO.Socket Engine Client
239 │ Resolved │  80 │ 1.0.1                 │ IO.Socket Socket Client
240 │ Resolved │  80 │ 20180813.0.0          │ JSON in Java
241 │ Resolved │  80 │ 5.2.1                 │ nrjavaserial
242 │ Resolved │  80 │ 3.7.2                 │ Apache Commons Net
243 │ Resolved │  80 │ 3.8.1.1               │ Apache ServiceMix :: Bundles :: okhttp
244 │ Resolved │  80 │ 1.13.0.1              │ Apache ServiceMix :: Bundles :: okio
245 │ Resolved │  80 │ 2.0.0                 │ Californium (Cf) Core
246 │ Resolved │  80 │ 2.0.0                 │ Californium (Cf) Element Connector
247 │ Resolved │  80 │ 2.0.0                 │ Californium (Cf) OSGi
248

As soon as I disabled the Twinkly addon in the GUI, the system jumped to life (live, no restart, just Twinkly disable), rule engine started, but many addons was still inn the Resolved state.

One thing I wonder: why did the Twinkly addon start so early, long before the other addons?
(Can’t check now since I have uninstalled it)

Since my Twinkly is now in the Attic, it is a topic for the next X-mas season :slight_smile:

I’m still in for the coincidence theory. Bindings stuck at Resolved seems to be a known issue on old setups / upon migration: link, link, link. Perhaps the addons had been resorted upon upgrade so this binding was started before its dependencies. I don’t know… but I do hope I will be there next Christmas and able to provide you any support :slight_smile::christmas_tree:

1 Like

Twinkly supports razor chrome api. I wonder if this could be a back door way at more functionality

https://assets.razerzone.com/dev_portal/REST/html/index.html

Hello to all,

its soon Christmas and I am still a beginner with OH therefore a started earlier to setup the twinkly binding :wink:

I am working with openHAB 3.3.0 - Release Build.

I would confirm that my Twinkly Strings Gen2 RGB+W LED can be turned off but not turned on

Hi,

I have managed it to get a log file.
Is maybe the problem that when I turn on the the twinkly {“mode”:“movie”} is triggered?

2022-11-26 10:13:46.721 [DEBUG] [nklytree.internal.TwinklyTreeHandler] - Handle command OFF with channel twinklytree:twinkly:TwinklyString:switch
2022-11-26 10:13:46.743 [DEBUG] [nklytree.internal.TwinklyTreeHandler] - Request POST http://192.168.178.84/xled/v1/led/mode {"mode":"off"} got response headers {null=[HTTP/1.1 200 OK], Connection=[close], Content-Length=[26], Content-Type=[application/json]} with data {"mode":"off","code":1000} 
2022-11-26 10:13:53.165 [DEBUG] [nklytree.internal.TwinklyTreeHandler] - Handle command REFRESH with channel twinklytree:twinkly:TwinklyString:switch
2022-11-26 10:13:53.183 [DEBUG] [nklytree.internal.TwinklyTreeHandler] - Request GET http://192.168.178.84/xled/v1/led/mode null got response headers {null=[HTTP/1.1 200 OK], Connection=[close], Content-Length=[56], Content-Type=[application/json]} with data {"mode":"off","detect_mode":0,"shop_mode":0,"code":1000} 
2022-11-26 10:13:53.184 [DEBUG] [nklytree.internal.TwinklyTreeHandler] - Handle command REFRESH with channel twinklytree:twinkly:TwinklyString:dimmer
2022-11-26 10:13:53.207 [DEBUG] [nklytree.internal.TwinklyTreeHandler] - Request GET http://192.168.178.84/xled/v1/led/mode null got response headers {null=[HTTP/1.1 200 OK], Connection=[close], Content-Length=[56], Content-Type=[application/json]} with data {"mode":"off","detect_mode":0,"shop_mode":0,"code":1000} 
2022-11-26 10:14:03.211 [DEBUG] [nklytree.internal.TwinklyTreeHandler] - Handle command REFRESH with channel twinklytree:twinkly:TwinklyString:switch
2022-11-26 10:14:03.234 [DEBUG] [nklytree.internal.TwinklyTreeHandler] - Request GET http://192.168.178.84/xled/v1/led/mode null got response headers {null=[HTTP/1.1 200 OK], Connection=[close], Content-Length=[56], Content-Type=[application/json]} with data {"mode":"off","detect_mode":0,"shop_mode":0,"code":1000} 
2022-11-26 10:14:03.236 [DEBUG] [nklytree.internal.TwinklyTreeHandler] - Handle command REFRESH with channel twinklytree:twinkly:TwinklyString:dimmer
2022-11-26 10:14:03.254 [DEBUG] [nklytree.internal.TwinklyTreeHandler] - Request GET http://192.168.178.84/xled/v1/led/mode null got response headers {null=[HTTP/1.1 200 OK], Connection=[close], Content-Length=[56], Content-Type=[application/json]} with data {"mode":"off","detect_mode":0,"shop_mode":0,"code":1000} 
2022-11-26 10:14:09.306 [DEBUG] [nklytree.internal.TwinklyTreeHandler] - Handle command ON with channel twinklytree:twinkly:TwinklyString:switch
2022-11-26 10:14:09.329 [DEBUG] [nklytree.internal.TwinklyTreeHandler] - Request POST http://192.168.178.84/xled/v1/led/mode {"mode":"movie"} got response headers {null=[HTTP/1.1 200 OK], Connection=[close], Content-Length=[26], Content-Type=[application/json]} with data {"mode":"off","code":1104} 

Hi @Koechi
You might need to send another command to your mode Channel instead of using switch.
In your sitemap you can create a new cell with Send Command action for this Channel, which should probably be on or effect

BR Pav

Hi Pav,

thank you for your hint.

I have created a rule

rule "Twinkly Strings On"
when Item TwinklyString_Onoffswitch changed from OFF to ON
    
then
    TwinklyString_Modeselection.sendCommand("effect")  
end

rule "Twinkly Strings Off"
when Item TwinklyString_Onoffswitch changed from ON to OFF
    
then
    TwinklyString_Modeselection.sendCommand("off")  
end

Now it works :slight_smile:

With the sitempap it is possible to turn it off and on too:

        Frame label="Tannenbaum" icon="rgb" {
        Switch item=TwinklyString_Onoffswitch label="Off / On"   
        Selection item=TwinklyString_Modeselection label="Mode Selection" icon="rgb" mappings=[off="Aus",effect="An"]
        Setpoint item=TwinklyString_Brightness label="Brightness [%.1f %%]" minValue=0 maxValue=100 step=1
        Text item=TwinklyString_CurrentEffect label="Current Effect"
        Text item=TwinklyString_CurrentMovie label="Current Movie"
        }

Regards Köchi

1 Like

Hi @Pavion,

I have tested your Twinkly Binding with a 250 lights stripe. Works for me after reading this thread. :slight_smile:

I can also only activate the Twinkly with the rule you have written above.

Can you send more examples to configure the Twinkly (GitHub - Pavion/org.openhab.binding.twinklytree: TwinklyTree Binding (forked from @mvanhulsentop) - or can you expand your README with some examples)? I want to try the “effect” and “movie” settings. Also Alexa-Integration don’t work for me.

Thanks for your work,
Reinhard

Hi Reinhard,

if you follow the link above, you will find the full API.

As of now, only API calls listed as channels are supported, Alexa should work for the switch (or you might need to create a dummy switch if you need to send another mode):

Switch      TwinklyKuecheSwitch     "Twinkly Küche"              { channel="twinklytree:twinkly:twinklyKuecheL:switch", alexa="PowerController.powerState" [friendlyNames="Twinkly Küche"] }

You should be able to set the mode with mode channel. According to the API:

Hardware can operate in one of following modes:

off - turns off lights
color - shows a static color
demo - starts predefined sequence of effects that are changed after few seconds
movie - plays predefined or uploaded effect. If movie hasn’t been set (yet) code 1104 is returned.
rt - receive effect in real time
effect - plays effect with effect_id
playlist - plays a movie from a playlist. Since firmware version 2.5.6.

BR Pav

1 Like

Hi @Pavion I am successfully using the Twinkly Strip RGBW 400 LEDs on Openhab 4.1.0.M3.

The only thing that should be added is the possibility to set the color, once the “color” mode has been selected.

Thanks

Hi @edo88b

Please check my newest release on GitHub:

This release is compiled on OH4.1.0-SNAPSHOT and tested with OH4.0.4-STABLE.
Due to migration to OH4 some issues are possible, feedback is very appreciated!

BR
Pav

Hi Pav

How can I proceed to update it?

Thanks

To test it, you need to uninstall the marketplace version. Then download and copy the jar file into the addons folder of your Openhab nstallation. You will need to recreate your Thing to be able to use a new Color channel (Items can be kept and relinked again later).

Hi @Pavion,

thank you very much for this binding! Chances are pretty high that I can control my christmas tree this year through openHAB (and drive my wife crazy again :joy:).

Some feedback:

I am currently testing the latest jar with openHAB 4.0.1-STABLE. I have setup a thing in openHAB for my Twinkly Strings RGBW 600 (Model TWS600SPP, Firmware 2.8.18) with a refresh rate of 10. For testing purposes, I linked an item to every channel.

  • Setting Mode to “off” → Ok - does that mean the OnOff channel is not needed?
  • Setting Mode to “color” → Ok
    • Color setting through Color channel → Ok
  • Setting Mode to “movie” → Ok
    • Setting one of the effects from the main page of the App by sending numbers to the Movie channel → Ok
  • Setting Mode to “effect” → Ok
    • Sending some numbers to the Effect channel seems to have no effect. It always shows a rainbow effect/the first effect from the “demo” mode. Maybe I’ve tested the wrong effect numbers?
  • Setting Mode to “playlist” → Ok
  • Setting Mode to “demo” → Ok
  • Setting Mode to “rt” → Not tested, is this for the music add-on?

Changing the brightness channel had some “lags”, sometimes after a change it jumps back to the previous value. May be this has something to do with the refresh value?

When I change something through the Twinkly App on my Smartphone, the changes are not seen in openHAB. I thought that the current state of the twinkly device is updated at every refresh cycle.

May be not a problem of your binding, but I thought it’s worth to mention: When I change something through openHAB, the Twinkly App on my Smartphone seems to loose the connectivity for a short time. Also, it happened once that I needed to restart the Twinkly App. Also, the App doesn’t seem to recognize changes between “movie” and “playlist” mode made through openHAB.

Thank you again for this binding!

– Thorsten

Hi Thorsten and thank you for your comprehensive feedback!

  • Yes, OnOff-Channel is not needed, but provided as a shortcut. For API there is no “on” mode, so this channel sends mode: off for off and mode: movie for on (which fails for some models not supporting movie mode :confused: ).
  • I haven’t tested effects this year yet :wink: Normally you must send an integer to this channel to trigger an effect, which should be configured via App first. According to API it is either a current number (e.g. 5) or 15 for newer firmware (don’t know why, probably just +10). You should be able to obtain the current effect number: just start an effect from the App and write down the number from the effect Channel.
  • I’m unsure what the rt does and haven’t tested it. According to API:

rt: receive effect in real time

which is probably needed for the following API call:

Send Realtime Frame
Used by application during lights mapping.

… which I haven’t implemented. In this case, rt mode is useless now.

  • Yes, I’ve noticed some lags myself but I’ve hoped to get rid of them. It might as well have to do with refresh. If this is a breaking issue for you, I might take a look into it again.

  • I had some issues while using App and Binding at the same time myself. Normally I’d assume most in-App changes should be sent to Binding with the given refresh rate but the App might ignore or even try to overwrite the events from the Binding if active in the same time. Again, if you have any breaking issues, please contact me again.

  • playlist functionality is not fully implemented in this binding, I’m just sending mode: playlist. I’d assume, first movie from the last playlist should start to play.

If you wish, you can check the unofficial API here, most now missing features can be implemented quickly.

In any case, I hope you’ll enjoy your new fully automated tree and wish you happy holidays! :christmas_tree:

Pav

Hello @Pavion
Would you advice if this binding will works with Twinkly Curtain ?
Thank you