Author Topic: Development Input/Assistance wanted  (Read 235 times)

Offline kdschlosser

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +2/-4
Development Input/Assistance wanted
« on: November 15, 2017, 02:06:04 pm »


OK this is what I am doing. I am in the process of creating a full featured python library to access/control the devices/plugins on a Vera.

As we do know the API changes on the Vera on almost a per release basis which makes maintaining code for anything external (I am sure for the internal plugins ass well) very daunting and stressful. So this API that I am writing currently uses several mechanisms that are built into the Vera and do not appear to have changed in some time so I am hoping they are not going to for a while longer. But there is only 1000 lines of code to maintain for this portion of it. I am using a combination of invoke, get_upnp_files.sh and view_upnp_file.sh to automatically generate the various class/sub classes of the upnp device framework. This portion of it is almost complete I am running into some variations between firmware for the different models (I believe) This I am testing to make sure.

Because the class structure is dynamic and changes as the Vera changes any change in API will be automatically added into the python API. If there is a change to the 3 mechanisms that are used to gather this information changes it is a very small amount of code to have to make adjustments to. The nice things about this as well is that any plugins that have special methods/actions will be accessible from this API without the need to manually create support for it.

Now I know there are large portions of the Vera which are undocumented If there is anything that could help me out in in this endeavor would be a big help. Actually any information as how to access various portions of the Vera would be welcome and I will start building a collection of them and document what they do and how they work and make it available.

The Vera is a good unit if you do not use the current UI it runs and is pretty stable for the most part so long as you do not over burden it. So the purpose to this python connector would be to offload some of the things that would burden it like complex scenes plugins for extensive control of a device that is not native to the Vera and there are python libraries available for these.

I want to make a means to be able to create new devices on the Vera for devices that are technically speaking attached to the Vera so any variable changes would be seen in the connector and then passed along to where ever it needs to go. or if there is a function calls to do something to one of these devices then it would be passed. this will reduce the workload on the Vera a vast amount while also expanding it's ability to control just about anything that has the ability to communicate. without he need to worry about complex code causing the Vera to crash or the Vera running out of memory because it has to store large data sets that may not be used all the time.

Plus it also gives a developer/user a means to make a complex UI for the Vera without a huge risk of ever causing issues on the Vera .

It would make updating the UI vastly easier because there wouldn't be the need to have to backup everything then reset the Vera to defaults do the update and then a restore hoping that the restore works properly. anything that would be added with this API would automatically put back into place once the connection was established again.

using an API like this a GUI could be created that is not web based.

My goal is to allow the user of the API to register callbacks for events (changes to variables) so when a variable changes an event would take place if there is a callback registered for that event it would be called and the new data would be passed to it allowing the user to perform other tasks based on the data (scenes). A new thread would be created for each event allowing for parallel running of these callbacks. so if a callback has a looping condition or some kind of a wait. or maybe just complex code it will not hold up the processing of other callbacks taking place. The only hangup would be only one command or request to the Vera would be made at a time so not to flood it. But the calls made to it should be simple tasks like turn this on or set a specific variable to this. and should only take a brief moment.


I have the code generation bits set into place. I have only tested it on my Vera which is a 3. if there is anyone willing to test (having some basic knowledge of python) I have a couple of test scripts already made up that would allow me to see if there are any variations between the models. If there is anyone that has any ideas my ears are open. doesn't matter how trivial it is these kinds of thoughts are what lead to larger much better features. If you want to help out. Great! you don't even have to know how to program. I have no issues with teaching. Ya have to start somewhere. and ya never know you could be the next rock star in the programming world. The words "I don't know how" don't apply here. You do know how to read. Then you know how to do anything you want. Ya just have to spend the time to read. and Ask questions.

I am going to be setting up a GitHub repository for this in the next day or 2. This is very early development But I feel if the right people want to help and there is information submitted on how to access the various bits of the Vera. There could be a working version pretty quickly. If I have to reverse engineer the Vera it is going to take a much longer amount of time. so any information that is available, lay it on me. I am all for time saving help.

Thanks again
K



Offline kdschlosser

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +2/-4
Re: Development Input/Assistance wanted
« Reply #1 on: November 15, 2017, 02:07:19 pm »
so first Issue


There is a large bug I have come across when using invoke and I am unsure of why a class is being displayed in it that is not a subclass of that device/plugin.

Below are 2 code blocks. one containing the html source from the invoke page generated for the World Weather portion of the Vera.
If you look you will notice there are 2 sub classes listed for control
urn:upnp-micasaverde-com:serviceId:Weather1
urn:micasaverde-com:serviceId:HaDevice1

and in the next code block is the device file for the World Weather portion of the vera under the serviceList section of the XML it only lists off one service (sub class)

urn:schemas-micasaverde-com:service:Weather1

