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

Change icon depending on the status read from json


Question

Posted

I have a virtual device that i want to change icon depending on status "true" or "false", but something goes wrong and I do not know what.

Now it's a button called update that this lua represents, I click on it and the light goes off, though it has value true.

Json string redaout hc:n reads looks like this

{"Name": "Outdoor :: PoolVarme", "Value": true}

It's True or false that will put the lamp icon on or off..

Luan looks like this

Please login or register to see this code.

12 answers to this question

Recommended Posts

  • 0
Posted

I guess your logic works. Is there any error with your code?

Perhaps you could try this.

Please login or register to see this code.

  • 0
  • Inquirer
  • Posted

    There is no error in log with my code,

    tried your code an i get this in error

    [ERROR] 11:57:45: line getSelfId() ..."]:22

    • 0
    Posted

    getSelfId is working in virtual devices only

    • 0
  • Inquirer
  • Posted

    It was my mistake, no error now.

    But it still dont work, it will not change the icon to what i want

    It only change to the default blue box that virtuel device has as standard.

    • 0
    Posted
    It was my mistake, no error now.

    But it still dont work, it will not change the icon to what i want

    It only change to the default blue box that virtuel device has as standard.

    Right icon ID?

    • 0
  • Inquirer
  • Posted

    Yes right icon id

    • 0
    Posted

    and the value response is true?

    can you run the command in your browser and paste the result here?

    • 0
  • Inquirer
  • Posted

    Here come the result

    {"Name":"Utomhus::PoolVärme","Value":true}

    • 0
    Posted

    sonnyboy, that value is string or bool in json?

    because in code you check is value == string true/false

    use tostring() function for sure

    • 0
  • Inquirer
  • Posted

    Its bool, ill try as soon as i came home

    [ Added: 2014-06-18, 19:22 ]

    Now my code look like this and it still doesent work,

    I can see in my other system that hc asks for the status

    Please login or register to see this code.

    • 0
    Posted

    sonnyboy, you was do that wrong

    Please login or register to see this code.

    • 0
  • Inquirer
  • Posted

    A.Socha

    Thanks so very much, you made my day

    Please login or register to see this image.

    /emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" />

    Please login or register to see this image.

    /emoticons/default_icon_mrgreen.gif" alt=":mrgreen:" />

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