Toon met Domoticz: IDX 0 not found!

If your (rooted) Toon doesn't do what it's supposed to, post here. Dutch allowed / Posten in 't Nederlands toegestaan.

Moderator: marcelr

Toon met Domoticz: IDX 0 not found!

Postby Clinthighway » Sat Aug 11, 2018 11:12 pm

Hallo allemaal,

Ik heb een tijde terug aan de handleiding van TerrorSource domoticaforum.eu/viewtopic.php?f=87& ... 6%23p86846
Mijn Toon gekoppeld aan Domoticz, Alleen krijg het niet volledig werkend.

Temperatuur uitlezen lukt, Toonscenes aanpassen (Thuis,Weg, Slaapstand) aanpassen lukt en wordt zonder problemen door gegeven aan de Toon.
Behalve de optie "Toontermostat" werkt niet, (Deze wordt ook in het rood weer gegeven).

Als ik de temperatuur aanpas schiet deze automatisch weer terug naar de standaard 20 'C.
Dit in combinatie met de geven fout log "2018-08-11 23:55:00.466 Error: EventSystem: UpdateDevice IDX 0 not found!"

Die waarschijnlijk afkomstig is van de LUA script "Toon" want als ik deze uitschakel krijg ik geen nieuwe Error te zien in de fout log.

Heb al diverse dingen geprobeerd.

Clean install Raspberry + Domoticz
Diverse software versies van Domoticz.
Toon reset (Software versie 4.16.8 )
Alles gecontroleerd maar kan niks geks vinden.

Hopelijk dat iemand hier nog iets weet waar ik naar zou kunnen kijken om het op te lossen ?

Alvast bedankt.
Clinthighway
Starting Member
Starting Member
 
Posts: 7
Joined: August 2018

Re: Toon met Domoticz: IDX 0 not found!

Postby TerrorSource » Sun Aug 12, 2018 3:03 pm

Heb je al in de topic gekeken waar alle info vandaan komt?

https://www.domoticz.com/forum/viewtopic.php?t=11421
TerrorSource
Member
Member
 
Posts: 121
Joined: May 2017

Re: Toon met Domoticz: IDX 0 not found!

Postby mAiden » Sun Aug 12, 2018 7:26 pm

Hoe ziet je user variabele eruit? Blijkbaar mis je er een, aangezien hij een idx niet kan vinden.
mAiden
Starting Member
Starting Member
 
Posts: 44
Joined: July 2017

Re: Toon met Domoticz: IDX 0 not found!

Postby Clinthighway » Mon Aug 13, 2018 4:13 pm

Image

user variabele moet goed zijn denk ik ?
Alles staat er in als goed is zonder spel fouten.\

Daarom snap ik de IDX fout ook niet.
Clinthighway
Starting Member
Starting Member
 
Posts: 7
Joined: August 2018

Re: Toon met Domoticz: IDX 0 not found!

Postby Clinthighway » Mon Aug 13, 2018 5:39 pm

Gedeeltelijk het probleem gevonden.

Als ik de Toon script gebruikt die meegeleverd zit met handleiding van TerrorSource krijg ik de IDX 0 error vanuit het laatste stukje script.
Terwijl de Dumy hardware en user variabele goed staan naar mij idee.


Code: Select all
         -- Update the toon burner selector to current program state
         CurrentToonBurnerValue = otherdevices_svalues[ToonBurnerName] 
         
         if currentBurnerInfo == 0 then currentBurnerInfo = '0' -- uit
         elseif currentBurnerInfo == 1 then currentBurnerInfo = '10' -- cv aan
         elseif currentBurnerInfo == 2 then currentBurnerInfo = '20' -- warmwater aan
         end
         
         if CurrentToonBurnerValue ~= currentBurnerInfo then  -- Update toon burner selector if it has changed
            print ('Updating Toon burner info')
            commandArray[7] = {['UpdateDevice'] = string.format('%s|1|%s', otherdevices_idx[ToonBurnerName], currentBurnerInfo)}
         end

    end


Als laatste stukje script verwijderd krijg ik geen IDX 0 error meer.
En kan de thermostaat gebruiken in Domoticz.

