Skip to content

Commit

Permalink
Brought master in sync.
Browse files Browse the repository at this point in the history
  • Loading branch information
watou committed Jan 17, 2016
1 parent 34efeae commit 88323c7
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 15 deletions.
64 changes: 62 additions & 2 deletions src/D_EcobeeHumidistat1.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
"SceneGroup": [
{
"id": "1",
"top": "1.5",
"top": "0.5",
"left": "0.25",
"x": "1.5",
"y": "2"
"y": "3"
}
],
"Control": [
Expand Down Expand Up @@ -76,6 +76,20 @@
"Width": 75,
"Height": 20
}
},
{
"ControlGroup": "1",
"ControlType": "variable",
"top": "2",
"left": "0",
"Display": {
"Service": "urn:ecobee-com:serviceId:Ecobee1",
"Variable": "HumidityModeState",
"Top": 80,
"Left": 50,
"Width": 75,
"Height": 20
}
}
]
},
Expand Down Expand Up @@ -176,6 +190,52 @@
}
}
]
},
{
"id": 3,
"label": {
"lang_tag": "humidity_mode_state_changes",
"text": "Humidistat Running State Changes"
},
"serviceId": "urn:ecobee-com:serviceId:Ecobee1",
"argumentList": [
{
"id": 1,
"dataType": "string",
"defaultValue": "",
"allowedValueList": [
{
"Humidifying": "Humidifying",
"HumanFriendlyText": {
"lang_tag": "hft_hum_humidifying",
"text": "_DEVICE_NAME_ is humidifying"
}
},
{
"Dehumidifying": "Dehumidifying",
"HumanFriendlyText": {
"lang_tag": "hft_hum_dehumidifying",
"text": "_DEVICE_NAME_ is dehumidifying"
}
},
{
"Idle": "Idle",
"HumanFriendlyText": {
"lang_tag": "hft_hum_idle",
"text": "_DEVICE_NAME_ is idle"
}
}

],
"name": "HumidityModeState",
"comparisson": "=",
"prefix": {
"lang_tag": "hum_mode_state",
"text": "HumidityModeState"
},
"suffix": {}
}
]
}
],
"DeviceType": "urn:schemas-ecobee-com:device:EcobeeHumidistat:1"
Expand Down
24 changes: 11 additions & 13 deletions src/I_Ecobee1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ decompress_lzo_file() {
end

-- constants
local PLUGIN_VERSION = "1.3"
local PLUGIN_VERSION = "1.4"
local ECOBEE_SID = "urn:ecobee-com:serviceId:Ecobee1"
local TEMP_SENSOR_SID = "urn:upnp-org:serviceId:TemperatureSensor1"
local TEMP_SETPOINT_HEAT_SID = "urn:upnp-org:serviceId:TemperatureSetpoint1_Heat"
Expand Down Expand Up @@ -243,7 +243,14 @@ decompress_lzo_file() {
["Country"] = function(t) return t.location.country end,
["PostalCode"] = function(t) return t.location.postalCode end,
["PhoneNumber"] = function(t) return t.location.phoneNumber end,
["MapCoordinates"] = function(t) return t.location.mapCoordinates end
["MapCoordinates"] = function(t) return t.location.mapCoordinates end,
["HumidityModeState"] = function(t)
-- return "Humidifying", "Dehumidifying", "Idle" from list of humidifier, dehumidifier
if (string.find(t.equipmentStatus, "dehumid")) then return "Dehumidifying"
elseif (string.find(t.equipmentStatus, "humid")) then return "Humidifying"
else return "Idle"
end
end
},
[SWITCH_POWER_SID] = {
["Status"] = function(t) return isHome(t) and "1" or "0" end
Expand Down Expand Up @@ -398,10 +405,6 @@ decompress_lzo_file() {
return UPNP_TO_ECOBEE[serviceId][actionName][variableName](lul_settings)
end

local ecobeeLog

local auth_token_failures = 0

local function loadSession()
local session = {}

Expand All @@ -418,8 +421,6 @@ decompress_lzo_file() {
session.auth_token = luup.variable_get(ECOBEE_SID, "auth_token", PARENT_DEVICE)
if session.auth_token == "" then session.auth_token = nil end

session.auth_token_failures = auth_token_failures

session.access_token = luup.variable_get(ECOBEE_SID, "access_token", PARENT_DEVICE)
if session.access_token == "" then session.access_token = nil end

Expand All @@ -429,8 +430,6 @@ decompress_lzo_file() {
session.refresh_token = luup.variable_get(ECOBEE_SID, "refresh_token", PARENT_DEVICE)
if session.refresh_token == "" then session.refresh_token = nil end

session.log = ecobeeLog

return session
end

Expand All @@ -440,7 +439,6 @@ decompress_lzo_file() {
end

writeVariableIfChanged(PARENT_DEVICE, ECOBEE_SID, "auth_token", session.auth_token or "")
auth_token_failures = session.auth_token_failures or 0
writeVariableIfChanged(PARENT_DEVICE, ECOBEE_SID, "access_token", session.access_token or "")
writeVariableIfChanged(PARENT_DEVICE, ECOBEE_SID, "token_type", session.token_type or "")
writeVariableIfChanged(PARENT_DEVICE, ECOBEE_SID, "refresh_token", session.refresh_token or "")
Expand Down Expand Up @@ -595,6 +593,7 @@ decompress_lzo_file() {
luup.chdev.append(PARENT_DEVICE, ptr, altid, name, "urn:schemas-ecobee-com:device:EcobeeHumidistat:1",
"D_EcobeeHumidistat1.xml", "",
ecobeeToUpnpParam(HUMIDITY_SENSOR_SID, "CurrentLevel", t) ..
"\n" .. ecobeeToUpnpParam(ECOBEE_SID, "HumidityModeState", t) ..
"\n" .. ecobeeToUpnpParam(HA_DEVICE_SID, "LastUpdate", t) ..
"\n" .. ecobeeToUpnpParam(HA_DEVICE_SID, "CommFailure", r)
, false, false)
Expand Down Expand Up @@ -725,6 +724,7 @@ decompress_lzo_file() {
luup.attr_set("category_num", "16", child)
end
writeVariableFromEcobeeIfChanged(child, HUMIDITY_SENSOR_SID, "CurrentLevel", t)
writeVariableFromEcobeeIfChanged(child, ECOBEE_SID, "HumidityModeState", t)
writeVariableFromEcobeeIfChanged(child, HA_DEVICE_SID, "LastUpdate", t)
writeVariableFromEcobeeIfChanged(child, HA_DEVICE_SID, "CommFailure", r)
end
Expand Down Expand Up @@ -950,8 +950,6 @@ decompress_lzo_file() {

PARENT_DEVICE = lul_device

-- ecobeeLog = io.open("/tmp/ecobee." .. tostring(lul_device) .. ".log", "a")

TemperaturePrecision = tonumber(readVariableOrInit(PARENT_DEVICE, ECOBEE_SID, "TemperaturePrecision", "1"))
TemperaturePrecision = TemperaturePrecision or 1
if TemperaturePrecision < 1 or TemperaturePrecision > 1000 then
Expand Down
5 changes: 5 additions & 0 deletions src/S_Ecobee1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
<dataType>string</dataType>
<sendEventsAttribute>yes</sendEventsAttribute>
</stateVariable>
<stateVariable>
<name>HumidityModeState</name>
<dataType>string</dataType>
<sendEventsAttribute>yes</sendEventsAttribute>
</stateVariable>
</serviceStateTable>
<actionList>
<action>
Expand Down

0 comments on commit 88323c7

Please sign in to comment.