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


Tiny QuickApp Emulator (TQAE)


jgab

Recommended Posts

fibaroExtra.lua is in the TQAE/lib/fibaroExtra.lua

Yes it it there and correctly loaded in the HC3 QA as a separated file as as well as files UI.lua and Child.lua (I can see the code in the device edit window.

 

 

Can you give me a minimal example the fails?

The failure is not in the api.get function which is very similar to the one you described.

I know that the varaiables are distroyed when TQAE restart but in the onInit I am recreating then .

 

The issue is when I try to use api.put ; the code I am using is the following:

api.put("/profiles/"..curr.."/climateZones/"..dBut,currClimateZones[dBut])--V1.8  Normally ZoneId == dBut

where currClimateZones[dBut] looks like:

{"id":1,"mode":"Manual","properties":{"handMode":"Auto","handSetPointHeating":20,"handSetPointCooling":23}}

This is now working in the TQAE emulator (the HC3 Profiles web page accepts my modification but with still the

ERROR|Bad HC3 call: /plugins/updateView (400)

 

In the HC3 QA, it is not reliable using the same code : some times it does update the HC3 Profiles web page but some times not and without any arror in the log window.

 

For the slider view:

 

Yes, the value is shown when the cursor is moved but below the barr and my finger is just hiddng it.. If there is no other solution, then I will do with it.

 

Link to comment
Share on other sites

  • Topic Author
  • 3 minutes ago, Christb said:

    fibaroExtra.lua is in the TQAE/lib/fibaroExtra.lua

     

     

    Yes it it there and correctly loaded in the HC3 QA as a separated file as as well as files UI.lua and Child.lua (I can see the code in the device edit window.

     

     

     

    Can you give me a minimal example the fails?

    The failure is not in the api.get function which is very similar to the one you described.

    I know that the varaiables are distroyed when TQAE restart but in the onInit I am recreating then .

     

    The issue is when I try to use api.put ; the code I am using is the following:

    api.put("/profiles/"..curr.."/climateZones/"..dBut,currClimateZones[dBut])--V1.8  Normally ZoneId == dBut

    where currClimateZones[dBut] looks like:

    {"id":1,"mode":"Manual","properties":{"handMode":"Auto","handSetPointHeating":20,"handSetPointCooling":23}}

    This is now working in the TQAE emulator (the HC3 Profiles web page accepts my modification but with still the

    ERROR|Bad HC3 call: /plugins/updateView (400)

     

    In the HC3 QA, it is not reliable using the same code : some times it does update the HC3 Profiles web page but some times not and without any arror in the log window.

     

    For the slider view:

     

     

    Yes, the value is shown when the cursor is moved but below the barr and my finger is just hiddng it.. If there is no other solution, then I will do with it.

     

     

    I will have another look at the profile api...

     

    In the emulator the lua global variable 

    hc3_emulator

    is defined. It is not defined when running the code on the QA.

     

    Sometimes when I know that the emulator and the hc3 differs I provide both versions an condition it on that variable...

    ex.

    Please login or register to see this code.

    this way the code is movable...

     

     

    Link to comment
    Share on other sites

    Thank you for the trick of using global hc3_emulator condition: I will use it but when I will have found what are the differences of behavior.

    For example, in the TQAE the code gives device table structure like:

    {"action":{"name":"turnOn","args":[],"isUIAction":false},"id":31}}

    but in the HC3 QA the same code is giving:

    {"action":{"args":{},"isUIAction":false,"name":"turnOff"},"id":31}

    The HC3 does not accept args:{} but only args:[]

    How I can make the value of args to be [] in HC3 QA?

     

    Link to comment
    Share on other sites

  • Topic Author
  • Btw, I looked at your profile management. It's quite common that people have their QAs translated using a language table.

    One can make it a little more efficient (less typing) by having a variable pointing at the selected language table and also selecting the language code from the HC3's setting...

    Ex.

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 37 minutes ago, Christb said:

    Thank you for the trick of using global hc3_emulator condition: I will use it but when I will have found what are the differences of behavior.

    For example, in the TQAE the code gives device table structure like:

    {"action":{"name":"turnOn","args":[],"isUIAction":false},"id":31}}

    but in the HC3 QA the same code is giving:

    {"action":{"args":{},"isUIAction":false,"name":"turnOff"},"id":31}

    The HC3 does not accept args:{} but only args:[]

    How I can make the value of args to be [] in HC3 QA?

     

    Have you seen this discussion?

    Please login or register to see this link.

     

    Link to comment
    Share on other sites

    This function: json.util.InitArray({}) works perfectly and now the parent QA works for changing devices action and QA buttons; I have made also the change into TQAE code and it works as well.👍

    Need to find what is wrong with the ClimateZones child api.put.

    For your information,I have discovered another condition for the "Auto" handMode: the slider values must be also within Min/max sliders values of the Profiles web page (4 to 31 for the handSetPointHeating ans 6 to 33 for handSetPointCooling) - I am sure that the update failure in the TQAE were due to non compliant values (I have not find the method to have min/max slider values working in the TQAE web UI). I will add a new control for that.

    Link to comment
    Share on other sites

    Jgab wrote: Btw, I looked at your profile management. It's quite common that people have their QAs translated using a language table

    About the language management, very good idea. I have tried it in the profile_Mgt QA and TQAE but I crashed it : to much changes to do and easy to miss one...so I will leave it like that.

    But I have used it in a new QA I am working on and it works perfectly.

    Thank you!

    Link to comment
    Share on other sites

    jgab wrote: I will have another look at the profile api...

    I am comming back about this issue: the unreliability of the api.put command for changing the handMode "Auto" is only due to the fact that the real contion is that "handSetPointHeating" value need to be stricly >1 to "handSetPointColling" which means that sometimes value 21°C/22°C is accepted but sometimes not: making the condition as >=2 makes QA request is 100% accepted by HC3.

    So now, TQAE and HC3 QA are working well and similar.

    Sorry to have bothered you with that lack of knowledge about how the climate zone is working.

    • Like 1
    Link to comment
    Share on other sites

    Have you been able to integrate into TQAE web UI the select button?

    If yes what are the --%% declaration to do?

    Link to comment
    Share on other sites

  • Topic Author
  • 8 minutes ago, Christb said:

    Have you been able to integrate into TQAE web UI the select button?

    If yes what are the --%% declaration to do?

    No, I have not. 
    I'm not actively developing TQAE anymore as I use my VScode emulator these days. (It has support for select button)

    The vscode emulator don't support proxies yet but I rarely need that these days (it's not too difficult to implement though)

     

    ...but it's open source so you are free to dive in and add it ;-) 

    Edited by jgab
    Link to comment
    Share on other sites

    Thanks for update which put me in sort of catch22 situation:

    - I am almost sure that I didnt have the capability to modify your code to add the "select" button - I even have any clue in which lua file this has to be done.

    - I can move to VScode (I presume the VisualStudio version of TQAE) but I still need proxy feature because of the way the Smartphone application displays QA. I need to make a lot of tests before uploading my QA as the TQAE allows more UI configurations than the HC3 QA editor... 
    Any chance that you add this feature in a reasonable time frame?

     

    Link to comment
    Share on other sites

  • Topic Author
  • 1 hour ago, Christb said:

    Thanks for update which put me in sort of catch22 situation:

    - I am almost sure that I didnt have the capability to modify your code to add the "select" button - I even have any clue in which lua file this has to be done.

    - I can move to VScode (I presume the VisualStudio version of TQAE) but I still need proxy feature because of the way the Smartphone application displays QA. I need to make a lot of tests before uploading my QA as the TQAE allows more UI configurations than the HC3 QA editor... 
    Any chance that you add this feature in a reasonable time frame?

     

    No, I don't run TQAE in vscode. It's a new emulator but it has inherited a lot from TQAE - like the headers for declaring UI etc. The emulated UI is better and more responsive (self-updating).

    In general it has more features and t's easy to upload and update the HC3 from vscode with builtin vscode tasks.

     

    So, I've just implemented the "zombie mode" feature for vscode.

    This means that the emulator takes over a HC3 QA by installing a small QA file that intercepts all fibaro.call and UIevents to the HC3 QA and sends them to a running QA in the vscode emulator instead (I call the emulator 'fibemu'). Updates to UI and QA properties for the emulated QA is then reflected to the HC3 QA.

    When the emulator is not running the HC3 QA returns to it normal operations...

    I believe that is a better model then the Proxy version...

     

    I will write some docs in the vscode thread.

     

    Link to comment
    Share on other sites

    • 2 weeks later...

    You I right I need to use an emulator that will be updated ; so I was willing to migrate to vscode:

    I succesfully have installed:

    - Vscode v1.85.2 with its lua Debug extension

    - Python v3.12

    But I have not been able to run the command in Python : pip install -r requirements.txt

    In Python terminal I am getting a syntax error without exlanation

    in the Vscode Python extension I have also an error  like:

    PS D:\Mes_documents_perso\St_Loup\St_Loup_Travaux_et_Fournisseurs\Electricité\Domotique\Domotique_ST_Loup\HC3\Vscode> pip install -r requirements.txt

    ERROR: Invalid requirement: '{"payload":{"allShortcutsEnabled":false,"fileTree":{"":{"items":[{"name":".vscode","path":".vscode","contentType":"directory"},{"name":"examples","path":"examples","contentType":"directory"},{"name":"lib","path":"lib","contentType":"directory"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":"FibEmu.pdf","path":"FibEmu.pdf","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"config.json.example","path":"config.json.example","contentType":"file"},{"name":"requirements.txt","path":"requirements.txt","contentType":"file"}],"totalCount":9}},"fileTreeProcessingTime":2.2463040000000003,"foldersToFetch":[],"reducedMotionEnabled":null,"repo":{"id":654758619,"defaultBranch":"main","name":"fibemu","ownerLogin":"jangabrielsson","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2023-06-16T22:09:54.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/1991075?v=4","public":true,"private":false,"isOrgOwned":false},"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"main","listCacheKey":"v0:1686953396.80311","canEdit":false,"refType":"branch","currentOid":"498012dd2110d383b77592ca609cd832d429b5a7"},"path":"requirements.txt","currentUser":null,"blob":{"rawLines":["fastapi==0.100.0","lupa==2.0","paho_mqtt==1.6.1","pydantic==1.10.9","Requests==2.31.0","requests_async==0.6.2","uvicorn==0.22.0","websocket_client==1.6.1","jinja2==3.1.2"],"stylingDirectives":[[],[],[],[],[],[],[],[],[]],"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/jangabrielsson/fibemu/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null,"repoAlertsPath":"/jangabrielsson/fibemu/security/dependabot","repoSecurityAndAnalysisPath":"/jangabrielsson/fibemu/settings/security_analysis","repoOwnerIsOrg":false,"currentUserCanAdminRepo":false},"displayName":"requirements.txt","displayUrl":"https://github.com/jangabrielsson/fibemu/blob/main/requirements.txt?raw=true","headerInfo":{"blobSize":"153 Bytes","deleteInfo":{"deleteTooltip":"You must be signed in to make or propose changes"},"editInfo":{"editTooltip":"You must be signed in to make or propose changes"},"ghDesktopPath":"https://desktop.github.com","gitLfsPath":null,"onBranch":true,"shortPath":"83b8b8e","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fjangabrielsson%2Ffibemu%2Fblob%2Fmain%2Frequirements.txt","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"9","truncatedSloc":"9"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplateHelpUrl":"https://docs.github.com/articles/about-issue-and-pull-request-templates","issueTemplate":null,"discussionTemplate":null,"language":"Text","languageID":372,"large":false,"loggedIn":false,"newDiscussionPath":"/jangabrielsson/fibemu/discussions/new","newIssuePath":"/jangabrielsson/fibemu/issues/new","planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/jangabrielsson/fibemu/blob/main/requirements.txt","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","dismissStackNoticePath":"/settings/dismiss-notice/publish_stack_from_file","releasePath":"/jangabrielsson/fibemu/releases/new?marketplace=true","showPublishActionBanner":false,"showPublishStackBanner":false},"rawBlobUrl":"https://github.com/jangabrielsson/fibemu/raw/main/requirements.txt","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"repoOwner":"jangabrielsson","repoName":"fibemu","showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","showDependabotConfigurationBanner":false,"actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":{"timed_out":false,"not_analyzed":true,"symbols":[]}},"copilotInfo":null,"copilotAccessAllowed":false,"csrf_tokens":{"/jangabrielsson/fibemu/branches":{"post":"n3xaiGTOVIppduK7okiDrHMY_QEsun_bvCCno8oevtsqaJyS3zm76t8YBvzV1mQiiSRgaGCaATJkdAsKx4ONtA"},"/repos/preferences":{"post":"PkKXTJzvTee_RRcDmIm6MugkxabOvlQPtcHWiioL6j0vDul1KZD9kvX_HXIGdDUwdDvnicUgwziJdgWb52Xq2A"}}},"title":"fibemu/requirements.txt at main · jangabrielsson/fibemu"}' (from line 1 of requirements.txt)

     

    I am pretty sure that it is the consequence of my hard disk configuratio: it is cut in tow equal sub disk (C/ and D/) but it is now full with all installed applications.

    All files are in PS D:\Mes_documents_perso\St_Loup\St_Loup_Travaux_et_Fournisseurs\Electricité\Domotique\Domotique_ST_Loup\HC3\Vscode and the requirements.txt may not be correct;

    Do I have a way to inspect this txt file in a readable maner?

     

     

     

    Link to comment
    Share on other sites

    1 hour ago, Christb said:

    You I right I need to use an emulator that will be updated ; so I was willing to migrate to vscode:

    I succesfully have installed:

    - Vscode v1.85.2 with its lua Debug extension

    - Python v3.12

    But I have not been able to run the command in Python : pip install -r requirements.txt

    In Python terminal I am getting a syntax error without exlanation

    in the Vscode Python extension I have also an error  like:

    PS D:\Mes_documents_perso\St_Loup\St_Loup_Travaux_et_Fournisseurs\Electricité\Domotique\Domotique_ST_Loup\HC3\Vscode> pip install -r requirements.txt

    ERROR: Invalid requirement: '{"payload":{"allShortcutsEnabled":false,"fileTree":{"":{"items":[{"name":".vscode","path":".vscode","contentType":"directory"},{"name":"examples","path":"examples","contentType":"directory"},{"name":"lib","path":"lib","contentType":"directory"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":"FibEmu.pdf","path":"FibEmu.pdf","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"config.json.example","path":"config.json.example","contentType":"file"},{"name":"requirements.txt","path":"requirements.txt","contentType":"file"}],"totalCount":9}},"fileTreeProcessingTime":2.2463040000000003,"foldersToFetch":[],"reducedMotionEnabled":null,"repo":{"id":654758619,"defaultBranch":"main","name":"fibemu","ownerLogin":"jangabrielsson","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2023-06-16T22:09:54.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/1991075?v=4","public":true,"private":false,"isOrgOwned":false},"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"main","listCacheKey":"v0:1686953396.80311","canEdit":false,"refType":"branch","currentOid":"498012dd2110d383b77592ca609cd832d429b5a7"},"path":"requirements.txt","currentUser":null,"blob":{"rawLines":["fastapi==0.100.0","lupa==2.0","paho_mqtt==1.6.1","pydantic==1.10.9","Requests==2.31.0","requests_async==0.6.2","uvicorn==0.22.0","websocket_client==1.6.1","jinja2==3.1.2"],"stylingDirectives":[[],[],[],[],[],[],[],[],[]],"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/jangabrielsson/fibemu/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null,"repoAlertsPath":"/jangabrielsson/fibemu/security/dependabot","repoSecurityAndAnalysisPath":"/jangabrielsson/fibemu/settings/security_analysis","repoOwnerIsOrg":false,"currentUserCanAdminRepo":false},"displayName":"requirements.txt","displayUrl":"https://github.com/jangabrielsson/fibemu/blob/main/requirements.txt?raw=true","headerInfo":{"blobSize":"153 Bytes","deleteInfo":{"deleteTooltip":"You must be signed in to make or propose changes"},"editInfo":{"editTooltip":"You must be signed in to make or propose changes"},"ghDesktopPath":"https://desktop.github.com","gitLfsPath":null,"onBranch":true,"shortPath":"83b8b8e","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fjangabrielsson%2Ffibemu%2Fblob%2Fmain%2Frequirements.txt","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"9","truncatedSloc":"9"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplateHelpUrl":"https://docs.github.com/articles/about-issue-and-pull-request-templates","issueTemplate":null,"discussionTemplate":null,"language":"Text","languageID":372,"large":false,"loggedIn":false,"newDiscussionPath":"/jangabrielsson/fibemu/discussions/new","newIssuePath":"/jangabrielsson/fibemu/issues/new","planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/jangabrielsson/fibemu/blob/main/requirements.txt","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","dismissStackNoticePath":"/settings/dismiss-notice/publish_stack_from_file","releasePath":"/jangabrielsson/fibemu/releases/new?marketplace=true","showPublishActionBanner":false,"showPublishStackBanner":false},"rawBlobUrl":"https://github.com/jangabrielsson/fibemu/raw/main/requirements.txt","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"repoOwner":"jangabrielsson","repoName":"fibemu","showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","showDependabotConfigurationBanner":false,"actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":{"timed_out":false,"not_analyzed":true,"symbols":[]}},"copilotInfo":null,"copilotAccessAllowed":false,"csrf_tokens":{"/jangabrielsson/fibemu/branches":{"post":"n3xaiGTOVIppduK7okiDrHMY_QEsun_bvCCno8oevtsqaJyS3zm76t8YBvzV1mQiiSRgaGCaATJkdAsKx4ONtA"},"/repos/preferences":{"post":"PkKXTJzvTee_RRcDmIm6MugkxabOvlQPtcHWiioL6j0vDul1KZD9kvX_HXIGdDUwdDvnicUgwziJdgWb52Xq2A"}}},"title":"fibemu/requirements.txt at main · jangabrielsson/fibemu"}' (from line 1 of requirements.txt)

     

    I am pretty sure that it is the consequence of my hard disk configuratio: it is cut in tow equal sub disk (C/ and D/) but it is now full with all installed applications.

    All files are in PS D:\Mes_documents_perso\St_Loup\St_Loup_Travaux_et_Fournisseurs\Electricité\Domotique\Domotique_ST_Loup\HC3\Vscode and the requirements.txt may not be correct;

    Do I have a way to inspect this txt file in a readable maner?

     

     

     

    You have to install Python v3.11 and deinstall 3.12. That should work ...

    Link to comment
    Share on other sites

  • Topic Author
  • 31 minutes ago, petrkl12 said:

    You have to install Python v3.11 and deinstall 3.12. That should work ...

    Yes, the Python Lua wrapper used (Lupa)  does not support 3.12 yet. (There is a patch and it will be released soon afaik)

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