Alleen krijg ik een andere error te zien waardoor de temperatuur niet geupdate wordt in Domoticz.

"Error: EventSystem: in Toon: [string "-- Version 1:
..."]:143: 'end' expected (to close 'if' at line 45) near <eof>
"
Als zo lees betreft het regel 45 en 143.

regel 45
Code: Select all
if jsonThermostatInfo ~= nil then

regel 143
Code: Select all
return commandArray


Alleen dit lijtk mij in het geheel goed te staan.
Zitten geen dubbele If's of ends in.

Misschien dat iemand het kan zien ?
Heb laatste stukje script effe uitgezet waarop de IDX 0 error van afkomstig is.

Code: Select all
-- Version 1:
-- Time script runs every minute, intended to sync Domoticz with Toon in case the value is changed on the physical device.
-- Updates Toon Thermostat Sensor to value set on Toon
-- Updates Toon Temperature Sensor to value set on Toon
-- Updates Toon Scenes switch based on program set on Toon
-- Updates Toon Auto Program switch to value set on Toon
-- Updates Toon program information text to value set on Toon

-- Version 2
-- Improvements:
-- - Check each value for a nil value (in case of a failed request)
-- - Changed all global allocations to local. This is to prevent a memory leak. (This is how LUA works)
-- - Added a timeout to curl (--max-time) which will prevent the script from running for more than 10 seconds and thus decreasing the warnings, in case Toon can't be reached.
--   Please take note that this will also ignore the values for that particular request.
-- Source: https://www.domoticz.com/forum/viewtopic.php?f=34&t=11421&start=20#p125837

-- Extra improvement:
-- Updates Toon Burner status in order to see in domoticz if your boiler is on for the hotwater or heating or off
-- Updates Toon Boiler temp

