Luup Code Generator new version 1.028

You guys are too much! Thanks.
I am back in town and back to work…more to come.
Tim

  1. congratulations

  2. MCV should pay you a consultants fee for doing their job for them. Some time ago and on more than once occasion they mentioned creating a code generator such as this because it was too complex to fix the back end and create the UI for it anytime soon.

THANKS!

I’m always amazed when a single human being whips out a solution so quickly and for free while a related commercial concern can’t seem to get right. Very impressive!

Hi Tim,

thanks for your hard work.
Just to let you know:
The reporting tool doesn’t get my switches, dimmers and sceenes right. There is an awful lot missing. What firmware version do you test with?
I am currently on 1.1.1047 on Vera 1 and am just scared to change anything.
I have attached the json report that is collected by the verareport tool.
Maybe this this helps
Cheers
Umtauscher

Hi Tim,

sorry, I didn’t realize that you are already on version 3.
Maybe this thread should me closed then.
Thanks again
Umtauscher

[quote=“umtauscher, post:24, topic:168307”]Hi Tim,

sorry, I didn’t realize that you are already on version 3.
Maybe this thread should me closed then.
Thanks again
Umtauscher[/quote]
I am going to move all my latest versions to the top of the thread…I will try to make things less confusing.
I will look at you JSON today and see what’s happening.
Regards
Tim

[quote=“umtauscher, post:23, topic:168307”]Hi Tim,

thanks for your hard work.
Just to let you know:
The reporting tool doesn’t get my switches, dimmers and sceenes right. There is an awful lot missing. What firmware version do you test with?
I am currently on 1.1.1047 on Vera 1 and am just scared to change anything.
I have attached the json report that is collected by the verareport tool.
Maybe this this helps
Cheers
Umtauscher[/quote]
The Json file you sent me is totally different in format from the ones I am parsing…It has a lot of []] brackets that don’t add up. Does any one else have a Json file from an older firmware they can share?
Rather than clipping personal data out of the file you can XXXXXX over passwords etc…
Thanks
Tim

Hi Tim,

I did a bit of homework myself and formatted the json file more friendly to the human eye.
There are no missing or analigned brackets in it.
Maybe you’ll have a look at it now to help you better analyze the structure of it. (I hate such interfaces by the way). I find it very confusing that the properties of the devices don’t even have the same lineup. Sometime the name is the first parameter, sometimes the status.
Good luck.

Umtauscher

[quote=“umtauscher, post:27, topic:168307”]Hi Tim,

I did a bit of homework myself and formatted the json file more friendly to the human eye.
There are no missing or analigned brackets in it.
Maybe you’ll have a look at it now to help you better analyze the structure of it. (I hate such interfaces by the way). I find it very confusing that the properties of the devices don’t even have the same lineup. Sometime the name is the first parameter, sometimes the status.
Good luck.

Umtauscher[/quote]
That’s funny … That’s exactly what I did…separate it out and look at the formatting.
I have requested documentation from MCV on the format of the file because it has changed so much…my concern is will I be compatible with the next Firmware?
The part that surprised me about your file was that “[” brackets sometimes were not followed by the “]” opposite closeout bracket and that the section layout was totally different. In the new version there are Main sections that are easy to identify…Rooms, Scenes, Devices, Categories, Etc… My software grabs that section and separates it out. With the older format the sections around the devices is inconsistent…well let’s say it just doesn’t make sense to me. I will let you know what I find out. For reporting purposes I may have to switch to the XML output to maintain compatability. I chose this format so that I could use it to poll Vera and give updated information for my new UI…thanks for the feedback, it will help me build on a solid base, I am still new to this and learning.

As to the code Generator, I was slowed down a bit but will have something new to look at this weekend!

Regards
Tim Alls
AllSeas Yachts

Hi all,
Just a quick update…
I have delayed releasing the new code generator. Thanks for your patience, it won’t be much longer.
I am taking longer than projected because when I started testing the code I realized the need for more tools. The main thing that bugs me as a novice to Luup is trying to debug the code…what went wrong!
The tool I am working on right now is a variable watch. It will be helpful for all of us to be able to see the variables in the code being displayed as they change. For example, I am working on the code for “run a scene if the door is open for a set amount of time”. I want to have my program display all the variables in the code so that you can see the door status, watch the door timer, etc. Etc… This will really help us see the code in action and debug it without pulling out the last remaining hair on our heads!
Stayed tuned…good things are coming.
Regards
Tim Alls
AllSeas Yachts

@TimAlls

Tim, i was wondering, would your code generator be able to generate code like this?

http://forum.micasaverde.com/index.php?topic=6613.0
http://forum.micasaverde.com/index.php?topic=6309.0
or
http://forum.micasaverde.com/index.php?topic=6589.0

Im curious what your implementation could do!

TimAlls, I agree with you it is frustrating to not being able to debug one code without trial/error. On thing to consider especially with time based code or duration code of somehow being able to shorten the duration in order to watch the code real time execute without having to wait for sunset/sunrise or 11:30pm. Patiently awaiting

With all this work that your doing, me thinks you should be looking for donations (shareware wise) once the code becomes more stable, I for one will donate… ;D

Mike