so my question is where and why is the service urn:micasaverde-com:serviceId:HaDevice1 coming from?
none of the actions associated in it work it you get the message "ERROR: No implementation"

invoke page source
Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Remote Control</title>
</head>
<body>
<br><i>urn:upnp-micasaverde-com:serviceId:Weather1</i><br><a href="data_request?id=action&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&action=SetUnitsMetric">*SetUnitsMetric</a><br>
<a href="data_request?id=action&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&action=SetUnitsUS">*SetUnitsUS</a><br>
<a href="data_request?id=action&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&action=SetLocation&location=">*SetLocation (location)</a><br>
<a href="data_request?id=action&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&action=SetPeriod&period=">*SetPeriod (period)</a><br>
<a href="data_request?id=action&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&action=SetProviderKey&key=">*SetProviderKey (key)</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Location&Value=">Location</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Metric&Value=0">Metric</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=ProviderKey&Value=6e8b55a33ec7461c">ProviderKey</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=ProviderName&Value=WUI (Weather Underground)">ProviderName</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=ProviderURL&Value=http://www.wunderground.com">ProviderURL</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=LocationUsed&Value=39.632801,-105.323303">LocationUsed</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=LocationUsedText&Value=Soda Creek, Evergreen, Colorado">LocationUsedText</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Condition&Value=Clear">Condition</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=ConditionGroup&Value=clear">ConditionGroup</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=WindCondition&Value=Calm">WindCondition</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=WindDirection&Value=West">WindDirection</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=WindDegrees&Value=262">WindDegrees</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=WindSpeed&Value=0">WindSpeed</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=WindGust&Value=0">WindGust</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Pressure&Value=30.17">Pressure</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=PressureTrend&Value=-">PressureTrend</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=DewPoint&Value=20">DewPoint</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=HeatIndex&Value=">HeatIndex</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=WindChill&Value=43">WindChill</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=FeelsLike&Value=43">FeelsLike</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Solar&Value=339">Solar</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=UV&Value=1">UV</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=LastUpdate&Value=1510768855">LastUpdate</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.1.HighTemperature&Value=64">Forecast.1.HighTemperature</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.1.LowTemperature&Value=45">Forecast.1.LowTemperature</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.1.Condition&Value=Clear">Forecast.1.Condition</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.1.ConditionGroup&Value=clear">Forecast.1.ConditionGroup</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.1.MaxWindSpeed&Value=25">Forecast.1.MaxWindSpeed</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.1.MaxWindDirection&Value=WSW">Forecast.1.MaxWindDirection</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.1.MaxWindDegrees&Value=250">Forecast.1.MaxWindDegrees</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.1.POP&Value=0">Forecast.1.POP</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.1.QPFDay&Value=0">Forecast.1.QPFDay</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.1.QPFNight&Value=0">Forecast.1.QPFNight</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.1.SnowDay&Value=0">Forecast.1.SnowDay</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.1.SnowNight&Value=0">Forecast.1.SnowNight</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.2.HighTemperature&Value=57">Forecast.2.HighTemperature</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.2.LowTemperature&Value=23">Forecast.2.LowTemperature</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.2.Condition&Value=Rain">Forecast.2.Condition</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.2.ConditionGroup&Value=rain">Forecast.2.ConditionGroup</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.2.MaxWindSpeed&Value=20">Forecast.2.MaxWindSpeed</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.2.MaxWindDirection&Value=WSW">Forecast.2.MaxWindDirection</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.2.MaxWindDegrees&Value=253">Forecast.2.MaxWindDegrees</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.2.POP&Value=80">Forecast.2.POP</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.2.QPFDay&Value=0.11">Forecast.2.QPFDay</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.2.QPFNight&Value=0.07">Forecast.2.QPFNight</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.2.SnowDay&Value=0">Forecast.2.SnowDay</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.2.SnowNight&Value=0.2">Forecast.2.SnowNight</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.3.HighTemperature&Value=45">Forecast.3.HighTemperature</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.3.LowTemperature&Value=28">Forecast.3.LowTemperature</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.3.Condition&Value=Clear">Forecast.3.Condition</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.3.ConditionGroup&Value=clear">Forecast.3.ConditionGroup</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.3.MaxWindSpeed&Value=10">Forecast.3.MaxWindSpeed</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.3.MaxWindDirection&Value=W">Forecast.3.MaxWindDirection</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.3.MaxWindDegrees&Value=275">Forecast.3.MaxWindDegrees</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.3.POP&Value=0">Forecast.3.POP</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.3.QPFDay&Value=0">Forecast.3.QPFDay</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.3.QPFNight&Value=0">Forecast.3.QPFNight</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.3.SnowDay&Value=0">Forecast.3.SnowDay</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.3.SnowNight&Value=0">Forecast.3.SnowNight</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.0.HighTemperature&Value=54">Forecast.0.HighTemperature</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.0.LowTemperature&Value=41">Forecast.0.LowTemperature</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.0.Condition&Value=Partly Cloudy">Forecast.0.Condition</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.0.ConditionGroup&Value=partlycloudy">Forecast.0.ConditionGroup</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.0.MaxWindSpeed&Value=10">Forecast.0.MaxWindSpeed</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.0.MaxWindDirection&Value=ESE">Forecast.0.MaxWindDirection</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.0.MaxWindDegrees&Value=117">Forecast.0.MaxWindDegrees</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.0.POP&Value=0">Forecast.0.POP</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.0.QPFDay&Value=0">Forecast.0.QPFDay</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.0.QPFNight&Value=0">Forecast.0.QPFNight</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.0.SnowDay&Value=0">Forecast.0.SnowDay</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecast.0.SnowNight&Value=0">Forecast.0.SnowNight</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Forecasts&Value=3">Forecasts</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:upnp-micasaverde-com:serviceId:Weather1&Variable=Alerts&Value=0">Alerts</a><br>
<br><i>urn:micasaverde-com:serviceId:HaDevice1</i><br><a href="data_request?id=action&DeviceNum=3&serviceId=urn:micasaverde-com:serviceId:HaDevice1&action=Reconfigure">Reconfigure</a><br>
<a href="data_request?id=action&DeviceNum=3&serviceId=urn:micasaverde-com:serviceId:HaDevice1&action=StressTest">StressTest</a><br>
<a href="data_request?id=action&DeviceNum=3&serviceId=urn:micasaverde-com:serviceId:HaDevice1&action=Remove">Remove</a><br>
<a href="data_request?id=action&DeviceNum=3&serviceId=urn:micasaverde-com:serviceId:HaDevice1&action=Poll">*Poll</a><br>
<a href="data_request?id=action&DeviceNum=3&serviceId=urn:micasaverde-com:serviceId:HaDevice1&action=ToggleState">ToggleState</a><br>
<a href="data_request?id=action&DeviceNum=3&serviceId=urn:micasaverde-com:serviceId:HaDevice1&action=SetPollFrequency&PollingEnabled=&PollMinDelay=">SetPollFrequency (PollingEnabled,PollMinDelay)</a><br>
<a href="data_request?id=action&DeviceNum=3&serviceId=urn:micasaverde-com:serviceId:HaDevice1&action=AllowPairing&Seconds=">AllowPairing (Seconds)</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:micasaverde-com:serviceId:HaDevice1&Variable=ChildrenSameRoom&Value=1">ChildrenSameRoom</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:micasaverde-com:serviceId:HaDevice1&Variable=LastUpdate&Value=1510768859">LastUpdate</a><br>
&nbsp;&nbsp;&nbsp;-<a href="data_request?id=lu_variableset&DeviceNum=3&serviceId=urn:micasaverde-com:serviceId:HaDevice1&Variable=Configured&Value=0">Configured</a><br>
</body>
</html>

