Re: MiCasaVerde Vera UI5, UI6, UI7 Plugin
Posted: Wed Nov 15, 2017 5:20 pm
ok. scratch that last post
put this into a python script. change the IP_ADDRESS.. you know the drill... LOL
this is going to create a folder on your desktop called BUILD_OUTPUT. zip up that whole folder and send it to me in a PM. it is going to have some stuff in there which i do not want to be in a public forum.
The script each time it is run will delete the old files and create new ones. these are exact duplicates of the device and service files on the vera. as well as that category stuff. these are common files to different vera models. but the vera.xml file is the one that will have things like your unit serial number and home id in them. hence the sending it to me in a PM.
This is going to tell you exactly what it is getting and where it is putting it. and if removing something it is going to tell you what it is removing (stale file from a previous run of this script)
This is going to take a bit for EG to run. and EG is going to say to you NOT RESPONDING. so ignore the not responding and let it go. EG will return to normal once this is finished.
put this into a python script. change the IP_ADDRESS.. you know the drill... LOL
this is going to create a folder on your desktop called BUILD_OUTPUT. zip up that whole folder and send it to me in a PM. it is going to have some stuff in there which i do not want to be in a public forum.
The script each time it is run will delete the old files and create new ones. these are exact duplicates of the device and service files on the vera. as well as that category stuff. these are common files to different vera models. but the vera.xml file is the one that will have things like your unit serial number and home id in them. hence the sending it to me in a PM.
This is going to tell you exactly what it is getting and where it is putting it. and if removing something it is going to tell you what it is removing (stale file from a previous run of this script)
This is going to take a bit for EG to run. and EG is going to say to you NOT RESPONDING. so ignore the not responding and let it go. EG will return to normal once this is finished.
Code: Select all
IP_ADDRESS = ''
import os
import requests
URL = 'http://{0}/cgi-bin/cmh/'.format(IP_ADDRESS)
GET_UPNP_FILES = URL + 'get_upnp_files.sh'
VIEW_UPNP_FILE = URL + 'view_upnp_file.sh?file={file}'
SYS_INFO = URL + 'sysinfo.sh'
CATEGORIES = 'http://{0}/cmh/js/config/constants.js'.format(IP_ADDRESS)
CATEGORY_LANG = 'http://{0}/cmh/js/config/lang.js'.format(IP_ADDRESS)
VERA_INFO = 'http://{0}/upnp/vera.xml'.format(IP_ADDRESS)
BASE_FOLDER = os.path.join(
os.path.expandvars('%USERPROFILE%'),
'Desktop',
'BUILD_OUTPUT'
)
CGI_FOLDER = os.path.join(BASE_FOLDER, 'cgi-bin', 'cmh')
CATEGORY_FOLDER = os.path.join(BASE_FOLDER, 'cmh', 'js', 'config')
UPNP_FOLDER = os.path.join(BASE_FOLDER, 'upnp')
if not os.path.exists(BASE_FOLDER):
print 'Creating folder', BASE_FOLDER
os.mkdir(BASE_FOLDER)
if os.path.exists(CGI_FOLDER):
for f in os.listdir(CGI_FOLDER):
f = os.path.join(CGI_FOLDER, f)
print 'Removing old data file', f
os.remove(f)
else:
print 'Creating folder', CGI_FOLDER
os.makedirs(CGI_FOLDER)
if os.path.exists(CATEGORY_FOLDER):
for f in os.listdir(CATEGORY_FOLDER):
f = os.path.join(CATEGORY_FOLDER, f)
print 'Removing old data file', f
os.remove(f)
else:
print 'Creating folder', CATEGORY_FOLDER
os.makedirs(CATEGORY_FOLDER)
if os.path.exists(UPNP_FOLDER):
for f in os.listdir(UPNP_FOLDER):
f = os.path.join(UPNP_FOLDER, f)
print 'Removing old data file', f
os.remove(f)
else:
print 'Creating folder', UPNP_FOLDER
os.makedirs(UPNP_FOLDER)
constants = os.path.join(CATEGORY_FOLDER, 'constants.js')
lang = os.path.join(CATEGORY_FOLDER, 'lang.js')
vera = os.path.join(UPNP_FOLDER, 'vera.xml')
print 'Getting file constants.js'
response = requests.get(CATEGORIES)
print 'Writing file', constants
with open(constants, 'w') as f:
f.write(response.content)
print 'Getting file lang.js'
response = requests.get(CATEGORY_LANG)
print 'Writing file', lang
with open(lang, 'w') as f:
f.write(response.content)
print 'Getting file vera.xml'
response = requests.get(VERA_INFO)
print 'Writing file', vera
with open(vera, 'w') as f:
f.write(response.content)
print 'Getting upnp file list'
response = requests.get(GET_UPNP_FILES)
file_list = response.content
for data_file in file_list.split('\n'):
if data_file and 'xml.lzo' in data_file:
print 'Getting file', data_file
response = requests.get(VIEW_UPNP_FILE.format(file=data_file))
data_file = os.path.join(CGI_FOLDER, data_file.replace('.lzo', ''))
print 'Writing file', data_file
with open(data_file, 'w') as f:
f.write(response.content)