@Michael,
I agree with what you are saying about watching time. My original ideas went out the window when I started writing and testing code.
I am a visual person…show me what’s going on! That’s the way I learn. Just finished a variable watch routine and you sparked an idea…in addition to watching the variable it would be nice to change…or push time forward. I will work on that as well. One needs to create the code and accelerate the timing and watch events take place, other wise you will take days to debug the code.
I have to start another topic right now because I am creating new variables in the advanced tab of devices and using them in my code.that way I can watch them as well. Very easy but will it have any contrary reactions. I don’t want to crash the little bugger!
More to come…
Regards
Tim

Code Generator Version 1.0:[url=http://www.box.net/shared/4sv0ocdfc8]http://www.box.net/shared/4sv0ocdfc8[/url]

Hi All,
I think the hard work is starting to pay off! The variable watch program is working well and it has allowed me to test code very quickly. I am able to place variables after every calculation or command if needed to see what is going on.
The Report Generator is now merging with the Code Generator…so they are the same from here on out.
The idea is that we parse the system and create a unique set of tables to draw off of for our drop down boxes…in other words you don’t have to remember your ID numbers, it remembers for you.
This is the first of the series I will be posting for code generation. This is version 1.0 and it needs you to try it out and give me feedback. Goto the tab for code and follow the line by line instructions…it walks you through a step at a time. When you are done you will have a scene that will operate only from timeA to timeB. You will be able to adjust the time by using the Vera UI…under the advance tab for the device. You will be able to watch variables update every minute when the scene timer runs and you can see the results of the math used…
Check it out. If it makes sense and is easy to use, then I will push on.
Thanks for your help in this project.

Regards
Tim Alls
AllSeas Yachts

@TimAlls, question I notice that both the report and code generator for some reason only display devices A-L all of my M-Z lettered devices are missing ??? Mike

I must have screwed something up…ha. I have your JSON…I will plug it in and test it.

I would love it if you could look at the presentation of the code tab and give me feedback. I want to lay a foundation for a lot of code to be placed so now is the time to make adjustments. As a user trying to
learn code what could be better. Don’t worry about nit pickin…it all helpful and you won’t step on my toes. Same for the rest of you.
Regards
Tim

Here is the latest:
Rebuilt the parsing routines to read older Firmware.
Added new reports…auto export straight into Excel for easy formatting
Added new UserData2 report
Added settings file to remember your IP
Fixed camera missing : on IP address
Reads German Json files
Easy drop down boxes for Variable Watch
Easy drop down box that fills in the Code…just copy and paste

I still need feedback on the code generator…try it out.

Regards
Tim Alls
AllSeas Yachts

Hi Tim,

I finanally had the time to check it out.
Its much better now, but my older firmware still seems to have a will of its own.
I get only 1 room, while as you can see from the snippet of usredata2 there are 8.
I suppose the json interface of my firmware simply doesn’t do it.
Thanks
Umtauscher

[quote=“umtauscher, post:37, topic:168307”]Hi Tim,

I finanally had the time to check it out.
Its much better now, but my older firmware still seems to have a will of its own.
I get only 1 room, while as you can see from the snippet of usredata2 there are 8.
I suppose the json interface of my firmware simply doesn’t do it.
Thanks
Umtauscher[/quote]
The older firmware doesn’t have as much information as the new firmware. I rewrote the coding to make sure the devices and scenes would come through. You should be able to run the Variable Watch as well as the new Code Generator. Just ignore the rooms and categories for now…
I hope you find the program useful. I am adding more code examples as well as lock support today.
Just an interesting note:
When I ran your HTML reports using Google Chrome it ask me if I wanted it to translate the file from German to English…I said why not, and it automatically translated everything perfectly!

Ich hoffe, Sie genießen die Software

Regards
Tim

Hi Tim,

So you went for converging the Report tool and the Code generator? Not bad!

Here are a few remarks:

  1. HTML report for devices

    • No header line for colums
    • Only 1 device is shown
    • Difficult to read dus to narrow columns
  2. HTML report for scens

    • Clearly readable (well designed table)
    • No colum headers (what value is what?)
  3. Rooms tab

    • Due to fixed column width not all data is readable to humans.

(option to have columnwidth scalable to contents (up till a max and then start to wrap text?)

As for the code page, after i have had some time to play with it ill write a How To following your 7 steps.
Maybe its usefull to get some of your work listed here:
http://wiki.micasaverde.com/index.php/Scripts_for_scenes

–edit–
Where are the settings (on IP) stored? The app says c:\settings.txt but i cant locate the file there.
What if i needed to change the IP manually?
Is it doable to store the settingsfile in the same path as the app?

Thanks Henk,

[code]1. HTML report for devices

  • No header line for colums
  • Only 1 device is shown
  • Difficult to read dus to narrow columns
    [/code]
    I added the Excel output to help with the problem. The JSON outputs vary widely as to the column formats and I can’t keep up with the variations from Firmware to firmware. My solution is transfer the information into a spreadsheet and let the user edit the format to fit his system and firmware. I want to move on to the bigger task at hand…code generation and a PC based UI for touchscreen computers and laptops.
    Please explain only one device is shown…Is the program not detecting all your devices?
    I rewrote my code to read older firmwares so I am hoping I didn’t break something in the process!

I regards to Coding, I am new to Luup coding so I am relying on code donations from other programmers…no offers yet.
I am hoping some Newbies will try out my example and let me know if the program helps bridge the fear of adding Luup code to their scenes.
We will see!

Regards
Tim