commandArray = {}

    ToonThermostatSensorName = uservariables['UV_ToonThermostatSensorName'] -- Sensor showing current setpoint
    ToonTemperatureSensorName = uservariables['UV_ToonTemperatureSensorName'] -- Sensor showing current room temperature
    ToonScenesSensorName  = uservariables['UV_ToonScenesSensorName'] -- Sensor showing current program
    ToonAutoProgramSensorName = uservariables['UV_ToonAutoProgramSensorName'] -- Sensor showing current auto program status
   ToonBurnerName = uservariables['UV_ToonBurnerName']
   ToonProgramInformationSensorName = uservariables['UV_ToonProgramInformationSensorName'] -- Sensor showing displaying program information status
   ToonBoilerTempSetpoint = uservariables['UV_ToonBoilerTempSetpointSensorName'] -- Sensor showing current internal boiler temp
    ToonIP = uservariables['UV_ToonIP']
    DomoticzIP = uservariables['UV_DomoticzIP']
   
    json = assert(loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()  -- For Raspberryy
   
    local handle = assert(io.popen(string.format('curl -m 5 http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))
        local ThermostatInfo = handle:read('*all')
    handle:close()

-- JSON data from Toon contains a extra "," which should not be there.
   ThermostatInfo = string.gsub(ThermostatInfo, ",}", "}")

    jsonThermostatInfo = json:decode(ThermostatInfo)
   
   
if jsonThermostatInfo ~= nil then
     
    currentSetpoint = tonumber(jsonThermostatInfo.currentSetpoint) / 100
    currentTemperature = tonumber(jsonThermostatInfo.currentTemp) / 100
    currentProgramState = tonumber(jsonThermostatInfo.programState)
    currentActiveState = tonumber(jsonThermostatInfo.activeState)
    currentNextTime = jsonThermostatInfo.nextTime
    currentNextSetPoint = tonumber(jsonThermostatInfo.nextSetpoint) / 100
    currentBoilerSetPoint = tonumber(jsonThermostatInfo.currentInternalBoilerSetpoint)
   currentBurnerInfo = tonumber(jsonThermostatInfo.burnerInfo)
   
        if currentSetpoint ~= nil then
            -- Update the thermostat sensor to current setpoint
            if otherdevices_svalues[ToonThermostatSensorName]*100 ~= currentSetpoint*100 then
                print('Updating thermostat sensor to new set point: ' ..currentSetpoint)
                commandArray[1] = {['Variable:UV_ToonChangedByDomoticz'] = '1'} -- Set variable changed to 1 to prevent script ToonSetPoint from shooting an event at Toon
                commandArray[2] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonThermostatSensorName], currentSetpoint)}
            end
        end
   
        if currentTemperature ~= nil then
            -- Update the temperature sensor to current room temperature
            if otherdevices_svalues[ToonTemperatureSensorName]*100 ~= currentTemperature*100 then
                print('Updating the temperature sensor to new value: ' ..currentTemperature)
                commandArray[3] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonTemperatureSensorName], currentTemperature)}
            end
       
        end
   
       if currentBoilerSetPoint ~= nil then
         -- Update the temperature of boiler
         if otherdevices_svalues[ToonBoilerTempSetpoint]*100 ~= currentBoilerSetPoint*100 then
            print('Updating the boiler temperature to new value: ' ..currentBoilerSetPoint)
            commandArray[3] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonBoilerTempSetpoint], currentBoilerSetPoint)}
         end
      end
   
        if currentActiveState ~= nil then
            -- Update the toon scene selector sensor to current program state
            CurrentToonScenesSensorValue = otherdevices_svalues[ToonScenesSensorName]
   
            if currentActiveState == -1 then currentActiveState = '50' -- Manual
            elseif currentActiveState == 0 then currentActiveState = '40' -- Comfort
            elseif currentActiveState == 1 then currentActiveState = '30' -- Home
            elseif currentActiveState == 2 then currentActiveState = '20' -- Sleep
            elseif currentActiveState == 3 then currentActiveState = '10' -- Away
            end
   
            if CurrentToonScenesSensorValue ~= currentActiveState then  -- Update toon selector if it has changed
                print ('Updating Toon Scenes selector')
                commandArray[4] = {['UpdateDevice'] = string.format('%s|1|%s', otherdevices_idx[ToonScenesSensorName], currentActiveState)}
            end
        end
   
        if currentProgramState ~= nil then
            -- Updates the toon auto program switch
            CurrentToonAutoProgramSensorValue = otherdevices_svalues[ToonAutoProgramSensorName]
   
           if currentProgramState == 0 then currentProgramState = '10' -- No
            elseif currentProgramState == 1 then currentProgramState = '20' -- Yes
            elseif currentProgramState == 2 then currentProgramState = '30' -- Temporary       
            end
   
            if CurrentToonAutoProgramSensorValue ~= currentProgramState then -- Update toon auto program selector if it has changed
                print ('Updating Toon Auto Program selector')
                commandArray[5] = {['UpdateDevice'] = string.format('%s|1|%s', otherdevices_idx[ToonAutoProgramSensorName], currentProgramState)}
            end
        end
   
        if currentNextTime ~= nil and currentNextSetPoint ~= nil then
            -- Updates the toon program information text box
            CurrentToomProgramInformationSensorValue = otherdevices_svalues[ToonProgramInformationSensorName]
            if currentNextTime == 0 or currentNextSetPoint == 0 then
                ToonProgramInformationSensorValue = 'Op ' ..currentSetpoint.. '°'
            else
                ToonProgramInformationSensorValue = 'Om ' ..os.date('%H:%M', currentNextTime).. ' op ' ..currentNextSetPoint.. '°'
            end
   
            if CurrentToomProgramInformationSensorValue ~= ToonProgramInformationSensorValue then
                commandArray[6] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonProgramInformationSensorName], ToonProgramInformationSensorValue)}
            end
end
       
           -- Update the toon burner selector to current program state
--         CurrentToonBurnerValue = otherdevices_svalues[ToonBurnerName] 
--         
--         if currentBurnerInfo == 0 then currentBurnerInfo = '0' -- uit
--         elseif currentBurnerInfo == 1 then currentBurnerInfo = '10' -- cv aan
--         elseif currentBurnerInfo == 2 then currentBurnerInfo = '20' -- warmwater aan
--         end
--         
--         if CurrentToonBurnerValue ~= currentBurnerInfo then  -- Update toon burner selector if it has changed
--            print ('Updating Toon burner info')
--            commandArray[7] = {['UpdateDevice'] = string.format('%s|1|%s', otherdevices_idx[ToonBurnerName], currentBurnerInfo)}
--         end
--       end