device file
Code: [Select]
<?xml version="1.0"?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
  <specVersion>
    <major>1</major>
    <minor>0</minor>
  </specVersion>
  <device>
    <deviceType>urn:demo-micasaverde-com:device:weather:1</deviceType>
    <staticJson>D_Weather.json</staticJson>
    <friendlyName>World Weather</friendlyName>
    <manufacturer>World Weather</manufacturer>
    <manufacturerURL>http://en.wikipedia.org/wiki/Weather</manufacturerURL>
    <modelDescription>World Weather Device 1.0</modelDescription>
    <modelName>World Weather</modelName>
    <modelNumber>1.0</modelNumber>
    <modelURL>http://en.wikipedia.org/wiki/Weather</modelURL>
    <protocol>cr</protocol>
    <handleChildren>1</handleChildren>
    <UDN>uuid:Upnp-micasaverde-1_0-1234567890001</UDN>
    <UPC>123456789</UPC>
    <serviceList>
      <service>
        <serviceType>urn:schemas-micasaverde-com:service:Weather:1</serviceType>
        <serviceId>urn:upnp-micasaverde-com:serviceId:Weather1</serviceId>
        <SCPDURL>S_Weather.xml</SCPDURL>
      </service>
    </serviceList>
    <implementationList>
      <implementationFile>I_WUIWeather.xml</implementationFile>
    </implementationList>
  </device>
</root>

Offline kdschlosser

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +2/-4
Re: Development Input/Assistance wanted
« Reply #2 on: November 21, 2017, 04:55:10 am »
Well I have an update on this...

The dynamic building of the files is done. The API supports any and all devices/plugins that the Vera does.

You have these abilities.

Get all variable names and values. and I do mean all of them. Any device and any plugin.
You have the ability to change almost any of the values in those variables. (depends on if the Vera allows the change)
You also get to call any methods and functions that the Vera offers.

