Premise jQuery Mobile MiniBrowser UI - Preview

Motorola Premise
Yes - jQuery is the method 9no pun) for bringing Premise. Sorting, search, sliders (volume) , dials (tuning), and more - I used it for the in-browser audio playing..the number of plug-ins in fantastic, and now that w84 has broken the secret code, this may well bring premise into the mainstream. Now I have to rethink my Tivo module..

btw, 123 thanks for the secret on the UDS for passing IP commands. I don't know how you came up with that, but it works like a charm!
 
I'll post a screen capture shortly on how to navigate Premise Builder to find the class objects for the a device object of type "thermostat." Basically, you can drill into any object in the properties window by holding control and left clicking twice on an object.

Mode, HeatingStatus, FanControl etc... are multivalue properties in Premise. MultiValue properties have an Enumeration that is linked to a MultiValue's "Filter" property. Enumerations have Enum objects that each have a value assigned. The xml data is referring to this Enum value.

You'll find UserHold is a boolean. I believe -1 always refers to a TRUE. FALSE Boolean values appear to be omitted from the XML file.
 
The video will hopefully help you understand Premise's structure. Device objects are instances of device class objects. You'll note that the "Type" property changes from "Thermostat" to "Class" as I drill from the device object to its class.

Properties have a similar structure. You'll note as I navigate the thermostat's device class in the video, the property objects also have a "Type." For UserHold, its type is "Boolean."

I'm stumped on the question below. I think it is because the OutdoorTemperature property is read only, but it is still a child object (property) of the Thermostat class so it should show up when using the XML method?!?!

Builder's help states:
"Remarks Premise Server is based on xml technology. The xml Property allows you to see the xml that defines the state of an object. This is a great tool for recording the state of an object at certain times. Any child objects of the current objects are included in the xml for that object."

And I don't see an outdoor temp in the xml, is that because I don't have a real thermostat?
I am going to need help with the values so I can get the functionality correct.
 
I tested one of my thermostats to see what the xml reply would look like. Note that the OnChange scripts are scripts I placed under the home object to do things like alert me if my home is below the freezing point etc... My thermostat replies with the OutdoorTemperature state.

I think I've determined that only non blank state properties show up. Note that my outdoor temp was still at 11F from when I populated it a few months back using the weather underground module. After setting the Outdoor Temp property to "", the XML reply left it out. Further, when HeatingStatus is set to OFF, there is no "CurrentSetPoint" since this means CurrentSetPoint = ""... Thermostat2 was on and cooling while Thermostat had its HeatingStatus set to OFF. This is why there is more XML data for Thermostat2 versus Thermostat.

