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

LUA or QA to run HTTP url (powerview/luxaflex/HunterDouglas)


ppeterr
 Share

Question

[edit] i think i should have placed it in the "Scenes and Interface" section, sorry for that.

 

 

So, i'm new, newbe, so...dont shoot me :)

 

I've been reading a lot, on this forum and elsewhere trying to get my Powerview shades connected to a zwave switch.

It seems to be much harder to manage then i was hoping for. My head spins around with all the information, code lines and such,

Also, none of the info i found seems to be complete. It is all like "do it in LUA", make a QA or a a bunch of code lines.

I hope to find some hints, or answers - help with that.

 

So, what i worked out:

 

- The 8 button fysical wall switch works.

- The powerview plugin works, and the scene's controlled from the hub work

 

The imported scene's dont work, and need i to make a QA or a LUA scene for that.

 

What i tried:

 

I made a block scene with the switch, and  a HUE lamp, converted this to LUA

this is the "what if button is pressed" and it works.

 

Please login or register to see this code.

 

The action part, i made this - but its wrong.

 

Please login or register to see this code.

 

It gives this error:

10.07.2021] [07:00:40] [ERROR] [SCENE4]: (load):1: attempt to index a nil value (global 'Net')

 

I know there is a lost of writing about this on the forum but, I am totally lost in what to do, is this sort of the right way to do it ?

Should i do it with a QA ? 

 

Edited by ppeterr
tags
Link to comment
Share on other sites

