Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 1

QA: Twinkly Lights ON / OFF


10der

Question

subj 

V3 

Please login or register to see this attachment.

 

 

Please login or register to see this image.

/monthly_2020_11/image.png.67a9821257fa15c65153073cb32a3616.png" />

 

 

Please login or register to see this attachment.

 

 

Please login or register to see this attachment.

Edited by 10der
  • Like 4
  • Thanks 2
Link to comment
Share on other sites

Recommended Posts

  • 0

Hi Oleg @10der,

just have a look at @Sankotronichis implementation of

Please login or register to see this link.

for HC2. From you i was expecting little more :-D

Link to comment
Share on other sites

  • 0
  • Inquirer
  • @BodyartSir, thnx, I am not near my PC and can't see file via Sank.

    I hope this VD for HC2 can works with latest FW (as i can see developers add auth and remove some functions for example switching effects) 

    Link to comment
    Share on other sites

    • 0

    Hi @10der,

     

    I used unofficial Twinkly API published here:

    Please login or register to see this link.

      and it was last updated in 2018. It is still working with latest Twinkly firmware v2.5.6

     

    I used RestAPI that is working on local network. Didn't want to use MQTT for which I expect that is changed after the last unofficial API.

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 25 minutes ago, Sankotronic said:

    Hi @10der,

     

    I used unofficial Twinkly API published here:

    Please login or register to see this link.

      and it was last updated in 2018. It is still working with latest Twinkly firmware v2.5.6

     

    I used RestAPI that is working on local network. Didn't want to use MQTT for which I expect that is changed after the last unofficial API.

     

     

    tnx for answer. I am using rest APi too.

    but is not clear how to send effect with for example 

    Fireworks

    :(

     

     

     

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Ukraine flag (HC3 lua develop)

     

     

     

    Please login or register to see this attachment.

    Edited by 10der
    Link to comment
    Share on other sites

    • 0
    27 minutes ago, 10der said:

     

    tnx for answer. I am using rest APi too.

    but is not clear how to send effect with for example 

    Fireworks

    :(

     

    I know it is possible with MQTT to send name of the one of default effects. With RestAPI I still didn't find that possibility. For now this is what I tested and find working:

     

    Changing LED operation mode payload sent to endpoint "/xled/v1/led/mode":

    • {"mode":"off"}
    • {"mode":"movie"} - starts last movie that was set with mobile app
    • {"mode":"effect"} - starts last default effect that was last played e.g. by demo (not mentioned in API reference)
    • {"mode":"demo"} - starts demo rotating through default effects
    • {"mode":"rt"} - real time movie need to send frames in real time

    Changing LED brightness by sending payload to endpoint "/xled/v1/led/out/brightness":

    • {"value":brightness} where brightness is integer value 0 to 100 where 0 is also turning off LED (wrongly shows value sent as string {"mode":"enabled","type": "A","value": "100"})

    And of course it is possible to send complete effect by uploading frames as you just demonstrated in previous post :-)

     

    Edited by Sankotronic
    • Like 1
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • tnx.

    all function already was impemented.

    i with to know how to switch to predefined effect. answer no how.

    it's ok.

     

    thank you very much

     

    code for hc3 playing (local debugging by @jgabtools

     

    attached

     

    Please login or register to see this attachment.

    Edited by 10der
    • Like 1
    • Thanks 1
    Link to comment
    Share on other sites

    • 0

    I think there is also {"mode": "playlist"}

    I haven't checked it but such mode is displayed when I turn on playlist on Twinkly mobile app.

    Link to comment
    Share on other sites

    • 0
    W dniu 21.11.2020 o 16:19, 10der napisał:

    tnx.

    all function already was impemented.

    i with to know how to switch to predefined effect. answer no how.

    it's ok.

     

    thank you very much

     

    code for hc3 playing (local debugging by @jgabtools

     

    attached

     

    Please login or register to see this attachment.

    @10der Bravo! Bravo! Could you please include the .fqa with the recent changes?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 1st post has updated.

    WARNING!!!!

    updating the current state DISABLE because the currenct FIBARO H3 FW has a bug with leak memory when we trying to call some URL via HTTP what doesnot exists.

    so when your device if OFF (power off physically) and do not present in network, calling http request to this devices can crash your HC3 after some period.

    sorry,

    • Like 2
    Link to comment
    Share on other sites

    • 0
    5 hours ago, 10der said:

    1st post has updated.

    WARNING!!!!

    updating the current state DISABLE because the currenct FIBARO H3 FW has a bug with leak memory when we trying to call some URL via HTTP what doesnot exists.

    so when your device if OFF (power off physically) and do not present in network, calling http request to this devices can crash your HC3 after some period.

    sorry,

     

    This is certainly an important warning.
    I've already addressed the question of whether to automatically disable this QA when you repeatedly try to make an HTTP call from a QA.
    Unfortunately, even if a device (QA) is disabled or marked as unavailable, it communicates from time to time and I don't know why. This applies to the state when the HC3 falls into the state 500/501 and only a restart (once every 2 months) will help to correct it.
    Can anyone think of a solution?

    eM.

    • Thanks 1
    Link to comment
    Share on other sites

    • 0
    7 hours ago, Martin_N said:

     

    This is certainly an important warning.
    I've already addressed the question of whether to automatically disable this QA when you repeatedly try to make an HTTP call from a QA.
    Unfortunately, even if a device (QA) is disabled or marked as unavailable, it communicates from time to time and I don't know why. This applies to the state when the HC3 falls into the state 500/501 and only a restart (once every 2 months) will help to correct it.
    Can anyone think of a solution?

    eM.

     

    My experience is that QAs don't honor the "disabled" setting automatically. One needs add code for it. 

    In my

    Please login or register to see this link.

    I have code like below at startup

    Please login or register to see this code.

    It checks the enabled field of the QA and don't run the onInit() code if it is disabled. One could do an os.exit() too but then the QA would try to restart every minute...

    Because every time the disabled start is set in the UI the QA restarts, so this check works.

    My toolbox does some complex patching of the QA startup logic, but one could just add this code in the beginning of QuickApp:onInit() to ignore the rest of the code.

    • Thanks 1
    Link to comment
    Share on other sites

    • 0

    I've seen this strange behaviour when doing http requests to servers that doesn't answer. Can't prove anything but as a general best practice is to extend the polling interval when connections fail, for every fail extend with 1 minute up to a max of 10-20min and then on success reset the interval back to the original.

     

    Another approach is to disable the QA after a set number of fails.

    Please login or register to see this code.

    if code like in the previous post is added. Could also be worthwhile to make a push to inform that the QA been disabled.

     

     

    • Thanks 1
    Link to comment
    Share on other sites

    • 0

    Yes, .. I also started noticing this at the moment when my QA for iEAST started reporting random error messages to one customer (I receive decoded from the httpclient response status). Since it was a local device, I assumed a wi-fi error. I made a debugging version, where for each unsuccessful query I increase the timeout by + 500ms and print a message.
    Ironically, about a month ago, my wi-fi started to restart and I suddenly restarted and I saw a beautiful debug in practice. That's when I also realized that it can't be turned off with a check mark.

    Thank you Jgab for the inspiration / solution.

    It's off topic, but maybe this is also the reason for increasing the RAM load described in another fiber (FBerges)

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 3 hours ago, jgab said:

    I've seen this strange behaviour when doing http requests to servers that doesn't answer. Can't prove anything but as a general best practice is to extend the polling interval when connections fail, for every fail extend with 1 minute up to a max of 10-20min and then on success reset the interval back to the original.

     

    Another approach is to disable the QA after a set number of fails.

    Please login or register to see this code.

    if code like in the previous post is added. Could also be worthwhile to make a push to inform that the QA been disabled.

     

     

    Jan!

    mark device as dead not disabled.

    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...