Changeset 13


Ignore:
Timestamp:
2011-11-25 23:36:09 (14 years ago)
Author:
bfromdruten
Message:

Bugfix: only set temperature or humidity when correct device type

File:
1 edited

Legend:

Unmodified
Added
Removed
  • I_RFXCOM.xml

    r12 r13  
    144144                    RFXCountTS2 = RFXCountTS2 + 1 
    145145                    RFXDevicesTS2[RFXCountTS2] = v.id 
     146                    luup.log("Registered device " .. RFXDevicesTS2[RFXCountTS2] .. " as temperature sensor ".. RFXCountTS2) 
    146147                end 
    147148                 
     
    150151                    RFXCountHS2 = RFXCountHS2 + 1 
    151152                    RFXDevicesHS2[RFXCountHS2] = v.id 
     153                    luup.log("Registered device " .. RFXDevicesHS2[RFXCountHS2] .. " as humidity sensor ".. RFXCountHS2) 
    152154                end 
    153155            end 
     
    11361138                 
    11371139                -- Execution for temperature sensor 
    1138                 -- Set temperature to command temperature 
    1139                 if bitw.band(lnSensorType,RFXConstants.sensorTypeTemperature) ~= 0 then 
     1140                -- Set temperature to command 
     1141                if bitw.band(lnSensorType,RFXConstants.sensorTypeTemperature) ~= 0 and tostring(v.device_type) == "urn:schemas-micasaverde-com:device:TemperatureSensor:1" then 
    11401142                    for lsKey,lsValue in string.gmatch(lsCmd, "(%w+)=([%w%.%-_]+)") do 
    11411143                        luup.log("Key=" ..  lsKey .. ";Value=" .. lsValue .. ";") 
    11421144                        if lsKey == "temperature" then 
     1145                            luup.log("SET CURRENTTEMPERATURE from " .. lsID .. " with value " .. lsValue) 
    11431146                            luup.variable_set("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", 
    11441147                                lsValue, device) 
     
    11481151 
    11491152                -- Execution for humidity sensor 
    1150                 -- Set temperature to command temperature 
    1151                 if bitw.band(lnSensorType,RFXConstants.sensorTypeHumidity) ~= 0 then 
     1153                -- Set humidity to command  
     1154                if bitw.band(lnSensorType,RFXConstants.sensorTypeHumidity) ~= 0 and tostring(v.device_type) == "urn:schemas-micasaverde-com:device:HumiditySensor:1" then 
    11521155                    for lsKey,lsValue in string.gmatch(lsCmd, "(%w+)=([%w%.%-_]+)") do 
    11531156                        luup.log("Key=" ..  lsKey .. ";Value=" .. lsValue .. ";") 
    11541157                        if lsKey == "humidity" then 
     1158                            luup.log("SET CURRENTLEVEL from " .. lsID .. " with value " .. lsValue) 
    11551159                            luup.variable_set("urn:micasaverde-com:serviceId:HumiditySensor1", "CurrentLevel", 
    11561160                                lsValue, device) 
Note: See TracChangeset for help on using the changeset viewer.