MiCasaVerde Vera UI5, UI6, UI7 Plugin

Questions and comments specific to a particular plugin should go here.
User avatar
kgschlosser
Site Admin
Posts: 4317
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: MiCasaVerde Vera UI5, UI6, UI7 Plugin

Post by kgschlosser » Fri Nov 10, 2017 4:39 am

Oh i may have. can't remember it has been so long since I have done any kind of an update to this thing.


I do want to let everyone know I have been working on this the past 2 days.
This is going to be my last major release of this thing i do I have resurrected my Vera once again to be able to test this thing out. But here are the details on how this is going to work


Auto Discovery of the Vera --- Working
Automatic building of categories --- Working
Automatic building of service control files --- Working
Automatic discovery and building of service functions --- Working
Automatic discovery and building of service attributes/properties --- Working

What this all means is it doesn't matter if a plugin or a device that gets made a year from now. The program is going to automatically build the code for the new device/plugin exposing every single variable and every single function that can be used on that device/plugin. I found that I am able to gather this information from the Vera through the use of upnp and a lot of ingenuity. So as an example. if you wanted to change the name of a specific user.. you can do that now. or if you wanted to change the default temperature unit, you can do that now also.

as an example.. These are the functions you will be able to perform for dimmers. Now these methods get built based on what your dimmer switch supports. so there could be more functions or there could be less. all I do know is that the documentation for the Vera API really sucks. because it only provides information on set_load_level_target and get_load_level_status and doesn't even say anything about the existence of the rest of them. I do not know as of yet what some of these will do. But I am sure i will find out soon enough.

set_load_level_target
get_load_level_target
get_load_level_status
set_on_effect_level
set_on_effect
get_on_effect_parameters
step_up
step_down
start_ramp_up
start_ramp_down
stop_ramp
start_ramp_to_level
set_step_delta
get_step_delta
set_ramp_rate
get_ramp_rate
pause_ramp
resume_ramp
get_is_ramping
get_ramp_time
get_ramp_paused

The Vera is not all that bad of a unit. if I had the time and want to strip UI7 from the thing and have it only run via API it would probably work perfectly.

Oh and you will also be able to install/update plugins on the Vera as well. I am going to provide more control of the thing then the stock UI does.
If you like the work I have been doing then feel free to Image

holdestmade
Experienced User
Posts: 176
Joined: Thu Dec 04, 2014 2:44 pm

Re: MiCasaVerde Vera UI5, UI6, UI7 Plugin

Post by holdestmade » Fri Nov 10, 2017 8:12 am

Looking good, can't wait to try it.

Cheers

User avatar
kgschlosser
Site Admin
Posts: 4317
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: MiCasaVerde Vera UI5, UI6, UI7 Plugin

Post by kgschlosser » Fri Nov 10, 2017 3:27 pm

its going to take me a while to get it all together. I do wish there was someone that would be willing to do up the EG side of things. I have changed up how I am making plugins. I make them now in 2 distinct components and the API side can be run without EG if needed. makes it easier to maintain that way.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 4317
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: MiCasaVerde Vera UI5, UI6, UI7 Plugin

Post by kgschlosser » Sat Nov 11, 2017 12:46 pm

if someone wants to be my guinea pig that would be a big help.

this is only going to run on EG 0.5
The attached file can be run by going to your EventGhost install folder and typing in

Code: Select all

pyw PATH/TO/THE/FILE/vera_build.py
It will automatically detect the vera on your network. and it will also build a bunch of files in your %appdata%\MicasaVerde_Vera folder.

If you wouldn't mind zipping up those files and sending them on over to me that would be a big help. The more people that do this the more I will be able to work out an possible little quirks because of different devices. This script does take a minute to run in the final version of it it will check to see if the file is already made and if so it will skip the process. making it a lot faster. I am going to also give the user the ability to tweak the SSDP wait time at the moment i believe i have it set for 10 seconds.

if there are any errors a copy of those would be helpful also.

This script is what builds all of the core files and allows for the new plugin to be dynamic so unless the folks over there make some kind of a radical API change (change how I am asking for this information) this should become the final version

I have not tested the thing with the pyw. so if it does not work then put the script into you eg\lib27\site-packages folder
run EG and add the code below to a python script and run it

Code: Select all

import vera_build
vera_build.main()
thanks in advance
K
Attachments
vera_build.py
(16.57 KiB) Downloaded 34 times
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 4317
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: MiCasaVerde Vera UI5, UI6, UI7 Plugin

Post by kgschlosser » Sat Nov 11, 2017 8:44 pm

Here is a more updated version of that build test file.

This corrected some timeout issues but also corrected some duplicate entries in some of the file. corrected some formatting issues. and it also adds a double check to see if any bits are missing since the data is gotten from 2 different mechanisms.
Attachments
vera_build.py
(32.16 KiB) Downloaded 34 times
If you like the work I have been doing then feel free to Image

blaher
Experienced User
Posts: 481
Joined: Thu Nov 17, 2011 1:27 am

Re: MiCasaVerde Vera UI5, UI6, UI7 Plugin

Post by blaher » Sun Nov 12, 2017 3:42 am

Traceback (most recent call last):
File "py.py", line 29, in <module>
File "C:\Program Files (x86)\EventGhost\lib27\site-packages\vera_build.py", line 22, in <module>
import requests
ImportError: No module named requests

User avatar
kgschlosser
Site Admin
Posts: 4317
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: MiCasaVerde Vera UI5, UI6, UI7 Plugin