In Chrome, view-source:http://192.168.1.106/sys/home/Thermostat?d??mbState(2) replies with:
Code:
<premise version="1.0">
<Object ID="{EA2C1201-836D-472B-BE7E-4E1A38B5D68F}" Name="Thermostat" Flags="512l" Class="sys://Schema/Device/HVAC/Thermostat" TemperatureMode="2" Temperature="300.372222222222 K" CoolingSetPoint="290.372222222222 K" HeatingSetPoint="288.705555555556 K" OutdoorTemperature="261.483333333333 K" DisplayName="Zone1 Thermostat" FanControl="1" HeatingStatus="2" FanStatus="1" BoundObject="{23AEE670-FA33-491F-B068-F5CEB7BE153A}" >
<Object ID="{65B470FB-4A3A-4012-AF24-66F08AAEE0AD}" Name="OnChangeTemperature" Class="sys://Schema/Scripting/ObjectProperty" Property="{C1642FFD-33EE-4784-8CCD-BF06370AC696}" Script="aWYgdGhpcy5UZW1wZXJhdHVyZS5GYWhyZW5oZWl0IDwgNDUgdGhlbgoJJ1NldCBldmVudAogICAgc2V0IG9iakV2ZW50ID0gRXZlbnRzLkNyZWF0ZU9iamVjdChTY2hlbWEuU3lzdGVtLkV2ZW50LlBhdGgsICJJbmRvb3JfVGVtcF9Mb3ciKQoJb2JqRXZlbnQuRGVzY3JpcHRpb24gPSAiSW5zaWRlIHRlbXBlcmF0dXJlIGlzIGF0OiAiICYgcm91bmQodGhpcy5UZW1wZXJhdHVyZS5GYWhyZW5oZWl0LDEpICYgIkYiCgknICYgc3lzZXZlbnQubmV3VmFsKig5LzUpLTQ1OS42NyAmICJGIgogICAgJ0dpdmVzIEV2ZW50IGEgU2V2ZXJpdHkgTGV2ZWwgVG8gY2hlY2sgYWdhaW5zdC4KICAgIG9iakV2ZW50LlNldmVyaXR5ID0gNTAKICAgICdHaXZlcyBFdmVudFRpbWUgcHJvcGVydHkgdGhlIGN1cnJlbnQgc3lzdGVtIHRpbWUuCiAgICBvYmpFdmVudC5FdmVudFRpbWUgPSBub3cKICAgICdTZXRzIHRoZSBFdmVudCBMaW5rT2JqZWN0CiAgICBvYmpFdmVudC5MaW5rT2JqZWN0ID0gdGhpcwoJJ0VtYWlsIG1lIGV2ZW50CglkZXZpY2VzLkN1c3RvbURldmljZXMuU1NNVFAuTWFpbFN1YmplY3QgPSBvYmpFdmVudC5OYW1lCglkZXZpY2VzLkN1c3RvbURldmljZXMuU1NNVFAuTWFpbEhUTUxCb2R5ID0gb2JqRXZlbnQuRGVzY3JpcHRpb24KCWRldmljZXMuQ3VzdG9tRGV2aWNlcy5TU01UUC5NYWlsU2VuZCA9IHRydWUKCXNldCBvYmpFdmVudCA9IG5vdGhpbmcKZW5kIGlm" />
<Object ID="{0FF89765-A175-450E-8A5D-792855CAC79B}" Name="OnChangeHeatingStatus" Class="sys://Schema/Scripting/ObjectProperty" Property="{0D2E651D-D9CE-4AFD-996F-BA462BF36286}" Enabled="0" Script="aWYgdGhpcy5IZWF0aW5nU3RhdHVzID0gNCB0aGVuCgl0aGlzLkZhblN0YXR1cyA9IDAKZWxzZQoJdGhpcy5GYW5TdGF0dXMgPSAxCmVuZCBpZg==" />
<Object ID="{FCA1BDD0-E261-4E84-B6DB-6918CA8DA3B7}" Name="OnChangeCoolingSetPoint" Class="sys://Schema/Scripting/ObjectProperty" Property="{34DB2DDB-9A1F-4E34-9F70-3877A3326E97}" Script="aWYgdGhpcy5Db29saW5nU2V0UG9pbnQuRmFocmVuaGVpdCA8IDYwIHRoZW4KCXRoaXMuQ29vbGluZ1NldFBvaW50LkZhaHJlbmhlaXQgPSA2MAplbmQgaWY=" />
</Object>
</premise>

and view-source:http://192.168.1.106/sys/home/Thermostat2?d??mbState(2) replies with:
Code:
<premise version="1.0">
<Object ID="{FF6946C5-F61B-4A13-ACAC-AC5C97650FE0}" Name="Thermostat2" Flags="512l" Class="sys://Schema/Device/HVAC/Thermostat" TemperatureMode="2" Temperature="292.594444444444 K" CoolingSetPoint="290.927777777778 K" HeatingSetPoint="289.261111111111 K" OutdoorTemperature="261.483333333333 K" DisplayName="Zone 2 Thermostat" FanControl="0" FanStatus="1" Mode="2" BoundObject="{5D2E1C75-EBE7-4BC2-9231-4EACF1EB57FA}" CurrentSetPoint="290.927777777778 K" HeatingStatus="2" >
<Object ID="{4253C43A-2041-40CF-B9B7-C51A81F85692}" Name="OnChangeTemperature" Class="sys://Schema/Scripting/ObjectProperty" Property="{C1642FFD-33EE-4784-8CCD-BF06370AC696}" Script="aWYgdGhpcy5UZW1wZXJhdHVyZS5GYWhyZW5oZWl0IDwgNDUgdGhlbgoJJ1NldCBldmVudAogICAgc2V0IG9iakV2ZW50ID0gRXZlbnRzLkNyZWF0ZU9iamVjdChTY2hlbWEuU3lzdGVtLkV2ZW50LlBhdGgsICJJbmRvb3JfVGVtcF9Mb3ciKQoJb2JqRXZlbnQuRGVzY3JpcHRpb24gPSAiSW5zaWRlIHRlbXBlcmF0dXJlIGlzIGF0OiAiICYgcm91bmQodGhpcy5UZW1wZXJhdHVyZS5GYWhyZW5oZWl0LDEpICYgIkYiCgknICYgc3lzZXZlbnQubmV3VmFsKig5LzUpLTQ1OS42NyAmICJGIgogICAgJ0dpdmVzIEV2ZW50IGEgU2V2ZXJpdHkgTGV2ZWwgVG8gY2hlY2sgYWdhaW5zdC4KICAgIG9iakV2ZW50LlNldmVyaXR5ID0gNTAKICAgICdHaXZlcyBFdmVudFRpbWUgcHJvcGVydHkgdGhlIGN1cnJlbnQgc3lzdGVtIHRpbWUuCiAgICBvYmpFdmVudC5FdmVudFRpbWUgPSBub3cKICAgICdTZXRzIHRoZSBFdmVudCBMaW5rT2JqZWN0CiAgICBvYmpFdmVudC5MaW5rT2JqZWN0ID0gdGhpcwoJJ0VtYWlsIG1lIGV2ZW50CglkZXZpY2VzLkN1c3RvbURldmljZXMuU1NNVFAuTWFpbFN1YmplY3QgPSBvYmpFdmVudC5OYW1lCglkZXZpY2VzLkN1c3RvbURldmljZXMuU1NNVFAuTWFpbEhUTUxCb2R5ID0gb2JqRXZlbnQuRGVzY3JpcHRpb24KCWRldmljZXMuQ3VzdG9tRGV2aWNlcy5TU01UUC5NYWlsU2VuZCA9IHRydWUKCXNldCBvYmpFdmVudCA9IG5vdGhpbmcKZW5kIGlm" />
<Object ID="{33BE357B-FF94-435A-B617-8CA6096D2D54}" Name="OnChangeHeatingStatus" Class="sys://Schema/Scripting/ObjectProperty" Property="{0D2E651D-D9CE-4AFD-996F-BA462BF36286}" Enabled="0" Script="aWYgdGhpcy5IZWF0aW5nU3RhdHVzID0gNCB0aGVuCgl0aGlzLkZhblN0YXR1cyA9IDAKZWxzZQoJdGhpcy5GYW5TdGF0dXMgPSAxCmVuZCBpZg==" />
<Object ID="{91B4EDA7-F56E-4FD7-8ECD-0B3DBC1DF2A5}" Name="OnChangeCoolingSetPoint" Class="sys://Schema/Scripting/ObjectProperty" Property="{34DB2DDB-9A1F-4E34-9F70-3877A3326E97}" Script="aWYgdGhpcy5Db29saW5nU2V0UG9pbnQuRmFocmVuaGVpdCA8IDYwIHRoZW4KCXRoaXMuQ29vbGluZ1NldFBvaW50LkZhaHJlbmhlaXQgPSA2MAplbmQgaWY=" />
</Object>
</premise>
 
