diff --git a/src/D_EcobeeHumidistat1.json b/src/D_EcobeeHumidistat1.json index afb609b..0d123ff 100644 --- a/src/D_EcobeeHumidistat1.json +++ b/src/D_EcobeeHumidistat1.json @@ -40,10 +40,10 @@ "SceneGroup": [ { "id": "1", - "top": "1.5", + "top": "0.5", "left": "0.25", "x": "1.5", - "y": "2" + "y": "3" } ], "Control": [ @@ -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 + } } ] }, @@ -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" diff --git a/src/I_Ecobee1.xml b/src/I_Ecobee1.xml index 8228824..9c7dd19 100644 --- a/src/I_Ecobee1.xml +++ b/src/I_Ecobee1.xml @@ -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" @@ -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 @@ -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 = {} @@ -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 @@ -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 @@ -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 "") @@ -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) @@ -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 @@ -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 diff --git a/src/S_Ecobee1.xml b/src/S_Ecobee1.xml index 71f693e..ad133c9 100644 --- a/src/S_Ecobee1.xml +++ b/src/S_Ecobee1.xml @@ -10,6 +10,11 @@ string yes + + HumidityModeState + string + yes +