return commandArray
Clinthighway
Starting Member
Starting Member
 
Posts: 7
Joined: August 2018

Re: Toon met Domoticz: IDX 0 not found!

Postby mAiden » Mon Aug 13, 2018 7:31 pm

Je mag best mij scripts die ik gebruik ervoor, proberen?

Toon Thermostaat:

Code: Select all
commandArray = {}

    ToonThermostatSensorName = uservariables['UV_ToonThermostatSensorName'] -- Sensor showing current setpoint
    ToonIP = uservariables['UV_ToonIP']
   
    for deviceName,deviceValue in pairs(devicechanged) do
        if (deviceName == ToonThermostatSensorName) then
            if uservariables['UV_ToonChangedByDomoticz'] == 1 then
                commandArray['Variable:UV_ToonChangedByDomoticz'] = '0'
            else
                SetPoint = otherdevices_svalues[ToonThermostatSensorName]
                ToonCommand = string.format('http://%s/happ_thermstat?action=setSetpoint&Setpoint=%s', ToonIP, SetPoint*100)
               
                print('Setting Toon setpoint to '.. SetPoint)
                commandArray['OpenURL'] = ToonCommand
            end
        end
    end

return commandArray


Toon zonder de branderinfo

Code: Select all
-- Time script runs every minute, intended to sync Domoticz with Toon in case the value is changed on the physical device.
-- Updates Toon Thermostat Sensor to value set on Toon
-- Updates Toon Temperature Sensor to value set on Toon
-- Updates Toon Scenes switch based on program set on Toon
-- Updates Toon Auto Program switch to value set on Toon
-- Updates Toon program information text to value set on Toon

