Luup Code Generator new version 1.028

[quote=“TimAlls, post:40, topic:168307”]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[/quote]

The HTML report only shows 1 device (no others) in my particular case the DAD device.
As you might remember, im on 1.1.1245

more remarks;
Unable to close the app unless by going to the first tab and click quit… major annoyance!

Henk,
Give the DAD control a name…I suggest Z.DAD
This will place the device at the bottom. This plugin display tons of great information. Unfortunately, the JSON outputs all the data as well making a Display Table fun to deal with when most devices only have a few pieces of data.
Try my new Excel Output if you have Excel…it’s a much nicer output than HTML.

Your table is there…you have to scroll to the right to find it!
I will be setting up a special place for the DAD information to go. Most likely it should have an entire table to itself.

I will change the stop button…thanks for the feedback.

Regards
Tim

[quote=“TimAlls, post:42, topic:168307”]Henk,
Try my new Excel Output if you have Excel…it’s a much nicer output than HTML.[/quote]

How about creating comma seperated value lists (.csv) so any spreadsheet can open it, be it excel, calc or whatever)

[quote=“Henk, post:43, topic:168307”][quote=“TimAlls, post:42, topic:168307”]Henk,
Try my new Excel Output if you have Excel…it’s a much nicer output than HTML.[/quote]

How about creating comma seperated value lists (.csv) so any spreadsheet can open it, be it excel, calc or whatever)[/quote]
Sounds like a good idea…

I found several small bugs and fixed that as well as giving you options on the way you view your Device Data…this will help with older firmwares
I moved the quit button to where it is always seen.

