I have two Sensi thermostats and wanted to know does anyone have any new information about integration with SmartThings. These were the least expensive at the time for me and also qualified for the rebate. I have everything integrated with SmartThings expect for my Sensi thermostats. I saw some older post saying Emerson did not have an open API available. The community here is very resourceful, so I was hoping someone may know or try something new. Thanks in advance for any feedback.
Hoping for the sameâŠ
Hey guys⊠I donât actually own a Sensi Thermostat, but my brother does. I have been working on writing up a SmartApp and the Device Handler for Emerson Sensi. The API is still not open. The interface does its best to mimic a web browser. I followed some other programming language examples and came up with the following. Have you ever installed Custom SmartApps and Device Handlers? You should be able to copy and paste those in directly. Unfortunately, the only way I could see to log in to the Sensi website via this interface requires you store your username and password in the app itself. So if youâre comfortable with that then you should load it up, try it out and let me know what issues you have.
I canât really test the app out myself all that wellâŠ
The SmartApp and Device Type are located at https://github.com/kirkbrownOK/SensiThermostat
Thanks to :
Thanks a million times, got everything installed and looks good so far. I havenât had much time to test it out, but basic functions seem OK so far.
I also installed today and it seems to work great with the exception of Google Home voice control. Google says it received the command and smart-things shows it was received but the thermostat does not adjust. None voice control works awesome. Thanks.
I just installed as well. Works perfectly. Been looking for this solution for about 2 years. The Sensi thermostats work great, but only delivered Echo integration. Thanks so much for contributing.
Kirks Sensi Thermostat driver and App are great! Thanks to Kirk for taking the initiative to make this happen. Iâve been playing around with it for several days and am very pleased with the results.
Iâve tried to set it up a few times, but when I get to the last step where I have to hit âDoneâ to save the smartapp parameters, it crashes with an âunknown errorâ and can never save. Tried last night and again this morning. It seems my two thermostats though, which is good ?
Figured it out by looking at the live log in the IDE. Apparently it doesnât like this > physicalgraph.scheduling.CronExpressionException: Invalid cron expression found â0 0/240 * * * ?â @ line 150
I thought it refers to seconds, but apparently itâs minutes ? So I set it to poll every 5 minutes and it was able to save the settings and setup properly. Thanks for the great app by the way!!!
Thatâs a good catch. The SmartThings scheduling system wonât let you set schedules that are less than 1 minute. I added a (minutes) line to the poll rate input statement. Additionally I added a statement to check if the minutes were set to more than 59 and will drop back to 5 if that does happen.
Its definitely not worth pulling that new code down, but should help the next person.
Can you please elaborate on âenabling OUTHâ. I am new to this, so appreciate the guidance.
Hey Norm Iâm not sure where the âenabling outhâ comment is from. If it was from me I was griping about sensi not being open enough in their API. OAUTH is a type of authentication that only needs a userâs credentials 1 time and then saves secure tokens, secret, and identifiers but arenât the users credentials. That is preferred, but the sensi API doesnât allow that with just any users. So the smartapp I wrote requires you to save your username and password inside the app. Which as far as I know is still pretty secure, but since itâs a community developed app I wanted to be clear about how the smartapp authorizes itself. There is always risk installing other peopleâs code (especially if you donât/canât understand it), and in good faith I want everyone to know. So thatâs the soap box, you shouldnât enable OAUTH for this smartapp, and if you do then I forgot to comment out some lines of code somewhere.
Kirk,
Thanks for responding.
The âOUTHâ statement came from the generic instruction on using a custom smart app that you referenced to, and I now see was not written by you (see Step SA5) in https://github.com/kirkbrownOK/SensiThermostat
Anyway, that app work great.
Last question, have you though incorporating battery voltage display in to the app?
Thank you very much.
Norm.
Norm,
Actually no. I can see how that would be useful, but I donât have a Sensi Thermostat. I parsed it out as an attribute sensiBatteryVoltage, but I didnât display it as a tile. The thermostat I was testing off of had a voltage readout of milliVolts, usually around 3100. Iâm guessing that they are using 2 AA, nominal voltage of 1.5V so 3000 mV should be the minimum voltage?
To display something along those lines, you should modify your device handler to include a tile for sensiBatteryVoltage and then add that tile name to the details([ ]) function. Should look something like this:
standardTile("refresh", "device.refresh", inactiveLabel:false, decoration:"flat",width:6, height:2) {
state "default", icon:"st.secondary.refresh", action:"refresh.refresh"
state "error", icon:"st.secondary.refresh", action:"refresh.refresh", backgroundColor:"#e81e1e"
}
//No clue what a Fully Charged battery is vs a Dead Battery. Guessing from 2 AA nominal 1.5V per unit and 3.0V is adequate
valueTile("batteryDisplay", "device.sensiBatteryVoltage", inactiveLabel:false) {
state "default", label:'${currentValue}', unit:"milliVolts",
backgroundColors:[
[value: 3000, color: "#ff3300"],
[value: 3075, color: "#ffff00"],
// [value: 3150, color: "#33cc33"],
//[value: 74, color: "#44b621"],
//[value: 84, color: "#f1d801"],
//[value: 95, color: "#d04e00"],
[value: 3140, color: "#33cc33"]
]
}
main(["temperatureIcon" ])
details(["thermostatFull","temperature", "operatingState", "fanState",
"mode", "fanMode", "hold",
"heatingSetpoint", "heatDown", "heatUp",
"coolingSetpoint", "coolDown", "coolUp",
"batteryDisplay",
"refresh"])
}
Yes, exactly. They use 2 x AA batteries.
I got the code to work, although I see two tiles with voltage (see screenshot). Question: How do I get voltage to display in Volts vs milliVolts?
Thanks.
Hey Norm, looking at that screenshot makes me think that somehow, your details([ ]) function likely has two âbatteryDisplayâ entries?
Mine looks like:
valueTile("batteryDisplay", "device.sensiBatteryVoltage", inactiveLabel:false) {
state "default", label:'${currentValue}', unit:"V",
backgroundColors:[
[value: 2.9, color: "#ff3300"],
[value: 3.07, color: "#ffff00"],
[value: 3.1, color: "#33cc33"],
[value: 3.5, color: "#33cc33"],
[value: 2900, color: "#ff3300"],
[value: 3075, color: "#ffff00"],
[value: 3100, color: "#33cc33"],
[value: 3500, color: "#33cc33"]
]
}
valueTile("lowBattery", "device.sensiLowPower", inactiveLabel:false, width: 2) {
state "default", label:'LowPower: ${currentValue}', unit:"V"
}
main(["temperatureIcon" ])
details(["thermostatFull","temperature", "operatingState", "fanState",
"mode", "fanMode", "hold",
"heatingSetpoint", "heatDown", "heatUp",
"coolingSetpoint", "coolDown", "coolUp",
"batteryDisplay","lowBattery",
"refresh"])
}
Iâm going to make a few suggestions regarding the battery info.
- Add the Capability of âBatteryâ - I think that is what it is. If the battery value gets âLowâ then ST will alert you.
- Add another attribute for the device that will show you the value from Sensi that is âLowPowerâ.
- Change the parsing on the batteryvoltage from milliVolts to Volts
- If the sensi thermostat decides the batteries are âLowPowerâ then set the battery level to 0 and have ST alert the user. Otherwise the battery will be set as 100. That is just % and isnât shown as a tile (but could be if you wanted)
1 Looks like:
capability "Relative Humidity Measurement"
capability "Health Check"
capability "Battery" //New Capability
2 Looks like:
attribute "sensiThermostatMode", "string"
attribute "sensiBatteryVoltage", "number"
attribute "sensiLowPower", "string" //New Attribute
attribute "thermostatHoldMode", "string"
3 And 4 Look like:
//Existing unchanged code
if(name=="Humidity") {
def sendValue = value
checkSendEvent("humidity", sendValue, "${device.label} humidity ${sendValue}","%")
}
//This will convert milliVolts to Volts
if(name=="BatteryVoltage") {
//def sendValue = value //In milliVolts
def sendValue = value/1000 // in Volts
TRACE("BV is $value and sensiBV is ${sendValue.toFloat().round(1)}")
checkSendEvent("sensiBatteryVoltage", sendValue.toFloat().round(1), "${device.label} BatteryVoltage ${sendValue}",null,false)
}
//This will parse LowPower into sensiLowPower attribute and it will send low battery alarms from ST via battery capability
if(name == "LowPower") {
def sendValue = value
checkSendEvent("sensiLowPower", sendValue, "${device.label} LowPower ${sendValue}",null,sendValue)
if (sendValue == true) {
checkSendEvent("battery", 0, "${device.label} Battery is Low", null, true)
} else {
checkSendEvent("battery", 100, "${device.label} Battery is Not Low", null, false)
}
}
Thanks Kirk.
I incorporated all the changes and cleaned up the color of the Battery Voltage tile based on the voltage range provided by Sensi support. Not 100% of the need for the âLowPower: falseâ tile, but left in there. I figured that the test of the voltage and color coding of the Voltage tile should probably be sufficient without the need for the separate tile.
Anyway, I am attaching the complete handler in case you want the version I now have.
Thanks again,
Norm.
Hey Kirk, Just started playing with your code since I installed my Sensi yesterdayâŠhere is a screenshotâŠgood job.
Wanted to post and say Thank You for your efforts. Works great! Setup a routine in ST and can just tell Alexa âTurn On Bedtimeâ to turn off all the lights and set my pellet stove to 45 degrees.
Great Job! I love it!