UserHold = "-1" means it is TRUE. Zero is FALSE and negative one is TRUE. This is the standard convention for VBScript Boolean variables. You can test it for yourself by putting the next two lines in a vbs file and executing it:

x = true
msgbox cint(x)

When Premise exports an object in XML format, it exports Boolean properties that are TRUE but not if they are FALSE. I believe they did this to make the resulting XML more compact. However, what this means for a developer is that the XML form of an object is not necessarily a complete list of the object's properties. For example, in etc6849's sample XML (above), you'll note that it does not report the state of the "UserHold" property and that's because, betcha dollars to donuts, it is FALSE.

I suspect if a property has no value then it is also excluded from the XML data. That would explain why you did not see an OutdoorTemperature property in the XML data.
 
I agree with 123. For a Boolean property, True = -1, False = 0 and is not shown (fixed the past post). I've also verified that properties with no value are omitted.
 
OK, I will have to get all the properties and just put in some logic if the property isn't in the xml. Thanks guys.
 
Awesome, that is just the info I need. Now I can add the status indicators. Made some progress and got the Temperature Mode buttons to fit on one line. Will test on my wife's iPhone later.
 
W84 -

As I have pointed out, I'm using jQuery on some things, which made me think - what version are you using? We should establish a baseline version to keep things in sync...

I have found some jQuery plug-ins had to be modified to work w/ later versions of jQuery....
 
Yes, I deal with this every time jQuery or jQuery Mobile is updated at work.

For this project, I am using jQuery 1.6.4 and jQuery Mobile 1.1.0.
 
I have reworked the thermostat and have everything looking correct on both Android and iPhone. The iPhone's screen width is smaller, so I am glad I had one to test. I still have to get the status message logic working, but this is what I am thinking it will look like. The status will be grey and change to blue as the status changes from cooling to heating and the fan from on to off. I thought this would be cleaner than adding some animated gif ;)

I included some changes to the theming also.
 

Attachments

  • therm.jpg
    therm.jpg
    27.6 KB · Views: 86
  • home.JPG
    home.JPG
    21.7 KB · Views: 104
  • light.JPG
    light.JPG
    18.3 KB · Views: 91
  • recpt.JPG
    recpt.JPG
    15.6 KB · Views: 65
Latest pics look great. Thermostat design is very clean and intuitive. The status indicators are perfect. The interior/exterior temperatures appear to have sufficient room to display negative values as well as triple-digits.

My only concern is for displaying Setpoint in Celsius which must be shown using a decimal place (21.5) because adjustments are made by half degree. Is there enough room for three digits and a decimal point?
 
I will test with 3 digits, a minus sign and a decimal. I will adjust the font size to accommodate.
 
Back
Top