Új hozzászólás Aktív témák

  • Magga

    aktív tag

    Sziasztok!

    van egy ilyen lua script, ami tökéletesen működik jelenleg egy DS18b20 szenzorral:

    local heating_probe = 'Nappali'
    local thermostat_setpoint = 'Thermo'
    local heating_unit = 'futes'

    -- Use when a combined sensor (e.g. temperature and humidity) is used
    -- Replace in "otherdevices[heating_probe]" to "otherdevices[heating_probe]" by "temp_only" (in the 2nd "if" and in the "elseif".
    -- Remove the -- in the next two lines:

    --local naartekst = (tostring (otherdevices[heating_probe]))
    --local temp_only = (string.sub(naartekst,1,4)) -- the digits (1,4) do point out what characters of the string are needed.


    local hysteresis = 0.1

    commandArray = {}


    -- loop through all the devices
    for deviceName,deviceValue in pairs(otherdevices) do
    if (deviceName== thermostat_setpoint ) then

    if tonumber(deviceValue) < tonumber(otherdevices[heating_probe]-hysteresis) then

    if (otherdevices[heating_unit] == "On") then
    -- commandArray['SendNotification']='Heating is off'
    commandArray[heating_unit]='Off'
    print("Heating is Off")
    end

    elseif tonumber(deviceValue) > tonumber(otherdevices[heating_probe]+hysteresis) then
    if (otherdevices[heating_unit] == "Off") then
    commandArray[heating_unit]='On'
    -- commandArray['SendNotification']='Heating is on'
    print("Heating is On")
    end
    end
    end
    end

    -- loop through all the variables
    for variableName,variableValue in pairs(uservariables) do

    end

    return commandArray

    Ha kicserélem a szenzort DHT22-re, azonnal hibaüzenetet kapok, mert az ugye nem csak hőmérsékletet, hanem páratartalmat is mér.

    Ezt a részt kellene aktiválni, de nekem nem megy:

    -- Use when a combined sensor (e.g. temperature and humidity) is used
    -- Replace in "otherdevices[heating_probe]" to "otherdevices[heating_probe]" by "temp_only" (in the 2nd "if" and in the "elseif".
    -- Remove the -- in the next two lines:

    --local naartekst = (tostring (otherdevices[heating_probe]))
    --local temp_only = (string.sub(naartekst,1,4)) -- the digits (1,4) do point out what characters of the string are needed.

    Meg tudja valaki oldani ezt nekem???

Új hozzászólás Aktív témák