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


HC3 QuickApps coding - tips and tricks


jgab

Recommended Posts

On 10/6/2022 at 10:04 PM, colhemm said:

I have the Device ID and Local key but i'm having trouble trying to work out how to do the rest to integrate it into HC3.

 

two things:

- on TUYA developer page, cloud, api explorer, you can read the Instruction set, please read it and post here, that will be helpful

 

Please login or register to see this image.

/monthly_2022_10/image.png.020223c929706761fe3606448b998f8e.png" />

 

 

- you device is color/music/etc. device, so take the NEO Smart Bulb tuya QuickApp (maybe even work for you immediatelly .. who knows who knows)

 

Please install it, set ip, device and key, save, open edit tab, go to line 21 and set the showdebug to true (and save)

 

    self.showdebug = true

 

Now you should see lot of thing coming in the console window,

 

image.png.db75dd1d4a7c50fabce39222169de923.png

 

if so go to dashboard view and click in that tuya quickapp all the buttons and sliders, then copy all the information from console window and send me it via PM (better - let's not spam here)

 

EDIT: added some "how to use for unkown devices in EDIT2 here

 

Edited by tinman
Link to comment
Share on other sites

  • 1 month later...

Hello,

 

I have a problem with QA Slider read and display value.

 

I have 10 pieces of venatian blinds and I want to adjust with the same time and same value all the venatian blinds lamella.

I created QA with slider to adjust the lamella value and one button for start the necessary Scene.

My idea is that I give the value with the slider and save this value in one Global variable. Next time when I open the QA the slider must show me the latest saved slider value.

 

Here is my QA code:

 

local tmpLamella
function QuickApp:onInit()
    self:debug("onInit")
    tmpLamella = fibaro.getGlobalVariable("LamellaValue", value)
    self:updateView("label", "text", "Label value: " .. tostring(tmpLamella))
    self:updateView("sldLamella", "value", tmpLamella)
    self:updateView("lblLamella", "text", "Lamella open % :" .. tostring(tmpLamella))
end
 
function QuickApp:onSliderChanged(event)
   tmpLamella = event.values[1]
   self:updateView("lblLamella", "text", "Lamella open % :" .. tostring(tmpLamella))
   fibaro.setGlobalVariable("LamellaValue", tostring(tmpLamella))
end

 

Please login or register to see this image.

/monthly_2022_11/image.png.ca246c2477f514bc30d633aeed769e0d.png" />

 

- Write the value to the Global Varieable --> OK, working

- Read the value from the global Variaable --> Ok, working

- Lamella open % --> shows the % of the slider what was adjusted

- Label value just for temporary here for show the init of the QA the Global Variable value

 

The problem is when I close this QA and open again the application read the Global variable and show in the "Lamella open%" and this is good.

But don't move the slider to that position. The slider is stay on the previous position value.

 

If I press the "Edit" for see the QA code and close the QA initalized and all value get the Global Variable value. But just when I go to the Edit --> see the program code.

If I just close and open the slider stay in the previously value and not on the Global Variable value.

 

As in the picture show the Global Variable is 21 but the slider stay in the value 55 what was the previous vaalue adjustment.

 

image.png.3a1cfebf6b1d0d88e7157aba60cda20b.png

image.png.64cb25dcdd3ecd19e993a8b8356040b4.png

 

image.png.9a126c7dd97cc7254065e58b5cf111a9.png

 

Can you help us to solve that issue ?

 

Thank you

Edited by Szakos
Link to comment
Share on other sites

  • Topic Author
  • 1 hour ago, Szakos said:

     

     

    Please login or register to see this link.

    Please login or register to see this link.

     

    Please login or register to see this link.

    Can you help us to solve that issue ?

     

    Thank you

     

    You don't update the label 'label in the QuickApp:onSliderChanged(event) function

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    1 hour ago, jgab said:

     

    You don't update the label 'label in the QuickApp:onSliderChanged(event) function

    Please login or register to see this code.

     

    Hi It dosn't matter the "label" is just for testing there. The problem is when I modify the slider value it will be saved in the Global Variable but if I close and open the QA the slider don't move to the value what is in the Global Variable.

    Edited by Szakos
    Link to comment
    Share on other sites

    10 hours ago, Szakos said:

    Hi It dosn't matter the "label" is just for testing there. The problem is when I modify the slider value it will be saved in the Global Variable but if I close and open the QA the slider don't move to the value what is in the Global Variable.

    Just a guess,

    Maybe its because you set the slider value only in oninit function. 

    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
    Reply to this topic...

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