Post by kgschlosser » Sun Nov 12, 2017 6:01 am

OK.. what way did you run it???



if you ran it using pyw try moving it into the site-packages folder and then running it the python script way

that should work just fine
If you like the work I have been doing then feel free to Image

holdestmade
Experienced User
Posts: 176
Joined: Thu Dec 04, 2014 2:44 pm

Re: MiCasaVerde Vera UI5, UI6, UI7 Plugin

Post by holdestmade » Sun Nov 12, 2017 4:46 pm

Run OK here with no errors in EG but did not create any files. It did create the MiCasaVerde_Vera folder though

User avatar
kgschlosser
Site Admin
Posts: 4317
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: MiCasaVerde Vera UI5, UI6, UI7 Plugin

Post by kgschlosser » Mon Nov 13, 2017 3:00 pm

go into the vera UI and on the network settings disable the firewall. then run it again.
If you like the work I have been doing then feel free to Image

holdestmade
Experienced User
Posts: 176
Joined: Thu Dec 04, 2014 2:44 pm

Re: MiCasaVerde Vera UI5, UI6, UI7 Plugin

Post by holdestmade » Mon Nov 13, 2017 3:54 pm

I can't see any firewall setting ?
SS.jpg

User avatar
kgschlosser
Site Admin
Posts: 4317
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: MiCasaVerde Vera UI5, UI6, UI7 Plugin

Post by kgschlosser » Mon Nov 13, 2017 6:05 pm

ok so do this for me


download UPNP developer tools. one of the tools is called device sniffer. this is the one i am going to need you to run.

once you run it click on the search drop down and then the search root devices. a whole lot of shit should display. see if the IP address of your vera shows up. and if it does then i want you to do this. once it is done filling that list (could take a few minutes) clear the list and then run the script. You should see an entry for the ip address of the computer you are running the script from. and it should also trigger that whole list of crap to happen again. it you see the entry but there no list of devices let me know.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 4317
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: MiCasaVerde Vera UI5, UI6, UI7 Plugin

Post by kgschlosser » Wed Nov 15, 2017 8:49 am

ok so here is a newer version of that file. this one will allow for input of the ip address. and it runs error free on my system. and creates all of the files without any errors in them.

give it a try and zip up the files and send em on over so i can check them out.
Attachments
vera_build.py
(29.41 KiB) Downloaded 35 times
If you like the work I have been doing then feel free to Image

holdestmade
Experienced User
Posts: 176
Joined: Thu Dec 04, 2014 2:44 pm

Re: MiCasaVerde Vera UI5, UI6, UI7 Plugin

Post by holdestmade » Wed Nov 15, 2017 9:29 am

OK, so with a bit of tinkering because of this error:

Traceback (most recent call last):
Python script "264", line 959, in <module>
main('192.168.1.205')
Python script "264", line 944, in main
categories = get_categories(ip_address)
Python script "264", line 290, in get_categories
category_num = category_num.split('_')
AttributeError: 'int' object has no attribute 'split'

The files attached were generated

This is the commenting out and editing I did to get it to run, category_num returned as '0':

Code: Select all

    for category_num in categories.keys()[:]:
        category_num = str(category_num)
        category_num = category_num.split('_')
        if len(category_num) == 1 or category_num[1] == '0':
            #category_type = categories.pop('_'.join(category_num))
            category_name = category_mapping[category_type]
            category_name = category_name.replace('\\', '')
            #out_categories[category_num[0]] = {'0': category_name}

    for category_num in categories.keys()[:]:
        category_num = str(category_num)
        #category_type = categories.pop(category_num)
        category_num = category_num.split('_')
        category_name = category_mapping[category_type]
        category_name = category_name.replace('\\', '')
        #out_categories[category_num[0]][category_num[1]] = category_name
For info, I copied vera_build.py into a python script in EG as it didn't run outside of it, added main('192.168.1.205') to the bottom and needed to comment out this too ('__file__' not found error):

Code: Select all

#CORE_FILE_PATH = os.path.join(os.path.split(__file__)[0], 'core')
Attachments
Desktop.zip
(158.04 KiB) Downloaded 34 times

User avatar
kgschlosser
Site Admin
Posts: 4317
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: MiCasaVerde Vera UI5, UI6, UI7 Plugin

Post by kgschlosser » Wed Nov 15, 2017 4:20 pm

that's an ooops on my part with the core file path thing. i forgot to remove that

if you could so we know what is going on with the categories.

key this into your browser replacing the IPADDRESS with your Vera's IP. once the page is loaded right click on the page and view the source code for it. copy and paste the output into a text file and attach to a post for me.

there are 2 urls that need to be done for this.

Code: Select all

http://IPADDRESS/cmh/js/config/constants.js
and then this one

Code: Select all

http://IPADDRESS/cmh/js/config/lang.js
thank you for the help on this. I do appreciate it. there are a couple of different Vera units made now. mine if getting up there in age. and they have different builds of UI7 for each of the different veras. so it's not the same on each of them.
If you like the work I have been doing then feel free to Image

holdestmade
Experienced User
Posts: 176
Joined: Thu Dec 04, 2014 2:44 pm

Re: MiCasaVerde Vera UI5, UI6, UI7 Plugin

Post by holdestmade » Wed Nov 15, 2017 4:52 pm

No problem, sure I'll benefit from your work on this.

See attached text files as requested

Cheers
Attachments
lang.txt
(736.28 KiB) Downloaded 40 times
constants.txt
(86.44 KiB) Downloaded 47 times

Post Reply