commandArray = {}

    ToonThermostatSensorName = uservariables['UV_ToonThermostatSensorName'] -- Sensor showing current setpoint
    ToonTemperatureSensorName = uservariables['UV_ToonTemperatureSensorName'] -- Sensor showing current room temperature
    ToonScenesSensorName  = uservariables['UV_ToonScenesSensorName'] -- Sensor showing current program
    ToonAutoProgramSensorName = uservariables['UV_ToonAutoProgramSensorName'] -- Sensor showing current auto program status
    ToonProgramInformationSensorName = uservariables['UV_ToonProgramInformationSensorName'] -- Sensor showing displaying program information status
    ToonIP = uservariables['UV_ToonIP']
    DomoticzIP = uservariables['UV_DomoticzIP']

    json = assert(loadfile "/home/domoticz/scripts/lua/JSON.lua")()  -- For Raspberry
   
    local handle = assert(io.popen(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))
        local ThermostatInfo = handle:read('*all')
    handle:close()
   
    jsonThermostatInfo = json:decode(ThermostatInfo)
   
    currentSetpoint = tonumber(jsonThermostatInfo.currentSetpoint) / 100
    local currentTemperature = tonumber(jsonThermostatInfo.currentTemp) / 100
    currentTemperature = tonumber(string.format("%.1f", currentTemperature))  -- 1 decimaal is voldoende
    currentProgramState = tonumber(jsonThermostatInfo.programState)
    currentActiveState = tonumber(jsonThermostatInfo.activeState)
    currentNextTime = jsonThermostatInfo.nextTime
    currentNextSetPoint = tonumber(jsonThermostatInfo.nextSetpoint) / 100
   
    -- Update the thermostat sensor to current setpoint
    if otherdevices_svalues[ToonThermostatSensorName]*100 ~= currentSetpoint*100 then 
        print('Updating thermostat sensor to new set point: ' ..currentSetpoint)
        commandArray[1] = {['Variable:UV_ToonChangedByDomoticz'] = '1'} -- Set variable changed to 1 to prevent script ToonSetPoint from shooting an event at Toon
        commandArray[2] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonThermostatSensorName], currentSetpoint)}
    end
   
    -- Update the temperature sensor to current room temperature
    if otherdevices_svalues[ToonTemperatureSensorName]*100 ~= currentTemperature*100 then
        print('Updating the temperature sensor to new value: ' ..currentTemperature)
        commandArray[3] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonTemperatureSensorName], currentTemperature)}
    end
   
    -- Update the toon scene selector sensor to current program state
    CurrentToonScenesSensorValue = otherdevices_svalues[ToonScenesSensorName]
   
    if currentActiveState == -1 then currentActiveState = '50' -- Manual
    elseif currentActiveState == 0 then currentActiveState = '40' -- Comfort
    elseif currentActiveState == 1 then currentActiveState = '30' -- Home
    elseif currentActiveState == 2 then currentActiveState = '20' -- Sleep
    elseif currentActiveState == 3 then currentActiveState = '10' -- Away
    end
   
    if CurrentToonScenesSensorValue ~= currentActiveState then  -- Update toon selector if it has changed
        print ('Updating Toon Scenes selector')
        commandArray[4] = {['UpdateDevice'] = string.format('%s|1|%s', otherdevices_idx[ToonScenesSensorName], currentActiveState)}
    end
   
    -- Updates the toon auto program switch
    CurrentToonAutoProgramSensorValue = otherdevices_svalues[ToonAutoProgramSensorName]
   
    if currentProgramState == 0 then currentProgramState = '10' -- No
    elseif currentProgramState == 1 then currentProgramState = '20' -- Yes
    elseif currentProgramState == 2 then currentProgramState = '30' -- Temporary       
    end
   
    if CurrentToonAutoProgramSensorValue ~= currentProgramState then -- Update toon auto program selector if it has changed
        print ('Updating Toon Auto Program selector')
        commandArray[5] = {['UpdateDevice'] = string.format('%s|1|%s', otherdevices_idx[ToonAutoProgramSensorName], currentProgramState)}
    end
   
    -- Updates the toon program information text box
    CurrentToomProgramInformationSensorValue = otherdevices_svalues[ToonProgramInformationSensorName]
    if currentNextTime == 0 or currentNextSetPoint == 0 then
        ToonProgramInformationSensorValue = 'Op ' ..currentSetpoint.. '°'
    else
        ToonProgramInformationSensorValue = 'Om ' ..os.date('%H:%M', currentNextTime).. ' op ' ..currentNextSetPoint.. '°'
    end
   
    if CurrentToomProgramInformationSensorValue ~= ToonProgramInformationSensorValue then
        commandArray[6] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonProgramInformationSensorName], ToonProgramInformationSensorValue)}
    end
       
--


Even opletten dat je de correcte user variable heb toegevoegd.. Zal voor de zekerheid hier onder mij user variable zetten..

User.png
User.png (35.53 KiB) Viewed 251 times


Gas en Stroom variable is niet nodig, dit zijn aparte LUA scripts die ik gebruik, om het gas en stroom verbruik uit Toon te lezen.
mAiden
Starting Member
Starting Member
 
Posts: 44
Joined: July 2017

Re: Toon met Domoticz: IDX 0 not found!

Postby Clinthighway » Mon Aug 13, 2018 8:26 pm

Heb je script toegevoegd.

Krijg op het eerste gezicht geen fout log meer te zien.

Alleen werkt met de script te Thermostaat niet meer.

(Ben trouwens in de toekomst wel benieuwd naar je Stroom/gas script :D )
Clinthighway
Starting Member
Starting Member
 
Posts: 7
Joined: August 2018

Re: Toon met Domoticz: IDX 0 not found!

Postby Clinthighway » Mon Aug 13, 2018 10:00 pm

Heb je script even naast die van mij gelegd met Note++ en even compare gedaan.

Verschill zit hem er in bij regel nr 39

Ik moet hier voor nog een keer "end" invullen om me thermostaat te laten werken.
Alleen als ik dit invul krijg weer een error log te zien

"EventSystem: in Toon: [string "commandArray = {}..."]:39: <eof> expected near 'end'"

Image

Dus op een of andere manier zit er toch iets fout.

Voor de rest is het script precies het zelfde.

