Premise Best practice advice needed

Motorola Premise
Dear Premise experts!
 
First of all, hello from Russia. Yes, believe you or not, we are also love Premise here! 
 
I'm a Premise freshman, and I will be appreciating for "best practice" advice.
 
A couple words about my Premise setup. When I build my house, I have "smart building" consultant  who recommend me Premise software and also sold me some custom made clones of Adicon controllers (I/O+Relays) and Bobcat sensors.
I rarely use premise for blind and fan control fom old Windows XP laptop, but now after terrible experience with Nest learning thermostat (it was dead twice (sic!) while Google force updating firmware) and I decide backup it by Premise, and also have plans swim poll heating and filtration control by Premise too.
 
The question is how «best practice» to implement some my setup features. For example – I've got Adicon Boobcat temperature sensor. I can’t bind directly my hardware to Premise Temperature Sensor Class because I need shift sensor output by 100, and convert Fahrenheit to Celsius. I inherit original Premise Temperature Sensor Class and made my own based on it. I add one property SensorData witch bind to the hardware and add OnChange trigger to SensorData with some code like this:
this.Temperature.Celsius  = (this.SensorData - 132)*(5/9)
 
The trick is - if I made my own class, some features will be not accessible thru web interface, more then this, JQM hasn’t support custom object and my iPhone is useless to control Promise.
 
If you want Premise to display values using metric units, such as temperature in Celsius, do this:
  1. In Premise Builder's menu select Tools > Configuration ... to access Root Properties.
  2. Click the Session tab.
  3. Scroll to the LocaleSettings section and change Temperature to Celsius.
  4. Click the Default Session tab.
  5. Scroll to the LocaleSettings section and change Temperature to Celsius.
  6. Click OK.
In the attached image you'll see the Adicon BOBCATT_TemperatureEx sensor now displays Temperature in Celsius units. Use the Offset property to (optionally) increase or decrease the Temperature value by whatever amount you need.
 
jybSjCS.png

 
 
This is a system-wide adjustment. All other devices in Premise that report Temperature will now display the value using Celsius units.
 
NOTE
Adicon's device driver correctly models the temperature value using a Temperature Unit class instead of a Number class. A Temperature Unit stores its value in Kelvin and displays the value using whatever is specified for the Session. If Adicon had used a Number then it would store and displayed the numeric value exactly as entered (no automatic conversion of units because the value has no units).  For more information, refer to Premise's online help by searching for "Property Type Reference" or download the Word-formatted manual from here.
 
I’m very appreciate for yours detailed explanation!
 
But my drivers it some proprietary version based on Adicon protocols, and I should use non-native Adicon drivers. It’s unfortunately hasn't offset property and store sensor data in Val property which Number class…
 
higCeMb.jpg
 
RHCorp did not model the temperature sensor correctly for their driver. They defined it as an analog input and therefore it has no units. Premise has Property Types for temperature, pressure, energy, velocity, force, etc. If RHCorp could correct its driver, that would be easiest for you (but not for RHCorp).
 
To display your custom class using Automation Browser (AB) or MiniBrowser (MB) you have to modify them. In brief, you will extend AB and MB to understand how to display your custom class. I haven't used JQM so I can't help you with that.
 
Modifying AB and MB is not easy. You have to be familiar with using Premise Builder in Expert Mode and creating Inherited and Extension classes. If you already know how to do this, I can give you an overview of the process. If not, I'll be honest and say I don't have the time or desire to explain the procedure in detail. 
 
Beside temperature sensor I also have some same customization issues for my blind control and also thermostat (I need only on\off floor heating relay of my separate temperature sensor data, I think existing premise thermostat class have excessing functionality for my purposes)
 
So, yes, it looks like creating premise inherited custom classes is best option for my goals.
 
And I ready jump into it (I have programming/IT background) and will be appreciate for any useful guidelines.
 
The easiest way to explain how to modify Automation Browser (AB) is to use an example.
 
