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


  • 0

(SOLVED) Change multiple Scene icons


Question

Posted (edited)

Hello

I have created various scenes that work.

 

Now I would like to make sure that when I activate a scene, the icons of the other scenes change.

This is the portion of the code.

 

[...]

 

    fibaro:call(27, "pressButton", "2") -- Spengo Cuore
    fibaro:call(28, "pressButton", "2") -- Spengo Gatto
    fibaro:call(4, "sendDefinedPushNotification", "221") -- Invio Notifica iPhone
    api.put('/scenes/12', {iconID=1005}) -- Cambio icona scena Vedi TV   <---- THIS WORKS
    api.put('/scenes/3', {iconID=1002}) -- Cambio icona scena Fuori Casa 
    api.put('/scenes/5', {iconID=1002}) -- Cambio icona scena In Casa
    api.put('/scenes/6', {iconID=1002}) -- Cambio icona scena Notte
    api.put('/scenes/8', {iconID=1002}) -- Cambio icona scena Romeo
    api.put('/scenes/4', {iconID=1002}) -- Cambio icona scena Soggiorno
    api.put('/scenes/7', {iconID=1002}) -- Cambio icona scena Porta
    fibaro:debug("Scena Vedi TV Attivata!")

 

[...]


When I launch the scene, however, only the first command (  api.put('/scenes/12', {iconID=1005}) ) is considered.

Where am I wrong?

Edited by MarcoTorino71

7 answers to this question

Recommended Posts

  • 0
Posted (edited)

Se ben ricordo avevo provato anch'io la soluzione del cambio icona delle scene... richiede qualche istante per processare... dovresti risolvere mettendo in pausa i passaggi per un secondo o due... prova...

    api.put('/scenes/12', {iconID=1005}) -- Cambio icona scena Vedi TV   <---- THIS WORKS

    fibaro:sleep(1000) -- un secondo oppure aumentare a 2 secondo
    api.put('/scenes/3', {iconID=1002}) -- Cambio icona scena Fuori Casa 

    fibaro:sleep(1000) -- un secondo oppure aumentare a 2 secondo
    api.put('/scenes/5', {iconID=1002}) -- Cambio icona scena In Casa

    fibaro:sleep(1000) -- un secondo oppure aumentare a 2 secondo
    api.put('/scenes/6', {iconID=1002}) -- Cambio icona scena Notte

    fibaro:sleep(1000) -- un secondo oppure aumentare a 2 secondo
    api.put('/scenes/8', {iconID=1002}) -- Cambio icona scena Romeo

    fibaro:sleep(1000) -- un secondo oppure aumentare a 2 secondo
    api.put('/scenes/4', {iconID=1002}) -- Cambio icona scena Soggiorno

    fibaro:sleep(1000) -- un secondo oppure aumentare a 2 secondo
    api.put('/scenes/7', {iconID=1002}) -- Cambio icona scena Porta

 

 

Edited by alexpelli
  • 0
  • Inquirer
  • Posted
    18 minutes ago, alexpelli said:

    Se ben ricordo avevo provato anch'io la soluzione del cambio icona delle scene... richiede qualche istante per processare... dovresti risolvere mettendo in pausa i passaggi per un secondo o due... prova...

        api.put('/scenes/12', {iconID=1005}) -- Cambio icona scena Vedi TV   <---- THIS WORKS

        fibaro:sleep(1000) -- un secondo oppure aumentare a 2 secondo
        api.put('/scenes/3', {iconID=1002}) -- Cambio icona scena Fuori Casa 

        fibaro:sleep(1000) -- un secondo oppure aumentare a 2 secondo
        api.put('/scenes/5', {iconID=1002}) -- Cambio icona scena In Casa

        fibaro:sleep(1000) -- un secondo oppure aumentare a 2 secondo
        api.put('/scenes/6', {iconID=1002}) -- Cambio icona scena Notte

        fibaro:sleep(1000) -- un secondo oppure aumentare a 2 secondo
        api.put('/scenes/8', {iconID=1002}) -- Cambio icona scena Romeo

        fibaro:sleep(1000) -- un secondo oppure aumentare a 2 secondo
        api.put('/scenes/4', {iconID=1002}) -- Cambio icona scena Soggiorno

        fibaro:sleep(1000) -- un secondo oppure aumentare a 2 secondo
        api.put('/scenes/7', {iconID=1002}) -- Cambio icona scena Porta

     

     

     

    I set the sleep to 2 seconds, but nothing to do...

    • 0
  • Inquirer
  • Posted

    Small integration.

     

    The code is inside an IF condition.

     

    I did some tests and the scene exits the condition after changing the first icon.

    • 0
    Posted
    On 1/10/2020 at 10:18 PM, MarcoTorino71 said:

    OK. Found the solution.

       Hi and what was your solution?

    was it they delay?

    • 0
  • Inquirer
  • Posted
    11 hours ago, Jamie mccrostie said:

       Hi and what was your solution?

    was it they delay?

    Hi,
    I did it this way at first:

     

    I modified all the icons except for the scene itself at the beginning of the passages. At the end of the code, before finishing everything, I modified the icon of the scene in use.

     

     

    Now I changed the logic instead. I created a separate scene that checks the variables, according to the variable modify the icon itself. This way it's also more streamlined the code of the various scenes and if I add a scene I have to modify only the one of the icon change.

    • 0
    Posted
    31 minutes ago, MarcoTorino71 said:

    did it this way at first:


    Thanks Marco for reply

    Yes i got it to work the same separate scene

    which changes icons depending on globals

    trick was to find scene icon ids through hc2/docs

    thanks again

    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...