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

Set the value of a variable via API http command


Question

Posted

Is there a way to set the value of a variable via API http command?

Recommended Posts

  • 0
Posted

Thank you, Dalle and Goose, for your great help. Just what I needed.

BTW. Hope you didn't use your real password in the examples...

  • 0
Posted
Thank you, Dalle and Goose, for your great help. Just what I needed.

BTW. Hope you didn't use your real password in the examples...

Haha... Don't worry - I changed my password first thing when the HC2 arrived. But the example was meant as a simple guide, so i encoded admin:admin as I would caution a guess that many people are still using this configuration. This might also be a potential error source, so it might be worth re-encoding the username:password using an encoder, just to ensure it is working correctly and I haven't corrupted the authorization.

  • 0
Posted

For some reason my virtual device isn't working anymore. The only change I made was the update to 3.593 on the HCL.

I'm really starting to hate the HCL and Fibaro

[ Added: 2014-07-23, 15:11 ]

Finally got it to work. The code Dalle posted is fine. If you want to activate the scene you have to check "Start when HC2 starts" in the scene options.

That will probably solve the problem for Goose to.

Still not sure what that option means. Probably needed when no triggers are in the scene.

The trial and error thing really bugs me...

Time for a clear and complete manual from Fibaro. (But 4.0 will solve this

Please login or register to see this image.

/emoticons/default_icon_razz.gif" alt=":-P" />)

[ Added: 2014-07-23, 15:20 ]

And again it only worked once... @$%#%

  • 0
Posted

Have you checked the wait for response option? It might be keeping the connection open for some reason, so try toggling this if you haven't already done so.

It is working absolutely trouble free on the HC2, so it sounds like a HCL bug. Perhaps it gets confused when receiving requests from it's own IP...

  • 0
  • Inquirer
  • Posted

    Does not work for me, even ticking "wait for device response" and "start scene when HCL starts".

    Maybe it's scene related...

    Rarev: witch kind of scene are you using? Could you post your scene and your virtual device?

    Thank you all!

    EDIT: Just now I'm reading you writed "once".

    Once is the worst word. I definitely prefer "does not work" then "worked once"

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

    • 0
    Posted

    Very simple one, just to change a value of a variable.

    variable = a or

    variable = b

    then

    variable = c

    Also tried it with a light switch

    switch = on

    then

    switch = off

    Neither works. I just thought it worked, because the scene was executed when I ticked the "start when hc2 starts". At least, I think that's what it was.

    Sorry to get your hopes up.

    [ Added: 2014-07-24, 10:11 ]

    So you can change "once" to "does not work"

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    • 0
    Posted

    Just tried tried this on my HCL , and it did work! I'm on 3.593!

    • 0
    Posted
    Just tried tried this on my HCL , and it did work! I'm on 3.593!

    diderik, could you please elaborate on how you solved it?

    I've a HCL with 3.593 and I can't get any Virtual Device (even turning on a light) to work. If I run my scenes manually the variable is updated successfully and using the HTTP API from a web browser works as well.

    I'm using the code suggested by goose2600 and Dalle1985 and have replaced the BASE64 string.

    I imported the "Trigger_scene.vfib" Virtual Device, changed host and port. And then changed the id of my scene, host and the BASE64 string (which I generated for my password, e.g. admin:password).

    I've rebooted my HCL as well. I guess I could try to reset the admin account to admin/admin to be able to use the exact BASE64 string, but I haven't tried that yet.

    Any suggestions?

    [ Added: 2015-01-20, 18:55 ]

    Finally got it to work using this

    Please login or register to see this link.

    .

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    The trick is to NOT use enter in the button code but rather 0x0D0x0A.

    So, using the example provided by goose2600 the code will be the following:

    Please login or register to see this code.

    Works for me and hopefully for others as well!

    Please login or register to see this image.

    /emoticons/default_icon_smile.gif" alt=":-)" />

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