Recommended Posts

  • 0
  • Inquirer
  • 2 minutes ago, tinman said:

    check what i just posted

     

    [10.07.2021] [21:14:24] [DEBUG] [SCENE14]: {"scene":{"roomId":46469,"name":"TGlua3MgQWxsZWVuIERpY2h0","colorId":8,"iconId":0,"networkNumber":107,"id":25173,"order":6,"hkAssist":false}}

    Link to comment
    Share on other sites

    • 0

    regarding to the API both (depending on firmware version) should work, with upper i ( /api/scenes?sceneId=25173 ) or ( /api/scenes/25173)

    Probably the missing thing is content type, so try this one (the 200 is only that you got response)

     

    Please login or register to see this code.

     

    or

     

    Please login or register to see this code.

     

    • Like 1
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Posted (edited)

    @tinman

     

    this is the reply for the first one, so that seems to give all the scene info from the hub

     

    [10.07.2021] [21:59:07] [DEBUG] [SCENE14]: {"sceneIds":[25655,29587,25173,20692,20348,60016,14461,33859,23870,16688,37],"sceneData":[{"roomId":46469,"name":"QWxsZXMgR2VoZWVsIE9wZW4=","colorId":7,"iconId":0,"networkNumber":16,"id":25655,"order":1,"hkAssist":false},{"roomId":46469,"name":"VGVzdA==","colorId":8,"iconId":0,"networkNumber":6,"id":29587,"order":10,"hkAssist":false},{"roomId":46469,"name":"TGlua3MgQWxsZWVuIERpY2h0","colorId":8,"iconId":0,"networkNumber":107,"id":25173,"order":6,"hkAssist":false},{"roomId":46469,"name":"T3BlbiBSZWNodHM=","colorId":8,"iconId":0,"networkNumber":106,"id":20692,"order":9,"hkAssist":false},{"roomId":46469,"name":"UmVjaHRzIEFsbGVlbiBEaWNodA==","colorId":8,"iconId":0,"networkNumber":33,"id":20348,"order":7,"hkAssist":false},{"roomId":46469,"name":"SGFsZiBPcGVuIFZlcmRlZWxk","colorId":8,"iconId":0,"networkNumber":51,"id":60016,"order":4,"hkAssist":false},{"roomId":46469,"name":"SGFsZiBPcGVu","colorId":9,"iconId":112,"networkNumber":178,"id":14461,"order":5,"hkAssist":false},{"roomId":46469,"name":"QWxsZXMgR2VoZWVsIERpY2h0","colorId":7,"iconId":62,"networkNumber":44,"id":33859,"order":0,"hkAssist":false},{"roomId":46469,"name":"QmlqbmEgSGVsZW1hYWwgT3Blbg==","colorId":8,"iconId":0,"networkNumber":146,"id":23870,"order":2,"hkAssist":false},{"roomId":46469,"name":"SGFsZiBPcGVuIE9uZGVy","colorId":8,"iconId":0,"networkNumber":200,"id":16688,"order":3,"hkAssist":false},{"roomId":46469,"name":"T3BlbiBMaW5rcw==","colorId":8,"iconId":0,"networkNumber":232,"id":37,"order":8,"hkAssist":false}]}

     

    The second one, gives only the info for scene 25173

     

    10.07.2021] [21:59:31] [DEBUG] [SCENE14]: 200[10.07.2021] [21:59:31] [DEBUG] [SCENE14]: {"scene":{"roomId":46469,"name":"TGlua3MgQWxsZWVuIERpY2h0","colorId":8,"iconId":0,"networkNumber":107,"id":25173,"order":6,"hkAssist":false}}

     

    Both have a 200 above the output

     

    Edited by ppeterr
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • @tinman The HC3 is @5.071.52 (beta) - Should be oke i hope. The normal firmware, gave a lot of GUI problems.

    Link to comment
    Share on other sites

    • 0

    according to the documentation - this:

     

    GET /api/scenes?sceneId={id}

     

    is supposed to start the scene..

    but testing it throws 404 in lua console

     

    in browser I just get {}

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 7 hours ago, tinman said:

    you guys might try code above with QuickApp, the reason is very simply, Quick App and Scenes are using different http implementation.

     

    In scene i would normally use urlencode for everything starting from ? sign, like:

     

    Please login or register to see this code.

     

     

    Well, this works! Thats a perfect start of the Sunday.

    Thanks a lot for this, This is helping me a lot, now i 'm gonna try to understand what you

    actually coded. And also build a quickapp with the other code you made.

     

    Again, thanks again!

    Link to comment
    Share on other sites

    • 0

    I can confirm it works as well.

     

    @ppeterr - should we share a little what we want to do with the shades in a scene etc? to get inspiration and give to others that may read this thread ..

     

    oh.. and for posterity here's the API documentation.

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Posted (edited)
    1 hour ago, Symbiot78 said:

    I can confirm it works as well.

     

    @ppeterr - should we share a little what we want to do with the shades in a scene etc? to get inspiration and give to others that may read this thread ..

     

    oh.. and for posterity here's the API documentation.

    Please login or register to see this attachment.

     

    Sure, give it a little time to complete what i want do and then maybe make a nice topic about it.

    I got still a lot to work out, for the scene's and implementation for that. Also i noticed that once in a while

    it looks like the hub crashes. I've seen this happen before, i dont think it has anything to do with this code.

    Nor with the HC3. Not sure yet.

     

    Also i must tell you, i am very novice with all of this :) Its a pretty steep learning curve when you dont know much 

    about coding and API implementation ect. For now i am setting up 16 different scene's for the 8 button in-wall switch

    i want to use.

     

    Also, the coming week Luxaflex is coming over to adjust the hardware in the powerview setup. Some motors are running

    faster then the one next to it. So, i hope the communication modules wont be replaced. 

     

    [edit] Well that went actually pretty smooth - all scene's linked to buttons :)

     

    Edited by ppeterr
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Thanks @tinman for his code, and @mike79 for his QA i used as a example for 

    my very first steps in coding :)

     

    Very simple, but it works. 2 variables 

     

    1 the IP of the powerview hub

    2 the scene ID, wich to start at a button press.

     

    I will try to work this out to something usefull

     

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    • 0

    @ppeterr - great.. Will test this.

     

    Just as an FYI ..

     

    the powerview module - which comes from Fibaro - that you can install ...

    I think I found the problem with it AND the fix.

     

    there's an update parameter set to 60 seconds.. 

     

    yesterday I uninstalled the QA..

    then reinstalled it and set it up.. tested that it works..

     

    Then I changed the update variable from 60 to 480..

     

    Normally.. the QA would not work now.. it's like it just stops working after x time.

    But today it works still.. so that's new..

    • Like 1
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 3 minutes ago, Symbiot78 said:

    @ppeterr - great.. Will test this.

     

    Just as an FYI ..

     

    the powerview module - which comes from Fibaro - that you can install ...

    I think I found the problem with it AND the fix.

     

    there's an update parameter set to 60 seconds.. 

     

    yesterday I uninstalled the QA..

    then reinstalled it and set it up.. tested that it works..

     

    Then I changed the update variable from 60 to 480..

     

    Normally.. the QA would not work now.. it's like it just stops working after x time.

    But today it works still.. so that's new..

     

    Well, i installed the powerview QA, and it shows the HUB as a device. With all the scene's as

    child devices? Is that correct? So normally a QA would take the ID of a scene, and then execute it.

     

    Maybe this method works better, not sure.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 1 minute ago, Symbiot78 said:

    yeah... it is.. but for some reason you cannot actually use the devices in a scene :-|

     

    Now you can :)

    Link to comment
    Share on other sites

    • 0

    how do you mean?

    your fqa?

    just installed it.

    so you add the IP and the scene from powerview you want to run.

    ok.. got it.

    then you can manually add more scenes right?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 2 minutes ago, Symbiot78 said:

    how do you mean?

    your fqa?

     

    Yes.

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Posted (edited)
    16 minutes ago, Symbiot78 said:

    how do you mean?

    your fqa?

    just installed it.

    so you add the IP and the scene from powerview you want to run.

    ok.. got it.

    then you can manually add more scenes right?

     

    You have to extract the scene ID's from the hub. Not the ID's from the HC3

    (in a browser on pc --> http://192.168.1.35/api/scenes" change to your hub ip.

    That ID + the IP you add in the QA.

    Then the QA will be there in the "make scene action" with blocks.

     

    If i find the time, i will try to make it with more scene ID entry's 

     

    Edited by ppeterr
    Link to comment
    Share on other sites

    • 0
    1 hour ago, ppeterr said:

    Thanks @tinman for his code, and @mike79 for his QA i used as a example for 

    my very first steps in coding :)

     

    Very simple, but it works. 2 variables 

     

     

    thank you. @ppeterr

    From beginner to expert.

    Please login or register to see this link.

     

     

    • Thanks 1
    Link to comment
    Share on other sites

    • 0

    I might have a few cents to add, as I am now running this code without the scenes, and directly controlling each unit from PowerView
     

    The "jog" is commented, as I use the position, this would set the Shade to position 50000, where 65535 is fully open and 0 is fully closed
    Motions can be added, which is "jog", "up", "down", "stop", "leftTilt", "rightTilt" og "heart" 
    Adding posKind2 and position2 will also help controlling other types, e.g. vertical blinds is 3, and then you control the tilt, but the posKind2 can be read from http://<PowerViewIpAddress>/api/shades together with the id of each shade. 

    In my case "type" means: 
    6 - duette

    55 - vertical blind

    42 - rollerblind

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • @BrianDS So, just to see if i understand you.

     

    You dont use the scene's, but you send a position to the powerview hub.

    You use the duette shades topdown/bottum up ?

     

    I see you mention "jog".  The installer from luxaflex told me, it would only be posible to

    to use fixed positions. No - up, down, stop.  It would be nice to program a in-wall switch with up/down/stop.

     

    Could you tell me more about it :)

    Link to comment
    Share on other sites

    • 0

    I have problems with this command in QA

     

    function QuickApp:ToggleOn(description)
       self.http:request("http://192.168.178.52:8080/api/device/WZHEIZUNGSTRASSE/changeTemperatureTo?temperatureSetpoint=4", {
            options = {
                data = json.encode(requestBody),
                            method = "PUT",
            },
     
            success = function(response)
                self:debug(response.status)
                self:debug(response.data)
            end,
            error = function(message)
                self:debug("error:", message)
            end
        })
        end
     
    [DEBUG] [QUICKAPP91]: 401
     
    [DEBUG] [QUICKAPP91]: Unauthorized
     
     
    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.

     Share

    ×
    ×
    • Create New...