Jump to content

Recommended Posts

1 minute ago, petergebruers said:

I like it. The funny thing though is this: the HC2 had "triggers" as comments at the top of the scene code, then HC3 moves away from this and has separate edit windows for condition and action.

The trouble with JSON is ... it needs special diff tool, it does not work well when using classic text diff/merge. Sorting the keys/values might help, I have never tried. Same issue with Lua tables and key/value stores in other languages, they do not define a fixed order (most people assume by that "insertion order" and some "alphabetical order") by design. After all it does not matter if you say "a=1; b=2;" or "b=2; a=1;" when that text represents k/v pairs.

So , my code goes to the trouble to sort the json keys in a stable order just because of this. issue,

Link to post
Share on other sites
9 minutes ago, jgab said:

So , my code goes to the trouble to sort the json keys in a stable order just because of this. issue,

I noticed, I forgot to mention I looked at your code, I always do - LOL ;) - what I meant to say is "I am not sure if sorting it makes diff-ing more usable". But maybe you know the answer. Do you happen to store the resulting files in a (git) repository? Then you'll now if the text diffs are any good...

Link to post
Share on other sites
Posted (edited)
Quote

 

  On 5/11/2020 at 11:33 AM, Krikroff said:

I will test on different platforms ;)

Awesome!

  On 5/11/2020 at 11:34 AM, 10der said:

no issues on win

Generally speaking "no issues" but that "?" issue is an O/S thing so no language can work around that...

 

Work as expected on Windows 7>10, OSX 10.13+, Linux and FreeBSD also...

 

Tested on Mac mini under Sierra (10.13.6):

 

image.thumb.png.c0fbd8a1416f20b8712ba803113810a2.png

 

Scenes backup do the job

 

image.png.9f1a0689da1168a5a43994f5ec667396.png

 

image.png.c38c0503711730b7b429e94d4d2656b1.png


I plan to add an additional file ex: "4-FGKF 601 - Events- [Report] .txt" with basic but useful information: Name, Categories, start mode....

Edited by Krikroff
  • Thanks 2
Link to post
Share on other sites

So, my goal is not backup per se, but to be able to download/edit/upload resources using ZBS.

Now I have backup/download integrated. The flat file format allows for easy upload.

Only supports QuickApps, Scenes, Global variables, CustomEvents, and Locations at the moment (that's what I work with)

 

I do have some minor issues with restoring QuickApps. Posting to /quickApp/ allows for creating a new QA (new id).

Putting to /devices/ with 

   {properties={
            quickAppVariables = <vars>,
            mainFunction = <code>,
            uiCallBacks = <callbacks>,
          }}

allows for modifying an existing QuickApp. But I can't put the whole devices struct, nor add viewLayout. So, if the viewLayout is modified I have to create a new QuickApp - not satisfactory...

 

Anybody know how to update (keeping the id) with more parts of the device struct?

 

The code leverage the ZBS plugin to run the commands but the code is included in the fibaroHC3.lua sdk and could be used from within code run in the editor too

(In fact I run the fibaroHC3.lua in a shell from the plugin to carry out the work)

Link to post
Share on other sites
On 5/10/2020 at 7:38 PM, 10der said:

Peter,  with all due respect to you

https://manuals.fibaro.com/home-center-3-lua-scenes/#conditions

it's NOT JSON

image.png.ad9f53874dbfd89cc3ab56aeade6ac0f.png

 

just proof

 

It's funny. If it's a block scene the conditions part is a json struct. If it's a lua scene it's a Lua table. That inconsistency bit me when I tried to convert scenes.... ;-)

  • Thanks 1
Link to post
Share on other sites
11 minutes ago, jgab said:

If it's a block scene the conditions part is a json struct. If it's a lua scene it's a Lua table.

Ah, that explains my confusion. In January I filed a bug <HC3-345 Type of "Conditions" in api/scenes seems inconstent>. I couldn't quite see at that time why my json decoder sometimes failed, that happened when it is in fact a Lua table. That bug is still in review. I'll post a link to this explanation.

Link to post
Share on other sites
  • 2 months later...
On 5/12/2020 at 6:37 PM, Krikroff said:
 

Work as expected on Windows 7>10, OSX 10.13+, Linux and FreeBSD also...

 

Tested on Mac mini under Sierra (10.13.6):

 

image.thumb.png.c0fbd8a1416f20b8712ba803113810a2.png

 

Scenes backup do the job

 

image.png.9f1a0689da1168a5a43994f5ec667396.png

 

image.png.c38c0503711730b7b429e94d4d2656b1.png


I plan to add an additional file ex: "4-FGKF 601 - Events- [Report] .txt" with basic but useful information: Name, Categories, start mode....

When can we use it?

Link to post
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...