[DEPRECATED THREAD] webCoRE design process

do you have access to the DTH code? Can you please paste here the capabilities section? the one that says “capability “this”, capability “that””… ? thank you

Of course, I have no idea what specific Device Handlers Kevin is using, but here is the one for the CT-100 Thermostat that’s available in the Templates to choose from in ‘My Device Handlers’…

metadata {
	// Automatically generated. Make future change here.
	definition (name: "CT100 Thermostat", namespace: "smartthings", author: "SmartThings") {
		capability "Actuator"
		capability "Temperature Measurement"
		capability "Relative Humidity Measurement"
		capability "Thermostat"
		capability "Battery"
		capability "Configuration"
		capability "Refresh"
		capability "Sensor"
		
		attribute "thermostatFanState", "string"

		command "switchMode"
		command "switchFanMode"
		command "quickSetCool"
		command "quickSetHeat"

		fingerprint deviceId: "0x08", inClusters: "0x43,0x40,0x44,0x31,0x80,0x85,0x60"
	}

…and this is the one from same list for the Ecobee Thermostat…

/**
 *  Copyright 2015 SmartThings
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *
 *	Ecobee Thermostat
 *
 *	Author: SmartThings
 *	Date: 2013-06-13
 */
metadata {
	definition (name: "Ecobee Thermostat", namespace: "smartthings", author: "SmartThings") {
		capability "Actuator"
		capability "Thermostat"
		capability "Temperature Measurement"
		capability "Sensor"
		capability "Refresh"
		capability "Relative Humidity Measurement"
		capability "Health Check"

		command "generateEvent"
		command "raiseSetpoint"
		command "lowerSetpoint"
		command "resumeProgram"
		command "switchMode"
		command "switchFanMode"

		attribute "thermostatSetpoint", "number"
		attribute "thermostatStatus", "string"
		attribute "maxHeatingSetpoint", "number"
		attribute "minHeatingSetpoint", "number"
		attribute "maxCoolingSetpoint", "number"
		attribute "minCoolingSetpoint", "number"
		attribute "deviceTemperatureUnit", "string"
		attribute "deviceAlive", "enum", ["true", "false"]
	}

My Ecobee is not showing up as an available thermostat either. I am using the Samsung ecobee device type

definition (name: "Ecobee Thermostat", namespace: "smartthings", author: "SmartThings") {
	capability "Actuator"
	capability "Thermostat"
	capability "Temperature Measurement"
	capability "Sensor"
	capability "Refresh"
	capability "Relative Humidity Measurement"
	capability "Health Check"

	command "generateEvent"
	command "raiseSetpoint"
	command "lowerSetpoint"
	command "resumeProgram"
	command "switchMode"
	command "switchFanMode"

	attribute "thermostatSetpoint", "number"
	attribute "thermostatStatus", "string"
	attribute "maxHeatingSetpoint", "number"
	attribute "minHeatingSetpoint", "number"
	attribute "maxCoolingSetpoint", "number"
	attribute "minCoolingSetpoint", "number"
	attribute "deviceTemperatureUnit", "string"
	attribute "deviceAlive", "enum", ["true", "false"]
}

1 Like

Yeah, CoRE SE is throwing a Superbowl party. Busy writing code to setup tables and buy snacks and drinks. Not going well so far, had to go and do said choires myself…

6 Likes

So, are you building a CoRE SToRE?

I can’t see for the Ecobee but for the Ct-100…

metadata {
// Automatically generated. Make future change here.
definition (name: “Z-Wave Thermostat with Temperature, Humidity and Auto Time setting”, namespace: “rboy”, author: “RBoy”) {
capability "Actuator"
capability "Temperature Measurement"
capability "Relative Humidity Measurement"
capability "Thermostat"
capability "Configuration"
capability "Polling"
capability "Sensor"
capability "Refresh"
capability “Battery”

Can you please check if this fixes it?

v0.0.01b.20170206 - ALPHA - Fixed a problem with selecting thermostats

Thank you

Fixed… I can select all now… the Ct-100 and the Ecobee… thank you!

1 Like

Thank you sir! I can also now see my ecobee thermostat.

Are the attributes for switches not available for now?

I am not seeing any attributes when I select a switch device.

Been silently working on expression parsing. Still a bit buggy, but getting there.

The programmer types can open a piston viewer (not the dashboard, click on a piston) and open the console. Type this in the console:

scope.parseExpression('The door has been {status} for {$now - openedAt} seconds, it has been {status} {3(a + 1) " times"}')

and then go through the result object. Converted to JSON, it looks like this:

You can check it here with the output of this:

JSON.stringify(scope.parseExpression('The door has been {status} for {$now - openedAt} seconds, it has been {status} {3(a + 1) " times"}'))

(make sure to remove the very first " and the very last " from the result of the above call)

So, a string can contain expressions encapsulated in { } and the expressions can contain unlimited grouping of operands and operators. So you can do math within a { } segment, for instance have a notification with the message “5 times today’s day is {$day * 5}”. You can, of course, use a Set variable to do the assignment before, but you can use it directly in the message.

NOTE: you’ll notice that the first command is somehow omitting the 3 and its implied multiplication - that’s why I said it’s still buggy.

1 Like

The correct version for seconds would be

scope.parseExpression(‘The door has been {status} for {($now - openedAt) * 86400} seconds, it has been {status} {3(a + 1) " times"}’)

$now is given in days, with the decimal part representing 1/86400000th of a day., i.e. microsconds.

1 Like

I plan on allowing this in expressions: “The bedroom window is currently {[Bedroom Window].contact}”

Not really sure on the required format of device names/ids. Whether the attribute needs to be inside the [ ] or outside separated by a . will really depend on how hard I’ll find it to parse the [device_name].attribute correctly. The ultimate reason for this is so that you can actually write a condition between two expressions:

IF {[Bedroom Window].contact} is equal to {mySavedStatus} THEN… Of course, it beats the purpose of the easy to use UI, but it makes it “type-able”…

This is also where the difference between “constant” and “expression” comes into place. Expression is a constant that is automatically encapsulated in { } and therefore parsed rather than considered a string.

This means that

(constant) {test}

is the equivalent of

(expression) test

In both cases, test will be looked up as a variable and if found, it’s value will be used, otherwise the string name will be used instead.

Nevermind, fixed the implied multipliers in front of (. Checking to see if it works after the ) too :smiley:

2 Likes

@adi624, please keep accessibility in mind for users of assistive technology while designing the HTML 5 page. CORE as is was %100 accessible. I am willing to beta test if needed. I use the JAWS screen reader.

1 Like

Can we do day and time based restrictions, have not figured out how to do it?

Can you please look it up and tell me what needs touch-ups? I don’t have/use read assist technology, so please help me test that part, thank you

Not there, yet, working on understanding complex expressions, like this:

sendNotification ‘At {$now} the door is probably {statusOfDoor} for about {round(86400 * ($now - since),2)} seconds’

yeah, functions, grouping, etc. :smiley: it actually parses it as it is, right now :slight_smile: I just now need to evaluate it to an actual value - and that’s where dynamic typing comes heavily into play…

so far, I thought of these functions:

avg(param1, param2, … , paramN)
returns the average value of params

bool(value)
returns the value as a boolean

boolean(value)
returns the value as a boolean

camel(value)
returns the camel case version of value

ceil(value, [decimals])
returns the ceiling value of the value with the given number of decimals, defaults to 0 decimals

ceiling(value, [decimals])
returns the ceiling value of the value with the given number of decimals, defaults to 0 decimals

count(param1, param2, … , paramN)
returns the number of parameters, useless, will always return N

decimal(value)
returns the value as a float

float(value)
returns the value as a float

floor(value, [decimals])
returns the floor value of the value with the given number of decimals, defaults to 0 decimals

int(value)
returns the value as an integer

integer(value)
returns the value as an integer

left(value, length)
returns the length number of characters at the start of a string value

lower(value)
returns the lower case version of value

max(param1, param2, … , paramN)
returns the maximum value in the list

mid(value, start, [length])
returns the length number of characters in a string value, starting at position start

min(param1, param2, … , paramN)
returns the minimum value in the list

right(value, length)
returns the length number of characters at the end of a string value

round(value, [decimals])
returns the rounded value of the value with the given number of decimals, defaults to 0 decimals

string(value)
returns the value as a string

substr(value, start, [length])
returns the length number of characters in a string value, starting at position start

text(value)
returns the value as a string

title(value)
returns the title case version of value

upper(value)
returns the lower case version of value

parameters in are optional.

3 Likes

Good God man, is this your day job? You are the ultimate coder, holy cow.