Code: Select all
commandArray = {}

    ToonThermostatSensorName = uservariables['UV_ToonThermostatSensorName'] -- Sensor showing current setpoint
    ToonTemperatureSensorName = uservariables['UV_ToonTemperatureSensorName'] -- Sensor showing current room temperature
    ToonScenesSensorName  = uservariables['UV_ToonScenesSensorName'] -- Sensor showing current program
    ToonAutoProgramSensorName = uservariables['UV_ToonAutoProgramSensorName'] -- Sensor showing current auto program status
    ToonProgramInformationSensorName = uservariables['UV_ToonProgramInformationSensorName'] -- Sensor showing displaying program information status
    ToonIP = uservariables['UV_ToonIP']
    DomoticzIP = uservariables['UV_DomoticzIP']

    json = assert(loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()  -- For Raspberry
   
    local handle = assert(io.popen(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))
        local ThermostatInfo = handle:read('*all')
    handle:close()

   
   
    jsonThermostatInfo = json:decode(ThermostatInfo)
   
    currentSetpoint = tonumber(jsonThermostatInfo.currentSetpoint) / 100
    local currentTemperature = tonumber(jsonThermostatInfo.currentTemp) / 100

    currentProgramState = tonumber(jsonThermostatInfo.programState)
    currentActiveState = tonumber(jsonThermostatInfo.activeState)
    currentNextTime = jsonThermostatInfo.nextTime
    currentNextSetPoint = tonumber(jsonThermostatInfo.nextSetpoint) / 100




   
    -- Update the thermostat sensor to current setpoint
    if otherdevices_svalues[ToonThermostatSensorName]*100 ~= currentSetpoint*100 then 
        print('Updating thermostat sensor to new set point: ' ..currentSetpoint)
        commandArray[1] = {['Variable:UV_ToonChangedByDomoticz'] = '1'} -- Set variable changed to 1 to prevent script ToonSetPoint from shooting an event at Toon
        commandArray[2] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonThermostatSensorName], currentSetpoint)}
        end   
    end
   


    -- Update the temperature sensor to current room temperature
    if otherdevices_svalues[ToonTemperatureSensorName]*100 ~= currentTemperature*100 then
        print('Updating the temperature sensor to new value: ' ..currentTemperature)
        commandArray[3] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonTemperatureSensorName], currentTemperature)}
    end

      

   
    -- Update the toon scene selector sensor to current program state
    CurrentToonScenesSensorValue = otherdevices_svalues[ToonScenesSensorName]


    if currentActiveState == -1 then currentActiveState = '50' -- Manual
    elseif currentActiveState == 0 then currentActiveState = '40' -- Comfort
    elseif currentActiveState == 1 then currentActiveState = '30' -- Home
    elseif currentActiveState == 2 then currentActiveState = '20' -- Sleep
    elseif currentActiveState == 3 then currentActiveState = '10' -- Away
    end
   
    if CurrentToonScenesSensorValue ~= currentActiveState then  -- Update toon selector if it has changed
        print ('Updating Toon Scenes selector')
        commandArray[4] = {['UpdateDevice'] = string.format('%s|1|%s', otherdevices_idx[ToonScenesSensorName], currentActiveState)}
    end

      
       
   
    -- Updates the toon auto program switch
    CurrentToonAutoProgramSensorValue = otherdevices_svalues[ToonAutoProgramSensorName]


    if currentProgramState == 0 then currentProgramState = '10' -- No
    elseif currentProgramState == 1 then currentProgramState = '20' -- Yes
    elseif currentProgramState == 2 then currentProgramState = '30' -- Temporary       
    end
   
    if CurrentToonAutoProgramSensorValue ~= currentProgramState then -- Update toon auto program selector if it has changed
        print ('Updating Toon Auto Program selector')
        commandArray[5] = {['UpdateDevice'] = string.format('%s|1|%s', otherdevices_idx[ToonAutoProgramSensorName], currentProgramState)}
    end
   
    -- Updates the toon program information text box
    CurrentToomProgramInformationSensorValue = otherdevices_svalues[ToonProgramInformationSensorName]
    if currentNextTime == 0 or currentNextSetPoint == 0 then
        ToonProgramInformationSensorValue = 'Op ' ..currentSetpoint.. '°'
    else
        ToonProgramInformationSensorValue = 'Om ' ..os.date('%H:%M', currentNextTime).. ' op ' ..currentNextSetPoint.. '°'
    end


   
    if CurrentToomProgramInformationSensorValue ~= ToonProgramInformationSensorValue then
        commandArray[6] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonProgramInformationSensorName], ToonProgramInformationSensorValue)}
    end
       