This is a link to pastebin. Download it and change the file extension from TXT to XDO.
 
Import the XDO file. Here is what it contains:
 
  1. A Module named MyModule.
  2. A Class named MyTemperatureSensor. It inherits from the BindingSource class. It contains one property named Temperature (Temperature Property Type).
  3. A SelectionMenuFolder object named MyTemperatureSensor is added to /Plugins/Selectors/ClimateControl. Its TargetClass property points to the MyTemperatureSensor class.
 
The SelectionMenuFolder object is what assists AB to render a given object like a TemperatureSensor, HumiditySensor, LightSensor, etc. Sensors are easy because they only display a single property value. If you explore how a Thermostat is defined, you'll discover it is much more complicated.
 
Examine MyModule and experiment with it to understand how all the parts interact.
 
 
 
 
To modify MiniBrowser (MB), first I assume you are using my modified MiniBrowser module and not the original version that comes with Premise. The last version I posted was version 2.1.
http://cocoontech.com/forums/files/file/144-module-minibrowser-supports-mulitple-user-interfaces/
 
The instructions I am providing may work with the original version of MiniBrowser but I cannot confirm it.
 
Look at /Modules/MiniBrowser/Classes/mbTemperatureSensorEx. This class:
  1. Inherits from the MiniBrowserCore class.
  2. Extends the TemperatureSensor class.
  3. Contains three Functions named mbRenderPage, mbState, mbRenderStatus.
 
You need to create a new class that is 99% the same as this one. The only difference is that it will not extend the standard TemperatureSensor class but your own custom temperature sensor class (MyTemperatureSensor).
 
I think the easiest way to do this is to simply copy /Modules/MiniBrowser/Classes/mbTemperatureSensorEx and paste it in /Modules/MiniBrowser/Classes. Premise will create a new instance called mbTemperatureSensorEx2. Change the extended class from TemperatureSensor to the name of your custom class (MyTemperatureSensor). This image shows how to easily change the extended class.
 
B0d4i1M.png

 
The last thing to do is add your custom class (MyTemperatureSensor) as a new entry in the ValidClasses enumeration: /Modules/MiniBrowser/Classes/ValidClasses. Enter the fully qualified path to your class in the Description property and increment the Enum Value to the next highest number (18 in my example). The following image shows the new entry.
 
qw43nhQ.png

 
Good luck!
 
Thanks again, I’ll be follow your guidelines!
But meanwhile one more question for guru.
 
I play a lot with Temperature Unit type but got some strange behaviour for example standard premise thermostat class or even my custom class uses any variable by Temperature Unit type. For example a set some values for object variables in Celsius Temperature Unit type in Premise builder, close it and go to the web interface made some testing going back to the builder and voila – all my Temperature Unites variables was resetting to zero -273.15C or 1.#INF С depending of OS version which Builder hosted . I don’t get how it could be happened?
 
BZqQlKK.jpg
 
I've never experienced this problem and I can't replicate it.
 
My observations:
 
-273.15 Celsius = 0 Kelvin
This may be due to a unit conversion error. If the units are in Kelvin, but I assume they are Celsius, and I program a value of "0", automatic unit conversion will display it as -273.15. For example:
Home.First_Floor.Thermostat.Temperature 0
 
It is good practice when coding to specify the "unit type identifier" like so:
Home.First_Floor.Thermostat.Temperature.Celsius 0
 
1.#INF C
I've never seen this before. It look like notation to represent a value that is out-of-bounds (i.e. INFinity?).
 
A play all Saturday with AB and MB flow yours instruction ^_^ 
Now the picture is much more clear with your help. Thanks a lot!
 
But I’m still just little bit confused with one MB feature. If I was create my own class MyAppliance inherited for instance from Premise Appliance class and made user-defined handler for MB as you described above – Premise will be still use it’s own handler mbApplianceEx not my custom defined mbApplianceEx2 for my custom made class. I wonder, does it exist any solution to avoid such situation?
 
Back
Top