Latest Version: [url=http://www.box.net/shared/rq4cvjf5e0]http://www.box.net/shared/rq4cvjf5e0[/url]

Regards
TimAlls

The Excel option is wonderful!

My Schlage locks don’t show up as an option in the code generator examples.

Is there a way to show the actual scene information other than whether it’s active or not? IOW, what the scene is supposed to do?

Just saw something else- A scene is showing as active (showing “1”) although the timer is turned off on that scene. Am I reading this correctly?

Edit to add: The code report generator is showing incorrect Device ID matchup. The “Pick Device” name doesn’t match the Device ID, and the data as such is incorrect.

Ie My front porch light is actually device ID #7 and is showing up as #8. It also shows the temperature is set at 70 and it’s cooling!! And I don’t think I have a Device ID #8 at all…

[quote=“ballroller, post:46, topic:168307”]Just saw something else- A scene is showing as active (showing “1”) although the timer is turned off on that scene. Am I reading this correctly?

Edit to add: The code report generator is showing incorrect Device ID matchup. The “Pick Device” name doesn’t match the Device ID, and the data as such is incorrect.

Ie My front porch light is actually device ID #7 and is showing up as #8. It also shows the temperature is set at 70 and it’s cooling!! And I don’t think I have a Device ID #8 at all…[/quote]

{ “name”: “Front Porch Light”, “altid”: “7”, “id”: 8, “category”: 3, “room”: 6, “parent”: 1, “status”: “0”, “heatsp”: “70” }
(it is easy to mix up altIDs with ID’s…your front porch light is #8)

As for the thermostat and scene, search your Json Report and it will show if the program is reading incorrectly.
EG: { “name”: “Den Thermostat”, “altid”: “5”, “id”: 6, “category”: 5, “room”: 22, “parent”: 1, “mode”: “CoolOn”, “temperature”: “71”, “heatsp”: “63”, “coolsp”: “69”, “status”: “1”, “humidity”: “67”, “state”: -1, “comment”: “” }

I give you the Heat Set Point (63) and the CoolSet Point (69), temperature (71) and the Mode (“CoolOn”)

The purpose of the Example One Code generator is to set a variable called “Between?” to yes or no. Let me explain where I am going from here…
I believe that code writing for those of us new to Luup (me included) needs to be modular. You create one piece of the code and test it, play with it, an learn to understand how it works. In this case, the larger project could be :
If the door sensor is tripped and it is Between Time A and Time B, and there is no motion, then turn on Light A,B,C and D and blink the porch lights on and off.

That is a lot of code to write for a Newbie. So here is my proposed method:
Write code that sets a variable if between time A and Time B (Var-1)
write code that sets a variable if the motion detector has shown no motion for X minutes (Var-2)
set up a scene and code to blink the light on and off (Sc-1)
create a scene that turns on light A,B,C, and D(Sc-2)

after all this is tested and working write a timer scene that has the following Luup code added:
If tripped and Var1 and Var-2 (all true)
then turn on scene Sc-1 and Sc-2
else return false

The example is not real code …but the method is easy to follow and debug one step at a time.
Thoughts?

I hope that makes sense!

Added Locks: [url=http://www.box.net/shared/cs0bxr7ho1]http://www.box.net/shared/cs0bxr7ho1[/url]

Regards
Tim

Okay, I did get confused between ID and altID, sorry. And then the temperature and heat mode threw me off-until I realized that THAT data was included in my advanced file- for what reason I don’t understand. Why would a light switch show temps and heating mode??

I will look at the Json report and see if there is some strange data in there- if my eyes don’t roll back into my head before I’m done!

Thanks.

Edit: thanks for adding the locks.

Okay, I did get confused between ID and altID, sorry. And then the temperature and heat mode threw me off-until I realized that THAT data was included in my advanced file- for what reason I don't understand. Why would a light switch show temps and heating mode??
I was hoping you could explain the light! Tim

I can’t. Nor can I explain why my Garage Door Lock-inside is showing a temp of 66, and my main patio lights with a temp of 158!!

Your patio light must be overheating. :wink: Do you also see these values in UI4, say in the Advanced tab of the device?

Yes, it’s showing up in the advanced info. Weird.

Perhaps your dimmers report back the dimmer temperature…a handy thing if they do! What brand of dimmers?
The 158 degrees would be correct if you have a lot of lights connected.
Tim

The main patio light switch is not a dimmer. It’s a Leviton switch-not sure if it’s the 5 amp or 15. It only has 2 LED lights drawing max 15 watts!

I knew it was going to be warm out today, but…

No temperature on the VRS05, or VRS15.
It could be that some wrong coding / Luup experiments got those variables in there. Are those values changing at all?

The stateid is changing for the temperature sensor, but the temp remains constant at 158… The serviceid shows TemperatureSensor1 which is quite odd for a switch!

No temperature on the VRS05, or VRS15.
It could be that some wrong coding / Luup experiments got those variables in there. Are those values changing at all?[/quote]
Most likely coding with the wrong ID numbers. If you read or write to variables in a device that doesn’t have those variables, it will create them for you. They will show up in the advanced tab and as far as I know can’t be deleted. It is nothing to worry about.
The variable watch tab of my program will pull up everything variable the device has and gives
you the values. Have you tried any Luup code regarding your thermostats? The variables you are seeing are normal thermostat variables.

Example: go into the Luup tab of a scene and add " luup.variable_set(“urn:user-com:serviceId:myvar”,“Ex1_Between?”,“No”,76) "
substitute a valid device number into 76…save luup…refresh UI
activate the scene and the variable “Ex1_Between?” shows up automatically in my variable watch tab or with the standard UI look under advanced tab for that device.

Regards
Tim

Suggestion to either move this thread to Vera Luup & Development and/or lock it as its replaced by the 1.005 thread here
http://forum.mios.com/index.php?topic=6515.0

This software has merged with a larger one that now does Reports, Code, and UI control of devices. The software is functional but still under Development.
Goto this thread for the latest:
[url=http://forum.micasaverde.com/index.php?topic=6515.0]http://forum.micasaverde.com/index.php?topic=6515.0[/url]