return commandArray
Clinthighway
Starting Member
Starting Member
 
Posts: 7
Joined: August 2018

Re: Toon met Domoticz: IDX 0 not found!

Postby mAiden » Mon Aug 13, 2018 10:29 pm

Zie wat je bedoeld.. Ga daar morgen even naar kijken voor je, zodat wel functioneert.

Kom er op terug
mAiden
Starting Member
Starting Member
 
Posts: 44
Joined: July 2017

Re: Toon met Domoticz: IDX 0 not found!

Postby mAiden » Tue Aug 14, 2018 5:51 pm

@Clinthighway:

Zoals beloofd, kwam ik er op terug.. Deze Dzevents werken wel bij mij..

Code: Select all

return {
   on = {
      timer = {
         'every minute'
      }
   },
   execute = function(domoticz)
        local ToonThermostatSensorName = domoticz.variables('UV_ToonThermostatSensorName').value -- Sensor showing current setpoint
        local ToonTemperatureSensorName = domoticz.variables('UV_ToonTemperatureSensorName').value -- Sensor showing current room temperature
        local ToonScenesSensorName  = domoticz.variables('UV_ToonScenesSensorName').value -- Sensor showing current program
        local ToonAutoProgramSensorName = domoticz.variables('UV_ToonAutoProgramSensorName').value -- Sensor showing current auto program status
        local ToonProgramInformationSensorName = domoticz.variables('UV_ToonProgramInformationSensorName').value -- Sensor showing displaying program information status
        local ToonIP = domoticz.variables('UV_ToonIP').value
        local DomoticzIP = domoticz.variables('UV_DomoticzIP').value
   
        -- Handle json
        --local json = assert(loadfile "C:\\Program Files (x86)\\Domoticz\\scripts\\lua\\json.lua")()  -- For Windows
        local json = assert(loadfile "/home/domoticz/scripts/lua/JSON.lua")()  -- For Linux
       
        local handle = assert(io.popen(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))
            local ThermostatInfo = handle:read('*all')
        handle:close()
       
        local jsonThermostatInfo = json:decode(ThermostatInfo)
       
        if jsonThermostatInfo == nil then
            return
        end
       
        local currentSetpoint = tonumber(jsonThermostatInfo.currentSetpoint) / 100
        local currentTemperature = tonumber(jsonThermostatInfo.currentTemp) / 100
        local currentProgramState = tonumber(jsonThermostatInfo.programState)
            if currentProgramState == 0 then currentProgramState = 10 -- No
                elseif currentProgramState == 1 then currentProgramState = 20 -- Yes
                elseif currentProgramState == 2 then currentProgramState = 30 -- Temporary       
            end     
        local currentActiveState = tonumber(jsonThermostatInfo.activeState)
            if currentActiveState == -1 then currentActiveState = 50 -- Manual
                elseif currentActiveState == 0 then currentActiveState = 40 -- Comfort
                elseif currentActiveState == 1 then currentActiveState = 30 -- Home
                elseif currentActiveState == 2 then currentActiveState = 20 -- Sleep
                elseif currentActiveState == 3 then currentActiveState = 10 -- Away
            end
        local currentNextTime = jsonThermostatInfo.nextTime
        local currentNextSetPoint = tonumber(jsonThermostatInfo.nextSetpoint) / 100
        local currentBoiletSetPoint = jsonThermostatInfo.currentInternalBoilerSetpoint
        ----
       
        -- Update the thermostat sensor to current setpoint
        if domoticz.devices(ToonThermostatSensorName).setPoint*100 ~= currentSetpoint*100 then
            domoticz.log('Updating thermostat sensor to new set point: ' ..currentSetpoint)
            domoticz.devices(ToonThermostatSensorName).updateSetPoint(currentSetpoint).silent()
        end
       

        -- Update the temperature sensor to current room temperature
        if domoticz.round(domoticz.devices(ToonTemperatureSensorName).temperature, 1) ~= domoticz.round(currentTemperature, 1) then
            domoticz.log('Updating the temperature sensor to new value: ' ..currentTemperature)
            domoticz.devices(ToonTemperatureSensorName).updateTemperature(currentTemperature)
        end
       
        -- Update the toon scene selector sensor to current program state
        if domoticz.devices(ToonScenesSensorName).level ~= currentActiveState then  -- Update toon selector if it has changed
            domoticz.log('Updating Toon Scenes selector to: '..currentActiveState)
            domoticz.devices(ToonScenesSensorName).switchSelector(currentActiveState).silent()
        end
       
        -- Updates the toon auto program switch
        if domoticz.devices(ToonAutoProgramSensorName).level ~= currentProgramState then -- Update toon auto program selector if it has changed
            domoticz.log('Updating Toon Auto Program selector to: '..currentProgramState)
            domoticz.devices(ToonAutoProgramSensorName).switchSelector(currentProgramState).silent()
        end
       
        -- Updates the toon program information text box
        if currentNextTime == 0 or currentNextSetPoint == 0 then
            ToonProgramInformationSensorValue = 'Op ' ..currentSetpoint.. '°'
        else
            ToonProgramInformationSensorValue = 'Om ' ..os.date('%H:%M', currentNextTime).. ' op ' ..currentNextSetPoint.. '°'
        end
       
        if domoticz.devices(ToonProgramInformationSensorName).text ~= ToonProgramInformationSensorValue then
            domoticz.log('Updating Toon Program Information to: '..ToonProgramInformationSensorValue)
            domoticz.devices(ToonProgramInformationSensorName).updateText(ToonProgramInformationSensorValue)
        end
   end
}



