123
Senior Member
I realize there are precious few Premise users still monitoring this forum. However, for anyone still listening, here's a summary of my recent attempt to put a fresh new face on Premise.
First, if you're looking for screenshots or demos, you can stop reading now because I don't have any; I'm not there yet. I'm only at the stage of understanding the best way to connect Premise to a product called Home Remote. http://www.thehomeremote.com/
So far I've only dipped a toe into this project. The first hurdle was to find a way to talk to Premise via HTTP (without using AutomationBrowser, MiniBroker, or similar derivatives).
Many thanks to Charlie Kindel for reverse-engineering Premise's native WebClient HTTP protocol.
It revealed how to get and set a Home object's property values as well as execute methods (scripts) on the Premise Server.
NOTE: the leading "http:" has been removed in all URLs to prevent them from becoming active links.
In a nutshell this gets values:
//PremiseServer/sys/Home/LivingRoom/Floorlamp!PowerState
This sets values but it's an HTTP POST operation, not your usual HTTP GET.
//PremiseServer/sys/Home/LivingRoom/Floorlamp?e?PowerState
The message body must contain 0 or 1 (off or on). If you were setting Brightness, the message body would contain a decimal value between 0 and 1.
This one executes methods on Premise server.
//PremiseServer/sys/Home?d??MyCustomFunction()
You'd use this if you wanted Premise to perform some task or to respond with custom information (and not just the status of one Home object).
That's it! With these three URLs you can control most anything in Premise. Of course, as with most things, the devil is in the details!
I'm still a newbie with Home Remote but I did manage to create a simple UI to control one light and it works perfectly. Response time is within a second and it promptly displays the light's status (i.e. if I change the light's brightness using the wall-switch, the slider in the UI updates accordingly).
To achieve this required a little bit of tinkering. Controlling lights is not like controlling a thermostat. You probably only have one thermostat. So if you use this:
//PremiseServer/sys/Home/Hallway/Thermostat!_XML
Premise will reply with all the thermostat's properties in XML format. Nice!
In Home Remote, you would use XPATH statements to extract the desired property values (CurrentSetPoint, Mode, FanStatus, etc) from Premise's response. It's easier than it sounds. The hardest part was learning how to use XPATH to convert temperature (Premise reports temperature in Kelvin).
Undoubtedly, you have more than one light in your house. Yes, you can use this:
//PremiseServer/sys/Home/LivingRoom/Floorlamp!_XML
then use XPATH to extract PowerState and Brightness (if it's a dimmer) from Premise's XML response. Straightforward.
HOWEVER, the way Home Remote is structured, it's simpler if you can request the status of all lights and then use XPATH to extract the properties of the one light you want. Why? Because the UI you create will undoubtedly have several lights on the same page, not just one. You want to poll Premise once, and get the status of all lights shown in the UI, instead of polling Premise for each light, one at a time.
Fine. Except Premise has no HTTP command to list the status of all lights. This is where I needed to create a custom method.
It's quite simple; it's all in a Module. All it does is collect all lights in Home (but only the ones that are visible, namely Navigation=Default) then produces an XML response containing each light's relevant properties.
In fact, Premise objects have the built-in ability to spit out their properties in XML format! However, the result contains extraneous properties like BoundObject, ID, Class, Flags, blablabla, etc. The result is kind of bloated so I wrote a few lines of script to produce my own, compact XML response containing just Name, PowerState, and Brightness.
All my lights have unique names. However, if your home has duplicated names (i.e. CeilingLight is used in more than one room), the XML response would have to contain each light's full path in order to differentiate between /Home/Bedroom/CeilingLight and /Home/Garage/CeilingLight. Thats an easy modification to the method.
Anyway, all this to say, things are looking good so far! Aside from writing a few methods to list all lights, sensors, contacts, etc, most of my time will be invested in designing a custom UI with Home Remote Designer.
First, if you're looking for screenshots or demos, you can stop reading now because I don't have any; I'm not there yet. I'm only at the stage of understanding the best way to connect Premise to a product called Home Remote. http://www.thehomeremote.com/
- Currently, the software is free (that'll probably change this year).
- It offers native apps for Windows, iOS, and Android (all available in their respective app stores; no rooting/jail-breaking/sideloading required).
- You design a custom UI using Windows-based Home Remote Designer.
- It can connect to many popular devices but can also be extended to support anything that can be controlled via TCP, MQTT, or HTTP (hello Premise).
- You upload your custom UI to your phone or tablet.
- The UI's appearance is native to the device (i.e. on an iPhone it looks like a native iOS app not some 'fish-out-water' transplanted from Windows or Android).
- The product's author is very helpful and responsive to suggestions.
So far I've only dipped a toe into this project. The first hurdle was to find a way to talk to Premise via HTTP (without using AutomationBrowser, MiniBroker, or similar derivatives).
Many thanks to Charlie Kindel for reverse-engineering Premise's native WebClient HTTP protocol.
It revealed how to get and set a Home object's property values as well as execute methods (scripts) on the Premise Server.
NOTE: the leading "http:" has been removed in all URLs to prevent them from becoming active links.
In a nutshell this gets values:
//PremiseServer/sys/Home/LivingRoom/Floorlamp!PowerState
This sets values but it's an HTTP POST operation, not your usual HTTP GET.
//PremiseServer/sys/Home/LivingRoom/Floorlamp?e?PowerState
The message body must contain 0 or 1 (off or on). If you were setting Brightness, the message body would contain a decimal value between 0 and 1.
This one executes methods on Premise server.
//PremiseServer/sys/Home?d??MyCustomFunction()
You'd use this if you wanted Premise to perform some task or to respond with custom information (and not just the status of one Home object).
That's it! With these three URLs you can control most anything in Premise. Of course, as with most things, the devil is in the details!
I'm still a newbie with Home Remote but I did manage to create a simple UI to control one light and it works perfectly. Response time is within a second and it promptly displays the light's status (i.e. if I change the light's brightness using the wall-switch, the slider in the UI updates accordingly).
To achieve this required a little bit of tinkering. Controlling lights is not like controlling a thermostat. You probably only have one thermostat. So if you use this:
//PremiseServer/sys/Home/Hallway/Thermostat!_XML
Premise will reply with all the thermostat's properties in XML format. Nice!
In Home Remote, you would use XPATH statements to extract the desired property values (CurrentSetPoint, Mode, FanStatus, etc) from Premise's response. It's easier than it sounds. The hardest part was learning how to use XPATH to convert temperature (Premise reports temperature in Kelvin).
Undoubtedly, you have more than one light in your house. Yes, you can use this:
//PremiseServer/sys/Home/LivingRoom/Floorlamp!_XML
then use XPATH to extract PowerState and Brightness (if it's a dimmer) from Premise's XML response. Straightforward.
HOWEVER, the way Home Remote is structured, it's simpler if you can request the status of all lights and then use XPATH to extract the properties of the one light you want. Why? Because the UI you create will undoubtedly have several lights on the same page, not just one. You want to poll Premise once, and get the status of all lights shown in the UI, instead of polling Premise for each light, one at a time.
Fine. Except Premise has no HTTP command to list the status of all lights. This is where I needed to create a custom method.
It's quite simple; it's all in a Module. All it does is collect all lights in Home (but only the ones that are visible, namely Navigation=Default) then produces an XML response containing each light's relevant properties.
In fact, Premise objects have the built-in ability to spit out their properties in XML format! However, the result contains extraneous properties like BoundObject, ID, Class, Flags, blablabla, etc. The result is kind of bloated so I wrote a few lines of script to produce my own, compact XML response containing just Name, PowerState, and Brightness.
All my lights have unique names. However, if your home has duplicated names (i.e. CeilingLight is used in more than one room), the XML response would have to contain each light's full path in order to differentiate between /Home/Bedroom/CeilingLight and /Home/Garage/CeilingLight. Thats an easy modification to the method.
Anyway, all this to say, things are looking good so far! Aside from writing a few methods to list all lights, sensors, contacts, etc, most of my time will be invested in designing a custom UI with Home Remote Designer.