ok so here is a rundown

Name Changes:
Rooms
Devices
Users
Sections (Vera Controllers)
Scenes

Room Changes:
Devices
Plugins
Scenes

Deleting:
Scenes
Rooms
Devices
Users
Plugins

Creating/Adding:
Rooms
Devices
Plugins
Users
Scenes

You can also update plugins.

I will put it to you this way. you have almost every single ability that you have in the UI, and you also have a lot of extra abilities that you do not have in the UI

You can check out my GitHub Repository this is where the API is located. There are directions for use there as well.

Keep in mind this is a work in progress and I am adding more functionality to it daily. It may/will have some glitches. I have only been able to test this on my Vera 3. I do not know if there are any differences between the models that could cause a problem. But if there is please create an issue on my repository with the exact error message.

I know it works fine in Microsoft Windows with Python 2.7 I have not tested it on anything else. But I have coded it so it should be able to be used on Python 3+ as well and on Linux.

Drop me a line and lemme know what you think and if there is something specific you would like to see added.

Thanks again
K







Offline parkerc

  • Sr. Hero Member
  • ******
  • Posts: 2371
  • Karma: +33/-45
  • Life Moves Pretty Fast....
    • Node Central
Re: Development Input/Assistance wanted
« Reply #3 on: November 26, 2017, 02:57:27 pm »
Hi K..

Sounds a very interesting project, lots to digest.

Ill certainly have a think of anything that would be of interest to me..

But for now, may I wish you well in this..

Offline kdschlosser

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +2/-4
Re: Development Input/Assistance wanted
« Reply #4 on: November 28, 2017, 02:19:09 am »
TY for the kind words.

The core of the API is finished. It works very well might I add. I have gotten the building of the files down to about 15 seconds (this only has to be done once) and the initial load time of the library (without file building) is at 190 milliseconds. I am hoping I managed to account for the oddities when dealing with the service types and service ids this was a big wrench thrown into the works. There seems to be quite a few typos as well as inconsistencies in a standard naming.

There appears to be one other issue which I am unsure of how to handle. This is a very strange one. I am going to use the VirtualSwitch plugin as an example. This may be due to service ids but I am not sure. But if i set the Status variable instead of setting the variable that already exists it creates another Status variable. not exactly sure as to how this happens or why I do not know the mechanics of how the Vera works internally but I do not understand as to how 2 attributes with the same name can hold 2 different sets of data and can exist in the same device instance.

I am thinking that how the coding is done on the Vera is not a class(subclass) scheme but is possibly an instance for each of the "core" services and the instances do not hold an instance of the device but instead it holds the various data sets. and the device instance makes calls to the service using it's id. This seems rather error prone why not let the device handle it's own data. there would be no difference in system resources and it would also make it so that duplicate variables could not be created. and you would be able to perform all changes only using the device id. and not have to couple the device id with the service id. when making a REST call to change something.

I am going to have to look into the serviceId thing. I am better this is the reason why I am having that specific problem.

I still have some things that need finishing. I have the scenes almost completely finished up. I have to make some changes to the timers portion of it and I also need to generate the JSON to send to create/change a scene. I have to add the variableset commands for the weather settings also. other then that I do not think there is to much else that needs to be done.

I am also started making a library based scene controller. so instead of having the Vera handle scenes the python library will.

If there is someone that if familiar with how to make plugins for the Vera and is willing to lend a hand. what I would like to do is create a code generator for the library that can be used to add devices to the Vera. This could be used to pass information back and forth between the Vera and some thing that is controlled by a computer. as an example. if you have motion sensors it would be nice to have a scene that if the motion sensor was not detection motion for say 5 minutes it would power down the monitor on the PC. or press a specific button on a keypad to have it fire up your AV system. or if you wanted to be able to view what is currently playing on your TV from ImperiHome you could through the use of a device but without the need for the vera to hold all of the complex code required to gather the information or the processor ticks to gather the information. So if there is someone that is interested in helping out drop me a line.

Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 9918
  • Karma: +748/-141
    • RTS Services Plugins
Re: Development Input/Assistance wanted
« Reply #5 on: November 28, 2017, 10:23:08 am »
Data on Vera is NOT uniquely defined by the DeviceID and the Variable Name.

It IS uniquely defined by the DeviceID, ServiceId, and Variable Name.

You MUST use the correct ServiceID.

Offline kdschlosser

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +2/-4
Re: Development Input/Assistance wanted
« Reply #6 on: November 30, 2017, 10:58:09 am »
yup. I got that figured out as well. I had to rewrite a good chunk of it because of this. It is in good shape now. and I am not getting what I thought was double events. I did however have to add the service ID to the events well the last section of the service ID. I did not like having to do that because it adds more complexity. but it is what it is. Thanks for the heads up tho. The help is always appreciated.