Ik heb wel een Dummy aangemaakt, die als thermostaat dient nu, waar je dus ook de temp hoger en lager kan instellen..
mAiden
Starting Member
Starting Member
 
Posts: 44
Joined: July 2017

Re: Toon met Domoticz: IDX 0 not found!

Postby Clinthighway » Tue Aug 14, 2018 6:30 pm

@ mAiden.

Top :)

Scenes en de thermostaat werkt zo als het moet :)
En de error log blijft leeg :)

Alleen wilt de "ToonTemperature" niet meer update pfff.
Lijkt wel als de thermostaat werkt dan de temperatuur niet en anders om pfff
Clinthighway
Starting Member
Starting Member
 
Posts: 7
Joined: August 2018

Re: Toon met Domoticz: IDX 0 not found!

Postby mAiden » Tue Aug 14, 2018 8:33 pm

Clinthighway wrote:@ mAiden.

Top :)

Scenes en de thermostaat werkt zo als het moet :)
En de error log blijft leeg :)

Alleen wilt de "ToonTemperature" niet meer update pfff.
Lijkt wel als de thermostaat werkt dan de temperatuur niet en anders om pfff


Komt goed. Heb morgen dagje vrij van werk, zal er dan is volledig in duiken.
mAiden
Starting Member
Starting Member
 
Posts: 44
Joined: July 2017

Re: Toon met Domoticz: IDX 0 not found!

Postby Clinthighway » Tue Aug 14, 2018 9:50 pm

Top dat zou helemaal super zijn :D,

Duizendmaal thanks.

off-topic vraagje.

Is het trouwens lastig om de Stroom / Gas status door te linken naar Domoticz ?
En weet jij toevallig waarom met de eerste LUA scripts de Boilerstatus niet werkte ?
Komt dat omdat ik met Toon geen ketelprofiel ingesteld krijgt ?
Clinthighway
Starting Member
Starting Member
 
Posts: 7
Joined: August 2018


Return to Toon issues and support (Nederlands toegestaan)

Who is online

Users browsing this forum: No registered users and 0 guests