Page 1 of 1

phyton script in Events only runs once

Posted: Wednesday 30 May 2018 16:04
by Aurelio
Hi all,

i'm currently setting up a new environment for playing around with domoticz on Rpi 3B+ and some analog output-phidgets to control some led-dimmers.
(Later on, i will try to make a plugin for it, maybe for several phidgets)
I used the noobs installer that was provided with the kit. Install of Domoticz was OK. I can run my script in the Python interpreter. I can run it several times after eachother. I placed my script in a python-event in domoticz that is triggered by a switch. When i press the switch, the script runs just fine. But when i press the switch again, the script does not run anymore.

I've installed python3.4, but Domoticz keeps on starting with Python3.5, even when i've set the alternatives correctly.
I can't see why the script is running ok for 1 time.
Help will be much appriciated

Below the script:

Code: Select all

import sys
import time 
from Phidget22.Devices.VoltageOutput import *
from Phidget22.PhidgetException import *
from Phidget22.Phidget import *
from Phidget22.Net import *

try:
    ch = VoltageOutput()
except RuntimeError as e:
    print("Runtime Exception %s" % e.details)
    print("Press Enter to Exit...\n")
    readin = sys.stdin.read(1)
    exit(1)

def VoltageOutputAttached(self):
    try:
        attached = self
        print("\nAttach Event Detected (Information Below)")
        print("===========================================")
        print("Library Version: %s" % attached.getLibraryVersion())
        print("Serial Number: %d" % attached.getDeviceSerialNumber())
        print("Channel: %d" % attached.getChannel())
        print("Channel Class: %s" % attached.getChannelClass())
        print("Channel Name: %s" % attached.getChannelName())
        print("Device ID: %d" % attached.getDeviceID())
        print("Device Version: %d" % attached.getDeviceVersion())
        print("Device Name: %s" % attached.getDeviceName())
        print("Device Class: %d" % attached.getDeviceClass())
        print("\n")

    except PhidgetException as e:
        print("Phidget Exception %i: %s" % (e.code, e.details))
        print("Press Enter to Exit...\n")
        readin = sys.stdin.read(1)
        exit(1)   
    
def VoltageOutputDetached(self):
    detached = self
    try:
        print("\nDetach event on Port %d Channel %d" % (detached.getHubPort(), detached.getChannel()))
    except PhidgetException as e:
        print("Phidget Exception %i: %s" % (e.code, e.details))
        print("Press Enter to Exit...\n")
        readin = sys.stdin.read(1)
        exit(1)   

def ErrorEvent(self, eCode, description):
    print("Error %i : %s" % (eCode, description))

try:
    ch.setOnAttachHandler(VoltageOutputAttached)
    ch.setOnDetachHandler(VoltageOutputDetached)
    ch.setOnErrorHandler(ErrorEvent)

    # Please review the Phidget22 channel matching documentation for details on the device
    # and class architecture of Phidget22, and how channels are matched to device features.

    # Specifies the serial number of the device to attach to.
    # For VINT devices, this is the hub serial number.
    #
    # The default is any device.
    #
    # ch.setDeviceSerialNumber(<YOUR DEVICE SERIAL NUMBER>) 

    # For VINT devices, this specifies the port the VINT device must be plugged into.
    #
    # The default is any port.
    #
    # ch.setHubPort(0)

    # Specifies which channel to attach to.  It is important that the channel of
    # the device is the same class as the channel that is being opened.
    #
    # The default is any channel.
    #
    # ch.setChannel(0)

    # In order to attach to a network Phidget, the program must connect to a Phidget22 Network Server.
    # In a normal environment this can be done automatically by enabling server discovery, which
    # will cause the client to discovery and connect to available servers.
    #
    # To force the channel to only match a network Phidget, set remote to 1.
    #
    # Net.enableServerDiscovery(PhidgetServerType.PHIDGETSERVER_DEVICEREMOTE);
    # ch.setIsRemote(1)

    print("Waiting for the Phidget VoltageOutput Object to be attached...")
    ch.openWaitForAttachment(5000)
except PhidgetException as e:
    print("Phidget Exception %i: %s" % (e.code, e.details))
    print("Press Enter to Exit...\n")
    readin = sys.stdin.read(1)
    exit(1)

if(ch.getDeviceID() == DeviceID.PHIDID_1002):
    ch.setVoltage(0)
    ch.setEnabled(1)

print("Setting Voltage to 4 for 5 seconds...\n")
ch.setVoltage(4)
time.sleep(5)

print("Setting Voltage to 1.5 for 5 seconds...\n")
ch.setVoltage(1.5)
time.sleep(5)

print("Setting Voltage to 0 for 5 seconds...\n")
ch.setVoltage(0)
time.sleep(5)

try:
    ch.close()
except PhidgetException as e:
    print("Phidget Exception %i: %s" % (e.code, e.details))
    print("Press Enter to Exit...\n")
    readin = sys.stdin.read(1)
    exit(1) 
print("Closed VoltageOutput device")
Aurelio

Re: phyton script in Events only runs once

Posted: Wednesday 30 May 2018 17:05
by moroen
Could you provide the relevant sections of the domoticz log?

How is this script triggered? Using script_device-*.py in scripts/python or triggered from on action for the switch?

Regards,
M

Re: phyton script in Events only runs once

Posted: Thursday 31 May 2018 11:35
by Aurelio
Hi Moroen,

i've tried both options, with on command and with script_device. Both with same results. The script only runs one time.
I've enebled the full logging.

Here's the log.
I've set the switch to on @11:08:55.058 and the script ran. then i've activated the switch again @11:10:03.471 and nothing happend. Then i've stopped the service.

Code: Select all

2018-05-31 11:08:27.396  RxQueue: queue worker started...
2018-05-31 11:08:29.397  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SecStatus')
2018-05-31 11:08:29.397  SQLR result: 0;;
2018-05-31 11:08:29.398  EventSystem: reset all events...
2018-05-31 11:08:29.398  SQLQ query : SELECT EventRules.ID, EventMaster.Name, EventRules.Conditions, EventRules.Actions, EventMaster.Status, EventRules.SequenceNo, EventMaster.Interpreter, EventMaster.Type FROM EventRules INNER JOIN EventMaster ON EventRules.EMID = EventMaster.ID ORDER BY EventRules.ID
2018-05-31 11:08:29.399  SQLQ query : SELECT ID, Name, Interpreter, Type, Status, XMLStatement FROM EventMaster WHERE Interpreter <> 'Blockly' AND Status > 0 ORDER BY ID
2018-05-31 11:08:29.399  SQLR result: 1;phidget;Python;Device;1;import sys
sys.path.append('/usr/local/lib/python3.4/dist-packages')
import time 
from Phidget22.Devices.VoltageOutput import *
from Phidget22.PhidgetException import *
from Phidget22.Phidget import *
from Phidget22.Net import *

try:
    ch = VoltageOutput()
except RuntimeError as e:
    print("Runtime Exception %s" % e.details)
    print("Press Enter to Exit...\n")
    readin = sys.stdin.read(1)
    exit(1)

def VoltageOutputAttached(self):
    try:
        attached = self
        print("\nAttach Event Detected (Information Below)")
        print("===========================================")
        print("Library Version: %s" % attached.getLibraryVersion())
        print("Serial Number: %d" % attached.getDeviceSerialNumber())
        print("Channel: %d" % attached.getChannel())
        print("Channel Class: %s" % attached.getChannelClass())
        print("Channel Name: %s" % attached.getChannelName())
        print("Device ID: %d" % attached.getDeviceID())
        print("Device Version: %d" % attached.getDeviceVersion())
        print("Device Name: %s" % attached.getDeviceName())
        print("Device Class: %d" % attached.getDeviceClass())
        print("\n")

    except PhidgetException as e:
        print("Phidget Exception %i: %s" % (e.code, e.details))
        print("Press Enter to Exit...\n")
        readin = sys.stdin.read(1)
        exit(1)   
    
def VoltageOutputDetached(self):
    detached = self
    try:
        print("\nDetach event on Port %d Channel %d" % (detached.getHubPort(), detached.getChannel()))
    except PhidgetException as e:
        print("Phidget Exception %i: %s" % (e.code, e.details))
        print("Press Enter to Exit...\n")
        readin = sys.stdin.read(1)
        exit(1)   

def ErrorEvent(self, eCode, description):
    print("Error %i : %s" % (eCode, description))

try:
    ch.setOnAttachHandler(VoltageOutputAttached)
    ch.setOnDetachHandler(VoltageOutputDetached)
    ch.setOnErrorHandler(ErrorEvent)

    # Please review the Phidget22 channel matching documentation for details on the device
    # and class architecture of Phidget22, and how channels are matched to device features.

    # Specifies the serial number of the device to attach to.
    # For VINT devices, this is the hub serial number.
    #
    # The default is any device.
    #
    # ch.setDeviceSerialNumber(<YOUR DEVICE SERIAL NUMBER>) 

    # For VINT devices, this specifies the port the VINT device must be plugged into.
    #
    # The default is any port.
    #
    # ch.setHubPort(0)

    # Specifies which channel to attach to.  It is important that the channel of
    # the device is the same class as the channel that is being opened.
    #
    # The default is any channel.
    #
    # ch.setChannel(0)

    # In order to attach to a network Phidget, the program must connect to a Phidget22 Network Server.
    # In a normal environment this can be done automatically by enabling server discovery, which
    # will cause the client to discovery and connect to available servers.
    #
    # To force the channel to only match a network Phidget, set remote to 1.
    #
    Net.enableServerDiscovery(PhidgetServerType.PHIDGETSERVER_DEVICEREMOTE);
    # ch.setIsRemote(1)

    print("Waiting for the Phidget VoltageOutput Object to be attached...")
    ch.openWaitForAttachment(5000)
except PhidgetException as e:
    print("Phidget Exception %i: %s" % (e.code, e.details))
    print("Press Enter to Exit...\n")
    readin = sys.stdin.read(1)
    exit(1)

if(ch.getDeviceID() == DeviceID.PHIDID_1002):
    ch.setVoltage(0)
    ch.setEnabled(1)

print("Setting Voltage to 4 for 5 seconds...\n")
ch.setVoltage(4)
time.sleep(5)

print("Setting Voltage to 1.5 for 5 seconds...\n")
ch.setVoltage(1.5)
time.sleep(5)

print("Setting Voltage to 0 for 5 seconds...\n")
ch.setVoltage(0)
time.sleep(5)

try:
    ch.close()
except PhidgetException as e:
    print("Phidget Exception %i: %s" % (e.code, e.details))
    print("Press Enter to Exit...\n")
    readin = sys.stdin.read(1)
    exit(1) 
print("Closed VoltageOutput device");
2018-05-31 11:08:29.399  EventSystem: reset all device statuses...
2018-05-31 11:08:29.400  SQLQ query : SELECT A.HardwareID, A.ID, A.Name, A.nValue, A.sValue, A.Type, A.SubType, A.SwitchType, A.LastUpdate, A.LastLevel, A.Options, A.Description, A.BatteryLevel, A.SignalLevel, A.Unit, A.DeviceID FROM DeviceStatus AS A, Hardware AS B WHERE (A.Used = '1') AND (B.ID == A.HardwareID) AND (B.Enabled == 1)
2018-05-31 11:08:29.400  SQLR result: 2;1;TestSwitch;0;0;244;73;0;2018-05-31 10:58:02;0;;;255;12;1;00014051;
2018-05-31 11:08:29.400  RFXN : GetLightStatus Typ:244 STyp:73 nVal:0 sVal:0    llvl: 0 isDim:1 maxDim:100 GrpCmd:1 lstat:Off
2018-05-31 11:08:29.401  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:08:29.401  SQLR result: 60;;
2018-05-31 11:08:29.401  SQLQ query : SELECT ID, Name, Enabled, Type, Mode1, Mode2 FROM Hardware
2018-05-31 11:08:29.401  SQLR result: 1;Domoticz Internal;1;67;0;0;
2018-05-31 11:08:29.401  SQLR result: 2;Dummy;1;15;0;0;
2018-05-31 11:08:29.402  SQLQ query : SELECT A.ID, A.DeviceID, A.Unit, A.Name, A.Used, A.Type, A.SubType, A.SignalLevel, A.BatteryLevel, A.nValue, A.sValue, A.LastUpdate, A.Favorite, A.SwitchType, A.HardwareID, A.AddjValue, A.AddjMulti, A.AddjValue2, A.AddjMulti2, A.LastLevel, A.CustomImage, A.StrParam1, A.StrParam2, A.Protected, IFNULL(B.XOffset,0), IFNULL(B.YOffset,0), IFNULL(B.PlanID,0), A.Description, A.Options, A.Color FROM DeviceStatus A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) WHERE (A.ID=='1')
2018-05-31 11:08:29.402  SQLR result: 1;00014051;1;TestSwitch;1;244;73;12;255;0;0;2018-05-31 10:58:02;1;0;2;0.0;1.0;0.0;1.0;0;0;;;0;0;0;0;;;;
2018-05-31 11:08:29.403  SQLQ query : SELECT COUNT(*) FROM Timers WHERE (DeviceRowID==1) AND (TimerPlan==0)
2018-05-31 11:08:29.403  SQLR result: 0;
2018-05-31 11:08:29.403  SQLQ query : SELECT COUNT(*) FROM SetpointTimers WHERE (DeviceRowID==1) AND (TimerPlan==0)
2018-05-31 11:08:29.403  SQLR result: 0;
2018-05-31 11:08:29.403  RFXN : GetLightStatus Typ:244 STyp:73 nVal:0 sVal:0    llvl: 0 isDim:1 maxDim:100 GrpCmd:1 lstat:Off
2018-05-31 11:08:29.404  SQLQ query : SELECT ID FROM LightSubDevices WHERE (DeviceRowID=='1')
2018-05-31 11:08:29.404  SQLQ query : SELECT ID, Name, nValue, SceneType, LastUpdate FROM Scenes
2018-05-31 11:08:29.405  SQLQ query : SELECT ID,Name,Value, ValueType, LastUpdate FROM UserVariables
2018-05-31 11:08:29.537  Python EventSystem: Initalizing event module.
2018-05-31 11:08:29.537  EventSystem: Queue thread started...
2018-05-31 11:08:29.537  EventSystem: Started
2018-05-31 11:08:29.739  PluginSystem: Entering work loop.
2018-05-31 11:08:30.423  WEBH : Host:127.0.0.1 Uri;/json.htm?type=devices&filter=all&used=true&favorite=1&order=[Order]&plan=0&lastupdate=1527757083
2018-05-31 11:08:30.424  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='HideDisabledHardwareSensors')
2018-05-31 11:08:30.424  SQLR result: 1;;
2018-05-31 11:08:30.424  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:08:30.424  SQLR result: 60;;
2018-05-31 11:08:30.425  SQLQ query : SELECT ID, Name, Enabled, Type, Mode1, Mode2 FROM Hardware
2018-05-31 11:08:30.425  SQLR result: 1;Domoticz Internal;1;67;0;0;
2018-05-31 11:08:30.425  SQLR result: 2;Dummy;1;15;0;0;
2018-05-31 11:08:30.425  SQLQ query : SELECT A.ID, A.Name, A.nValue, A.LastUpdate, A.Favorite, A.SceneType, A.Protected, B.XOffset, B.YOffset, B.PlanID, A.Description FROM Scenes as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==1) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:08:30.426  SQLQ query : SELECT ID FROM Plans WHERE (Name=='$Hidden Devices')
2018-05-31 11:08:30.426  SQLR result: 1;
2018-05-31 11:08:30.426  SQLQ query : SELECT DeviceRowID FROM DeviceToPlansMap WHERE (PlanID=='1') AND (DevSceneType==0)
2018-05-31 11:08:30.427  SQLQ query : SELECT A.ID, A.DeviceID, A.Unit, A.Name, A.Used,A.Type, A.SubType, A.SignalLevel, A.BatteryLevel, A.nValue, A.sValue, A.LastUpdate, A.Favorite, A.SwitchType, A.HardwareID, A.AddjValue, A.AddjMulti, A.AddjValue2, A.AddjMulti2, A.LastLevel, A.CustomImage, A.StrParam1, A.StrParam2, A.Protected, IFNULL(B.XOffset,0), IFNULL(B.YOffset,0), IFNULL(B.PlanID,0), A.Description, A.Options, A.Color FROM DeviceStatus as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==0) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:08:30.427  SQLR result: 1;00014051;1;TestSwitch;1;244;73;12;255;0;0;2018-05-31 10:58:02;1;0;2;0.0;1.0;0.0;1.0;0;0;;;0;0;0;0;;;;
2018-05-31 11:08:30.428  Incoming connection from: 127.0.0.1
2018-05-31 11:08:30.429  SQLQ query : SELECT SessionID, Username, AuthToken, ExpirationDate FROM UserSessions WHERE SessionID = '204115dc7ef673d240d4a659ece807ab'
2018-05-31 11:08:30.430  SQLQ query : INSERT INTO UserSessions (SessionID, Username, AuthToken, ExpirationDate, RemoteHost) VALUES ('204115dc7ef673d240d4a659ece807ab', '', '30d62c253bf83345542bf5fcbda47959', '2018-05-31 11:18:30', '127.0.0.1')
2018-05-31 11:08:39.397  WEBH : Host:127.0.0.1 Uri;/html5.appcache
2018-05-31 11:08:39.399  SQLQ query : SELECT sValue FROM Preferences WHERE (Key='WebTheme')
2018-05-31 11:08:39.399  SQLR result: default;
2018-05-31 11:08:39.446  SQLQ query : SELECT ID FROM Floorplans ORDER BY [Order]
2018-05-31 11:08:42.160  WEBH : Host:127.0.0.1 Uri;/json.htm?type=command&param=getconfig
2018-05-31 11:08:42.160  WEBS GetJSon :getconfig :/json.htm?type=command&param=getconfig 
2018-05-31 11:08:42.161  SQLQ query : SELECT sValue FROM Preferences WHERE (Key='Language')
2018-05-31 11:08:42.161  SQLR result: en;
2018-05-31 11:08:42.161  SQLQ query : SELECT sValue FROM Preferences WHERE (Key='DegreeDaysBaseTemperature')
2018-05-31 11:08:42.161  SQLR result: 18.0;
2018-05-31 11:08:42.161  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='DashboardType')
2018-05-31 11:08:42.161  SQLR result: 0;;
2018-05-31 11:08:42.161  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='MobileType')
2018-05-31 11:08:42.161  SQLR result: 0;;
2018-05-31 11:08:42.161  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='5MinuteHistoryDays')
2018-05-31 11:08:42.161  SQLR result: 1;;
2018-05-31 11:08:42.162  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='ShowUpdateEffect')
2018-05-31 11:08:42.162  SQLR result: 0;;
2018-05-31 11:08:42.162  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='Location')
2018-05-31 11:08:42.162  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='EnableTabFloorplans')
2018-05-31 11:08:42.162  SQLR result: 0;;
2018-05-31 11:08:42.162  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='EnableTabLights')
2018-05-31 11:08:42.162  SQLR result: 1;;
2018-05-31 11:08:42.162  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='EnableTabScenes')
2018-05-31 11:08:42.162  SQLR result: 1;;
2018-05-31 11:08:42.162  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='EnableTabTemp')
2018-05-31 11:08:42.162  SQLR result: 1;;
2018-05-31 11:08:42.163  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='EnableTabWeather')
2018-05-31 11:08:42.163  SQLR result: 1;;
2018-05-31 11:08:42.163  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='EnableTabUtility')
2018-05-31 11:08:42.163  SQLR result: 1;;
2018-05-31 11:08:42.163  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='EnableTabCustom')
2018-05-31 11:08:42.163  SQLR result: 1;;
2018-05-31 11:08:42.246  WEBH : Host:127.0.0.1 Uri;/json.htm?type=command&param=getversion
2018-05-31 11:08:42.246  WEBS GetJSon :getversion :/json.htm?type=command&param=getversion 
2018-05-31 11:08:42.246  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='UseAutoUpdate')
2018-05-31 11:08:42.246  SQLR result: 1;;
2018-05-31 11:08:42.247  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='ReleaseChannel')
2018-05-31 11:08:42.247  SQLR result: 0;;
2018-05-31 11:08:42.573  WEBH : Host:127.0.0.1 Uri;/json.htm?type=command&param=getauth
2018-05-31 11:08:42.573  WEBS GetJSon :getauth :/json.htm?type=command&param=getauth 
2018-05-31 11:08:43.407  WEBH : Host:127.0.0.1 Uri;/json.htm?type=plans
2018-05-31 11:08:43.407  SQLQ query : SELECT ID, Name, [Order] FROM Plans ORDER BY [Order]
2018-05-31 11:08:43.407  SQLR result: 1;$Hidden Devices;1;
2018-05-31 11:08:43.421  WEBH : Host:127.0.0.1 Uri;/json.htm?type=devices&filter=all&used=true&favorite=1&order=[Order]&plan=0
2018-05-31 11:08:43.421  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='HideDisabledHardwareSensors')
2018-05-31 11:08:43.421  SQLR result: 1;;
2018-05-31 11:08:43.421  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:08:43.421  SQLR result: 60;;
2018-05-31 11:08:43.421  SQLQ query : SELECT ID, Name, Enabled, Type, Mode1, Mode2 FROM Hardware
2018-05-31 11:08:43.421  SQLR result: 1;Domoticz Internal;1;67;0;0;
2018-05-31 11:08:43.421  SQLR result: 2;Dummy;1;15;0;0;
2018-05-31 11:08:43.422  SQLQ query : SELECT A.ID, A.Name, A.nValue, A.LastUpdate, A.Favorite, A.SceneType, A.Protected, B.XOffset, B.YOffset, B.PlanID, A.Description FROM Scenes as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==1) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:08:43.422  SQLQ query : SELECT ID FROM Plans WHERE (Name=='$Hidden Devices')
2018-05-31 11:08:43.422  SQLR result: 1;
2018-05-31 11:08:43.422  SQLQ query : SELECT DeviceRowID FROM DeviceToPlansMap WHERE (PlanID=='1') AND (DevSceneType==0)
2018-05-31 11:08:43.422  SQLQ query : SELECT A.ID, A.DeviceID, A.Unit, A.Name, A.Used,A.Type, A.SubType, A.SignalLevel, A.BatteryLevel, A.nValue, A.sValue, A.LastUpdate, A.Favorite, A.SwitchType, A.HardwareID, A.AddjValue, A.AddjMulti, A.AddjValue2, A.AddjMulti2, A.LastLevel, A.CustomImage, A.StrParam1, A.StrParam2, A.Protected, IFNULL(B.XOffset,0), IFNULL(B.YOffset,0), IFNULL(B.PlanID,0), A.Description, A.Options, A.Color FROM DeviceStatus as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==0) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:08:43.422  SQLR result: 1;00014051;1;TestSwitch;1;244;73;12;255;0;0;2018-05-31 10:58:02;1;0;2;0.0;1.0;0.0;1.0;0;0;;;0;0;0;0;;;;
2018-05-31 11:08:43.423  SQLQ query : SELECT COUNT(*) FROM Timers WHERE (DeviceRowID==1) AND (TimerPlan==0)
2018-05-31 11:08:43.423  SQLR result: 0;
2018-05-31 11:08:43.423  SQLQ query : SELECT COUNT(*) FROM SetpointTimers WHERE (DeviceRowID==1) AND (TimerPlan==0)
2018-05-31 11:08:43.423  SQLR result: 0;
2018-05-31 11:08:43.423  RFXN : GetLightStatus Typ:244 STyp:73 nVal:0 sVal:0    llvl: 0 isDim:1 maxDim:100 GrpCmd:1 lstat:Off
2018-05-31 11:08:43.423  SQLQ query : SELECT ID FROM LightSubDevices WHERE (DeviceRowID=='1')
2018-05-31 11:08:43.522  WEBH : Host:127.0.0.1 Uri;/json.htm?type=command&param=getSunRiseSet
2018-05-31 11:08:43.522  WEBS GetJSon :getSunRiseSet :/json.htm?type=command&param=getSunRiseSet 
2018-05-31 11:08:53.558  WEBH : Host:127.0.0.1 Uri;/json.htm?type=devices&filter=all&used=true&favorite=1&order=[Order]&plan=0&lastupdate=1527757723
2018-05-31 11:08:53.559  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='HideDisabledHardwareSensors')
2018-05-31 11:08:53.560  SQLR result: 1;;
2018-05-31 11:08:53.560  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:08:53.560  SQLR result: 60;;
2018-05-31 11:08:53.561  SQLQ query : SELECT ID, Name, Enabled, Type, Mode1, Mode2 FROM Hardware
2018-05-31 11:08:53.561  SQLR result: 1;Domoticz Internal;1;67;0;0;
2018-05-31 11:08:53.561  SQLR result: 2;Dummy;1;15;0;0;
2018-05-31 11:08:53.562  SQLQ query : SELECT A.ID, A.Name, A.nValue, A.LastUpdate, A.Favorite, A.SceneType, A.Protected, B.XOffset, B.YOffset, B.PlanID, A.Description FROM Scenes as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==1) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:08:53.562  SQLQ query : SELECT ID FROM Plans WHERE (Name=='$Hidden Devices')
2018-05-31 11:08:53.562  SQLR result: 1;
2018-05-31 11:08:53.562  SQLQ query : SELECT DeviceRowID FROM DeviceToPlansMap WHERE (PlanID=='1') AND (DevSceneType==0)
2018-05-31 11:08:53.563  SQLQ query : SELECT A.ID, A.DeviceID, A.Unit, A.Name, A.Used,A.Type, A.SubType, A.SignalLevel, A.BatteryLevel, A.nValue, A.sValue, A.LastUpdate, A.Favorite, A.SwitchType, A.HardwareID, A.AddjValue, A.AddjMulti, A.AddjValue2, A.AddjMulti2, A.LastLevel, A.CustomImage, A.StrParam1, A.StrParam2, A.Protected, IFNULL(B.XOffset,0), IFNULL(B.YOffset,0), IFNULL(B.PlanID,0), A.Description, A.Options, A.Color FROM DeviceStatus as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==0) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:08:53.564  SQLR result: 1;00014051;1;TestSwitch;1;244;73;12;255;0;0;2018-05-31 10:58:02;1;0;2;0.0;1.0;0.0;1.0;0;0;;;0;0;0;0;;;;
2018-05-31 11:08:55.058  WEBH : Host:127.0.0.1 Uri;/json.htm?type=command&param=switchlight&idx=1&switchcmd=On&level=0&passcode=
2018-05-31 11:08:55.058  WEBS GetJSon :switchlight :/json.htm?type=command&param=switchlight&idx=1&switchcmd=On&level=0&passcode= 
2018-05-31 11:08:55.058  WEBS switchlight idx:1 switchcmd:On level:-1
2018-05-31 11:08:55.058  SQLQ query : SELECT [Protected],[Name] FROM DeviceStatus WHERE (ID = '1')
2018-05-31 11:08:55.058  SQLR result: 0;TestSwitch;
2018-05-31 11:08:55.058  User: Admin initiated a switch command (1/TestSwitch/On)
2018-05-31 11:08:55.058  MAIN SwitchLight idx:1 cmd:On lvl:-1 
2018-05-31 11:08:55.058  SQLQ query : SELECT HardwareID,DeviceID,Unit,Type,SubType,SwitchType,AddjValue2,nValue,sValue,Name,Options FROM DeviceStatus WHERE (ID == 1)
2018-05-31 11:08:55.058  SQLR result: 2;00014051;1;244;73;0;0.0;0;0;TestSwitch;;
2018-05-31 11:08:55.058  MAIN SwitchLightInt : switchcmd:On level:-1 HWid:2  sd:2 00014051 1 244 73 0
2018-05-31 11:08:55.059  SQLQ query : SELECT LastLevel FROM DeviceStatus WHERE (HardwareID=2 AND DeviceID='00014051' AND Unit=1 AND Type=244 AND SubType=73)
2018-05-31 11:08:55.059  SQLR result: 0;
2018-05-31 11:08:55.059  MAIN SwitchLightInt : switchcmd=="On" || level < 0, new level:0
2018-05-31 11:08:55.059  MAIN ProcessRX Msg 1BF44900514001000100000001000CFF000000000000000000000000
2018-05-31 11:08:55.059  SQLQ query : SELECT ID,Name, Used, SwitchType, nValue, sValue, LastUpdate, Options FROM DeviceStatus WHERE (HardwareID=2 AND DeviceID='00014051' AND Unit=1 AND Type=244 AND SubType=73)
2018-05-31 11:08:55.059  SQLR result: 1;TestSwitch;1;0;0;0;2018-05-31 10:58:02;;
2018-05-31 11:08:55.059  SQLQ query : UPDATE DeviceStatus SET SignalLevel=12, BatteryLevel=255, nValue=1, sValue='0', LastUpdate='2018-05-31 11:08:55' WHERE (ID = 1)
2018-05-31 11:08:55.060  SQLQ query : INSERT INTO LightingLog (DeviceRowID, nValue, sValue) VALUES ('1', '1', '0')
2018-05-31 11:08:55.060  SQLQ query : SELECT Name,SwitchType,AddjValue,StrParam1,StrParam2,Options,LastLevel FROM DeviceStatus WHERE (ID = 1)
2018-05-31 11:08:55.060  SQLR result: TestSwitch;0;0.0;;;;0;
2018-05-31 11:08:55.060  RFXN : GetLightStatus Typ:244 STyp:73 nVal:1 sVal:0    llvl: 0 isDim:1 maxDim:100 GrpCmd:1 lstat:On
2018-05-31 11:08:55.060  SQLH HandleOnOffAction: OnAction:
2018-05-31 11:08:55.060  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='EmailServer')
2018-05-31 11:08:55.060  SQLQ query : SELECT SceneRowID FROM SceneDevices WHERE (DeviceRowID == 1)
2018-05-31 11:08:55.060  SQLH UpdateValueInt TestSwitch HwID:2  DevID:00014051 Type:244  sType:73 nValue:1 sValue:0 
2018-05-31 11:08:55.060  SQLQ query : SELECT ID, SwitchType, LastUpdate, LastLevel, Options FROM DeviceStatus WHERE (Name == 'TestSwitch')
2018-05-31 11:08:55.061  SQLR result: 1;0;2018-05-31 11:08:55;0;;
2018-05-31 11:08:55.061  RFXN : GetLightStatus Typ:244 STyp:73 nVal:1 sVal:0    llvl: 0 isDim:1 maxDim:100 GrpCmd:1 lstat:On
2018-05-31 11:08:55.061  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:08:55.061  SQLR result: 60;;
2018-05-31 11:08:55.061  SQLQ query : SELECT ID, Name, Enabled, Type, Mode1, Mode2 FROM Hardware
2018-05-31 11:08:55.061  SQLR result: 1;Domoticz Internal;1;67;0;0;
2018-05-31 11:08:55.061  SQLR result: 2;Dummy;1;15;0;0;
2018-05-31 11:08:55.061  SQLQ query : SELECT A.ID, A.DeviceID, A.Unit, A.Name, A.Used, A.Type, A.SubType, A.SignalLevel, A.BatteryLevel, A.nValue, A.sValue, A.LastUpdate, A.Favorite, A.SwitchType, A.HardwareID, A.AddjValue, A.AddjMulti, A.AddjValue2, A.AddjMulti2, A.LastLevel, A.CustomImage, A.StrParam1, A.StrParam2, A.Protected, IFNULL(B.XOffset,0), IFNULL(B.YOffset,0), IFNULL(B.PlanID,0), A.Description, A.Options, A.Color FROM DeviceStatus A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) WHERE (A.ID=='1')
2018-05-31 11:08:55.061  SQLR result: 1;00014051;1;TestSwitch;1;244;73;12;255;1;0;2018-05-31 11:08:55;1;0;2;0.0;1.0;0.0;1.0;0;0;;;0;0;0;0;;;;
2018-05-31 11:08:55.062  SQLQ query : SELECT COUNT(*) FROM Timers WHERE (DeviceRowID==1) AND (TimerPlan==0)
2018-05-31 11:08:55.062  SQLR result: 0;
2018-05-31 11:08:55.062  SQLQ query : SELECT COUNT(*) FROM SetpointTimers WHERE (DeviceRowID==1) AND (TimerPlan==0)
2018-05-31 11:08:55.062  SQLR result: 0;
2018-05-31 11:08:55.062  RFXN : GetLightStatus Typ:244 STyp:73 nVal:1 sVal:0    llvl: 0 isDim:1 maxDim:100 GrpCmd:1 lstat:On
2018-05-31 11:08:55.062  SQLQ query : SELECT ID FROM LightSubDevices WHERE (DeviceRowID=='1')
2018-05-31 11:08:55.063  SQLQ query : SELECT ID FROM DeviceStatus WHERE (HardwareID=2 AND DeviceID='00014051' AND Unit=1 AND Type=244 AND SubType=73)
2018-05-31 11:08:55.063  SQLR result: 1;
2018-05-31 11:08:55.063  SQLQ query : SELECT A.ParentID, B.Name, B.HardwareID, B.[Type], B.[SubType], B.Unit FROM LightSubDevices as A, DeviceStatus as B WHERE (A.DeviceRowID=='1') AND (A.DeviceRowID!=A.ParentID) AND (B.[ID] == A.ParentID)
2018-05-31 11:08:55.063  SQLQ query : SELECT a.DeviceRowID, b.Type FROM LightSubDevices a, DeviceStatus b WHERE (a.ParentID=='1') AND (b.ID == a.DeviceRowID) AND (a.DeviceRowID!=a.ParentID)
2018-05-31 11:08:55.063  SQLQ query : SELECT ID, Activators, SceneType FROM Scenes WHERE (Activators!='')
2018-05-31 11:08:55.063  (Dummy) Light/Switch (TestSwitch)
2018-05-31 11:08:56.084  WEBH : Host:127.0.0.1 Uri;/json.htm?type=devices&filter=all&used=true&favorite=1&order=[Order]&plan=0&lastupdate=1527757723
2018-05-31 11:08:56.085  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='HideDisabledHardwareSensors')
2018-05-31 11:08:56.085  SQLR result: 1;;
2018-05-31 11:08:56.086  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:08:56.086  SQLR result: 60;;
2018-05-31 11:08:56.086  SQLQ query : SELECT ID, Name, Enabled, Type, Mode1, Mode2 FROM Hardware
2018-05-31 11:08:56.086  SQLR result: 1;Domoticz Internal;1;67;0;0;
2018-05-31 11:08:56.086  SQLR result: 2;Dummy;1;15;0;0;
2018-05-31 11:08:56.087  SQLQ query : SELECT A.ID, A.Name, A.nValue, A.LastUpdate, A.Favorite, A.SceneType, A.Protected, B.XOffset, B.YOffset, B.PlanID, A.Description FROM Scenes as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==1) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:08:56.087  SQLQ query : SELECT ID FROM Plans WHERE (Name=='$Hidden Devices')
2018-05-31 11:08:56.087  SQLR result: 1;
2018-05-31 11:08:56.088  SQLQ query : SELECT DeviceRowID FROM DeviceToPlansMap WHERE (PlanID=='1') AND (DevSceneType==0)
2018-05-31 11:08:56.089  SQLQ query : SELECT A.ID, A.DeviceID, A.Unit, A.Name, A.Used,A.Type, A.SubType, A.SignalLevel, A.BatteryLevel, A.nValue, A.sValue, A.LastUpdate, A.Favorite, A.SwitchType, A.HardwareID, A.AddjValue, A.AddjMulti, A.AddjValue2, A.AddjMulti2, A.LastLevel, A.CustomImage, A.StrParam1, A.StrParam2, A.Protected, IFNULL(B.XOffset,0), IFNULL(B.YOffset,0), IFNULL(B.PlanID,0), A.Description, A.Options, A.Color FROM DeviceStatus as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==0) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:08:56.089  SQLR result: 1;00014051;1;TestSwitch;1;244;73;12;255;1;0;2018-05-31 11:08:55;1;0;2;0.0;1.0;0.0;1.0;0;0;;;0;0;0;0;;;;
2018-05-31 11:08:56.090  SQLQ query : SELECT COUNT(*) FROM Timers WHERE (DeviceRowID==1) AND (TimerPlan==0)
2018-05-31 11:08:56.090  SQLR result: 0;
2018-05-31 11:08:56.090  SQLQ query : SELECT COUNT(*) FROM SetpointTimers WHERE (DeviceRowID==1) AND (TimerPlan==0)
2018-05-31 11:08:56.090  SQLR result: 0;
2018-05-31 11:08:56.090  RFXN : GetLightStatus Typ:244 STyp:73 nVal:1 sVal:0    llvl: 0 isDim:1 maxDim:100 GrpCmd:1 lstat:On
2018-05-31 11:08:56.091  SQLQ query : SELECT ID FROM LightSubDevices WHERE (DeviceRowID=='1')
2018-05-31 11:09:00.400  SQLQ query : SELECT ID FROM Timers WHERE (Type == 5 AND ((Date < '2018-05-31') OR (Date == '2018-05-31' AND Time < '11:09')))
2018-05-31 11:09:00.400  SQLQ query : SELECT ID FROM SceneTimers WHERE (Type == 5 AND ((Date < '2018-05-31') OR (Date == '2018-05-31' AND Time < '11:09')))
2018-05-31 11:09:06.173  WEBH : Host:127.0.0.1 Uri;/json.htm?type=devices&filter=all&used=true&favorite=1&order=[Order]&plan=0&lastupdate=1527757736
2018-05-31 11:09:06.174  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='HideDisabledHardwareSensors')
2018-05-31 11:09:06.174  SQLR result: 1;;
2018-05-31 11:09:06.174  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:09:06.174  SQLR result: 60;;
2018-05-31 11:09:06.174  SQLQ query : SELECT ID, Name, Enabled, Type, Mode1, Mode2 FROM Hardware
2018-05-31 11:09:06.174  SQLR result: 1;Domoticz Internal;1;67;0;0;
2018-05-31 11:09:06.175  SQLR result: 2;Dummy;1;15;0;0;
2018-05-31 11:09:06.175  SQLQ query : SELECT A.ID, A.Name, A.nValue, A.LastUpdate, A.Favorite, A.SceneType, A.Protected, B.XOffset, B.YOffset, B.PlanID, A.Description FROM Scenes as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==1) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:09:06.175  SQLQ query : SELECT ID FROM Plans WHERE (Name=='$Hidden Devices')
2018-05-31 11:09:06.176  SQLR result: 1;
2018-05-31 11:09:06.176  SQLQ query : SELECT DeviceRowID FROM DeviceToPlansMap WHERE (PlanID=='1') AND (DevSceneType==0)
2018-05-31 11:09:06.177  SQLQ query : SELECT A.ID, A.DeviceID, A.Unit, A.Name, A.Used,A.Type, A.SubType, A.SignalLevel, A.BatteryLevel, A.nValue, A.sValue, A.LastUpdate, A.Favorite, A.SwitchType, A.HardwareID, A.AddjValue, A.AddjMulti, A.AddjValue2, A.AddjMulti2, A.LastLevel, A.CustomImage, A.StrParam1, A.StrParam2, A.Protected, IFNULL(B.XOffset,0), IFNULL(B.YOffset,0), IFNULL(B.PlanID,0), A.Description, A.Options, A.Color FROM DeviceStatus as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==0) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:09:06.177  SQLR result: 1;00014051;1;TestSwitch;1;244;73;12;255;1;0;2018-05-31 11:08:55;1;0;2;0.0;1.0;0.0;1.0;0;0;;;0;0;0;0;;;;
2018-05-31 11:09:16.200  WEBH : Host:127.0.0.1 Uri;/json.htm?type=devices&filter=all&used=true&favorite=1&order=[Order]&plan=0&lastupdate=1527757736
2018-05-31 11:09:16.201  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='HideDisabledHardwareSensors')
2018-05-31 11:09:16.201  SQLR result: 1;;
2018-05-31 11:09:16.201  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:09:16.201  SQLR result: 60;;
2018-05-31 11:09:16.202  SQLQ query : SELECT ID, Name, Enabled, Type, Mode1, Mode2 FROM Hardware
2018-05-31 11:09:16.202  SQLR result: 1;Domoticz Internal;1;67;0;0;
2018-05-31 11:09:16.202  SQLR result: 2;Dummy;1;15;0;0;
2018-05-31 11:09:16.202  SQLQ query : SELECT A.ID, A.Name, A.nValue, A.LastUpdate, A.Favorite, A.SceneType, A.Protected, B.XOffset, B.YOffset, B.PlanID, A.Description FROM Scenes as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==1) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:09:16.202  SQLQ query : SELECT ID FROM Plans WHERE (Name=='$Hidden Devices')
2018-05-31 11:09:16.203  SQLR result: 1;
2018-05-31 11:09:16.203  SQLQ query : SELECT DeviceRowID FROM DeviceToPlansMap WHERE (PlanID=='1') AND (DevSceneType==0)
2018-05-31 11:09:16.204  SQLQ query : SELECT A.ID, A.DeviceID, A.Unit, A.Name, A.Used,A.Type, A.SubType, A.SignalLevel, A.BatteryLevel, A.nValue, A.sValue, A.LastUpdate, A.Favorite, A.SwitchType, A.HardwareID, A.AddjValue, A.AddjMulti, A.AddjValue2, A.AddjMulti2, A.LastLevel, A.CustomImage, A.StrParam1, A.StrParam2, A.Protected, IFNULL(B.XOffset,0), IFNULL(B.YOffset,0), IFNULL(B.PlanID,0), A.Description, A.Options, A.Color FROM DeviceStatus as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==0) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:09:16.204  SQLR result: 1;00014051;1;TestSwitch;1;244;73;12;255;1;0;2018-05-31 11:08:55;1;0;2;0.0;1.0;0.0;1.0;0;0;;;0;0;0;0;;;;
2018-05-31 11:09:26.229  WEBH : Host:127.0.0.1 Uri;/json.htm?type=devices&filter=all&used=true&favorite=1&order=[Order]&plan=0&lastupdate=1527757736
2018-05-31 11:09:26.230  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='HideDisabledHardwareSensors')
2018-05-31 11:09:26.230  SQLR result: 1;;
2018-05-31 11:09:26.230  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:09:26.230  SQLR result: 60;;
2018-05-31 11:09:26.231  SQLQ query : SELECT ID, Name, Enabled, Type, Mode1, Mode2 FROM Hardware
2018-05-31 11:09:26.231  SQLR result: 1;Domoticz Internal;1;67;0;0;
2018-05-31 11:09:26.231  SQLR result: 2;Dummy;1;15;0;0;
2018-05-31 11:09:26.232  SQLQ query : SELECT A.ID, A.Name, A.nValue, A.LastUpdate, A.Favorite, A.SceneType, A.Protected, B.XOffset, B.YOffset, B.PlanID, A.Description FROM Scenes as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==1) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:09:26.232  SQLQ query : SELECT ID FROM Plans WHERE (Name=='$Hidden Devices')
2018-05-31 11:09:26.232  SQLR result: 1;
2018-05-31 11:09:26.232  SQLQ query : SELECT DeviceRowID FROM DeviceToPlansMap WHERE (PlanID=='1') AND (DevSceneType==0)
2018-05-31 11:09:26.234  SQLQ query : SELECT A.ID, A.DeviceID, A.Unit, A.Name, A.Used,A.Type, A.SubType, A.SignalLevel, A.BatteryLevel, A.nValue, A.sValue, A.LastUpdate, A.Favorite, A.SwitchType, A.HardwareID, A.AddjValue, A.AddjMulti, A.AddjValue2, A.AddjMulti2, A.LastLevel, A.CustomImage, A.StrParam1, A.StrParam2, A.Protected, IFNULL(B.XOffset,0), IFNULL(B.YOffset,0), IFNULL(B.PlanID,0), A.Description, A.Options, A.Color FROM DeviceStatus as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==0) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:09:26.234  SQLR result: 1;00014051;1;TestSwitch;1;244;73;12;255;1;0;2018-05-31 11:08:55;1;0;2;0.0;1.0;0.0;1.0;0;0;;;0;0;0;0;;;;
2018-05-31 11:09:27.390  SQLQ query : DELETE FROM UserSessions WHERE ExpirationDate < datetime('now', 'localtime')
2018-05-31 11:09:27.394  SQLQ query : DELETE FROM UserSessions WHERE ExpirationDate < datetime('now', 'localtime')
2018-05-31 11:09:36.253  WEBH : Host:127.0.0.1 Uri;/json.htm?type=devices&filter=all&used=true&favorite=1&order=[Order]&plan=0&lastupdate=1527757736
2018-05-31 11:09:36.254  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='HideDisabledHardwareSensors')
2018-05-31 11:09:36.254  SQLR result: 1;;
2018-05-31 11:09:36.254  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:09:36.254  SQLR result: 60;;
2018-05-31 11:09:36.254  SQLQ query : SELECT ID, Name, Enabled, Type, Mode1, Mode2 FROM Hardware
2018-05-31 11:09:36.254  SQLR result: 1;Domoticz Internal;1;67;0;0;
2018-05-31 11:09:36.254  SQLR result: 2;Dummy;1;15;0;0;
2018-05-31 11:09:36.255  SQLQ query : SELECT A.ID, A.Name, A.nValue, A.LastUpdate, A.Favorite, A.SceneType, A.Protected, B.XOffset, B.YOffset, B.PlanID, A.Description FROM Scenes as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==1) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:09:36.255  SQLQ query : SELECT ID FROM Plans WHERE (Name=='$Hidden Devices')
2018-05-31 11:09:36.255  SQLR result: 1;
2018-05-31 11:09:36.255  SQLQ query : SELECT DeviceRowID FROM DeviceToPlansMap WHERE (PlanID=='1') AND (DevSceneType==0)
2018-05-31 11:09:36.256  SQLQ query : SELECT A.ID, A.DeviceID, A.Unit, A.Name, A.Used,A.Type, A.SubType, A.SignalLevel, A.BatteryLevel, A.nValue, A.sValue, A.LastUpdate, A.Favorite, A.SwitchType, A.HardwareID, A.AddjValue, A.AddjMulti, A.AddjValue2, A.AddjMulti2, A.LastLevel, A.CustomImage, A.StrParam1, A.StrParam2, A.Protected, IFNULL(B.XOffset,0), IFNULL(B.YOffset,0), IFNULL(B.PlanID,0), A.Description, A.Options, A.Color FROM DeviceStatus as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==0) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:09:36.256  SQLR result: 1;00014051;1;TestSwitch;1;244;73;12;255;1;0;2018-05-31 11:08:55;1;0;2;0.0;1.0;0.0;1.0;0;0;;;0;0;0;0;;;;
2018-05-31 11:09:46.283  WEBH : Host:127.0.0.1 Uri;/json.htm?type=devices&filter=all&used=true&favorite=1&order=[Order]&plan=0&lastupdate=1527757736
2018-05-31 11:09:46.284  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='HideDisabledHardwareSensors')
2018-05-31 11:09:46.284  SQLR result: 1;;
2018-05-31 11:09:46.285  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:09:46.285  SQLR result: 60;;
2018-05-31 11:09:46.285  SQLQ query : SELECT ID, Name, Enabled, Type, Mode1, Mode2 FROM Hardware
2018-05-31 11:09:46.285  SQLR result: 1;Domoticz Internal;1;67;0;0;
2018-05-31 11:09:46.285  SQLR result: 2;Dummy;1;15;0;0;
2018-05-31 11:09:46.286  SQLQ query : SELECT A.ID, A.Name, A.nValue, A.LastUpdate, A.Favorite, A.SceneType, A.Protected, B.XOffset, B.YOffset, B.PlanID, A.Description FROM Scenes as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==1) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:09:46.286  SQLQ query : SELECT ID FROM Plans WHERE (Name=='$Hidden Devices')
2018-05-31 11:09:46.286  SQLR result: 1;
2018-05-31 11:09:46.287  SQLQ query : SELECT DeviceRowID FROM DeviceToPlansMap WHERE (PlanID=='1') AND (DevSceneType==0)
2018-05-31 11:09:46.288  SQLQ query : SELECT A.ID, A.DeviceID, A.Unit, A.Name, A.Used,A.Type, A.SubType, A.SignalLevel, A.BatteryLevel, A.nValue, A.sValue, A.LastUpdate, A.Favorite, A.SwitchType, A.HardwareID, A.AddjValue, A.AddjMulti, A.AddjValue2, A.AddjMulti2, A.LastLevel, A.CustomImage, A.StrParam1, A.StrParam2, A.Protected, IFNULL(B.XOffset,0), IFNULL(B.YOffset,0), IFNULL(B.PlanID,0), A.Description, A.Options, A.Color FROM DeviceStatus as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==0) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:09:46.288  SQLR result: 1;00014051;1;TestSwitch;1;244;73;12;255;1;0;2018-05-31 11:08:55;1;0;2;0.0;1.0;0.0;1.0;0;0;;;0;0;0;0;;;;
2018-05-31 11:09:56.319  WEBH : Host:127.0.0.1 Uri;/json.htm?type=devices&filter=all&used=true&favorite=1&order=[Order]&plan=0&lastupdate=1527757736
2018-05-31 11:09:56.320  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='HideDisabledHardwareSensors')
2018-05-31 11:09:56.321  SQLR result: 1;;
2018-05-31 11:09:56.321  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:09:56.322  SQLR result: 60;;
2018-05-31 11:09:56.322  SQLQ query : SELECT ID, Name, Enabled, Type, Mode1, Mode2 FROM Hardware
2018-05-31 11:09:56.322  SQLR result: 1;Domoticz Internal;1;67;0;0;
2018-05-31 11:09:56.322  SQLR result: 2;Dummy;1;15;0;0;
2018-05-31 11:09:56.323  SQLQ query : SELECT A.ID, A.Name, A.nValue, A.LastUpdate, A.Favorite, A.SceneType, A.Protected, B.XOffset, B.YOffset, B.PlanID, A.Description FROM Scenes as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==1) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:09:56.324  SQLQ query : SELECT ID FROM Plans WHERE (Name=='$Hidden Devices')
2018-05-31 11:09:56.324  SQLR result: 1;
2018-05-31 11:09:56.325  SQLQ query : SELECT DeviceRowID FROM DeviceToPlansMap WHERE (PlanID=='1') AND (DevSceneType==0)
2018-05-31 11:09:56.326  SQLQ query : SELECT A.ID, A.DeviceID, A.Unit, A.Name, A.Used,A.Type, A.SubType, A.SignalLevel, A.BatteryLevel, A.nValue, A.sValue, A.LastUpdate, A.Favorite, A.SwitchType, A.HardwareID, A.AddjValue, A.AddjMulti, A.AddjValue2, A.AddjMulti2, A.LastLevel, A.CustomImage, A.StrParam1, A.StrParam2, A.Protected, IFNULL(B.XOffset,0), IFNULL(B.YOffset,0), IFNULL(B.PlanID,0), A.Description, A.Options, A.Color FROM DeviceStatus as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==0) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:09:56.326  SQLR result: 1;00014051;1;TestSwitch;1;244;73;12;255;1;0;2018-05-31 11:08:55;1;0;2;0.0;1.0;0.0;1.0;0;0;;;0;0;0;0;;;;
2018-05-31 11:10:00.407  SQLQ query : SELECT ID FROM Timers WHERE (Type == 5 AND ((Date < '2018-05-31') OR (Date == '2018-05-31' AND Time < '11:10')))
2018-05-31 11:10:00.407  SQLQ query : SELECT ID FROM SceneTimers WHERE (Type == 5 AND ((Date < '2018-05-31') OR (Date == '2018-05-31' AND Time < '11:10')))
2018-05-31 11:10:00.574  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:10:00.575  SQLR result: 60;;
2018-05-31 11:10:00.575  SQLQ query : SELECT ID,Type,SubType,nValue,sValue,LastUpdate FROM DeviceStatus WHERE (Type=80 OR Type=81 OR Type=82 OR Type=84 OR Type=247 OR Type=87 OR Type=86 OR Type=64 OR Type=112 OR Type=253 OR Type=70 OR Type=71 OR Type=72 OR (Type=243 AND SubType=5) OR (Type=242 AND SubType=1) OR (Type=243 AND SubType=26))
2018-05-31 11:10:00.576  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:10:00.576  SQLR result: 60;;
2018-05-31 11:10:00.576  SQLQ query : SELECT ID,Type,SubType,nValue,sValue,LastUpdate FROM DeviceStatus WHERE (Type=85)
2018-05-31 11:10:00.577  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:10:00.577  SQLR result: 60;;
2018-05-31 11:10:00.577  SQLQ query : SELECT ID,DeviceID, Type,SubType,nValue,sValue,LastUpdate FROM DeviceStatus WHERE (Type=86)
2018-05-31 11:10:00.577  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:10:00.577  SQLR result: 60;;
2018-05-31 11:10:00.578  SQLQ query : SELECT ID,Type,SubType,nValue,sValue,LastUpdate FROM DeviceStatus WHERE (Type=87) OR (Type=243 AND SubType=25)
2018-05-31 11:10:00.578  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:10:00.578  SQLR result: 60;;
2018-05-31 11:10:00.579  SQLQ query : SELECT ID,Name,HardwareID,DeviceID,Unit,Type,SubType,nValue,sValue,LastUpdate FROM DeviceStatus WHERE (Type=113 OR Type=251 OR Type=252 OR Type=90 OR Type=92 OR Type=249 OR Type=248 OR Type=246 OR Type=93 OR (Type=254 AND SubType=3) OR (Type=243 AND SubType=1) OR (Type=243 AND SubType=2) OR (Type=243 AND SubType=3) OR (Type=243 AND SubType=4) OR (Type=112 AND SubType=1) OR (Type=112 AND SubType=2) OR(Type=243 AND SubType=8) OR(Type=243 AND SubType=23) OR(Type=243 AND SubType=24) OR(Type=243 AND SubType=27) OR (Type=243 AND SubType=9) OR (Type=243 AND SubType=28) OR (Type=243 AND SubType=29))
2018-05-31 11:10:00.579  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:10:00.579  SQLR result: 60;;
2018-05-31 11:10:00.580  SQLQ query : SELECT ID,Type,SubType,nValue,sValue,LastUpdate FROM DeviceStatus WHERE (Type=250 OR Type=89 OR Type=91)
2018-05-31 11:10:00.580  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:10:00.580  SQLR result: 60;;
2018-05-31 11:10:00.581  SQLQ query : SELECT ID,Type,SubType,nValue,sValue,LastUpdate FROM DeviceStatus WHERE (Type=243 AND SubType=6) OR (Type=243 AND SubType=30) OR (Type=243 AND SubType=31)
2018-05-31 11:10:00.581  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:10:00.581  SQLR result: 60;;
2018-05-31 11:10:00.581  SQLQ query : SELECT ID,Type,SubType,nValue,sValue,LastUpdate FROM DeviceStatus WHERE (Type=243 AND SubType=7)
2018-05-31 11:10:00.582  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='5MinuteHistoryDays')
2018-05-31 11:10:00.582  SQLR result: 1;;
2018-05-31 11:10:00.582  SQLQ query : DELETE FROM Temperature WHERE strftime('%s',datetime('now','localtime')) - strftime('%s',Date) > (SELECT p.nValue * 86400 From Preferences AS p WHERE p.Key='5MinuteHistoryDays')
2018-05-31 11:10:00.583  SQLQ query : DELETE FROM Rain WHERE strftime('%s',datetime('now','localtime')) - strftime('%s',Date) > (SELECT p.nValue * 86400 From Preferences AS p WHERE p.Key='5MinuteHistoryDays')
2018-05-31 11:10:00.583  SQLQ query : DELETE FROM Wind WHERE strftime('%s',datetime('now','localtime')) - strftime('%s',Date) > (SELECT p.nValue * 86400 From Preferences AS p WHERE p.Key='5MinuteHistoryDays')
2018-05-31 11:10:00.584  SQLQ query : DELETE FROM UV WHERE strftime('%s',datetime('now','localtime')) - strftime('%s',Date) > (SELECT p.nValue * 86400 From Preferences AS p WHERE p.Key='5MinuteHistoryDays')
2018-05-31 11:10:00.584  SQLQ query : DELETE FROM Meter WHERE strftime('%s',datetime('now','localtime')) - strftime('%s',Date) > (SELECT p.nValue * 86400 From Preferences AS p WHERE p.Key='5MinuteHistoryDays')
2018-05-31 11:10:00.585  SQLQ query : DELETE FROM MultiMeter WHERE strftime('%s',datetime('now','localtime')) - strftime('%s',Date) > (SELECT p.nValue * 86400 From Preferences AS p WHERE p.Key='5MinuteHistoryDays')
2018-05-31 11:10:00.586  SQLQ query : DELETE FROM Percentage WHERE strftime('%s',datetime('now','localtime')) - strftime('%s',Date) > (SELECT p.nValue * 86400 From Preferences AS p WHERE p.Key='5MinuteHistoryDays')
2018-05-31 11:10:00.586  SQLQ query : DELETE FROM Fan WHERE strftime('%s',datetime('now','localtime')) - strftime('%s',Date) > (SELECT p.nValue * 86400 From Preferences AS p WHERE p.Key='5MinuteHistoryDays')
2018-05-31 11:10:03.470  WEBH : Host:127.0.0.1 Uri;/json.htm?type=command&param=switchlight&idx=1&switchcmd=Off&level=0&passcode=
2018-05-31 11:10:03.470  WEBS GetJSon :switchlight :/json.htm?type=command&param=switchlight&idx=1&switchcmd=Off&level=0&passcode= 
2018-05-31 11:10:03.471  WEBS switchlight idx:1 switchcmd:Off level:-1
2018-05-31 11:10:03.471  SQLQ query : SELECT [Protected],[Name] FROM DeviceStatus WHERE (ID = '1')
2018-05-31 11:10:03.471  SQLR result: 0;TestSwitch;
2018-05-31 11:10:03.471  User: Admin initiated a switch command (1/TestSwitch/Off)
2018-05-31 11:10:03.471  MAIN SwitchLight idx:1 cmd:Off lvl:-1 
2018-05-31 11:10:03.472  SQLQ query : SELECT HardwareID,DeviceID,Unit,Type,SubType,SwitchType,AddjValue2,nValue,sValue,Name,Options FROM DeviceStatus WHERE (ID == 1)
2018-05-31 11:10:03.472  SQLR result: 2;00014051;1;244;73;0;0.0;1;0;TestSwitch;;
2018-05-31 11:10:03.472  MAIN SwitchLightInt : switchcmd:Off level:-1 HWid:2  sd:2 00014051 1 244 73 0
2018-05-31 11:10:03.472  SQLQ query : SELECT LastLevel FROM DeviceStatus WHERE (HardwareID=2 AND DeviceID='00014051' AND Unit=1 AND Type=244 AND SubType=73)
2018-05-31 11:10:03.472  SQLR result: 0;
2018-05-31 11:10:03.472  MAIN SwitchLightInt : switchcmd=="On" || level < 0, new level:0
2018-05-31 11:10:03.473  MAIN ProcessRX Msg 1BF44900514001000100000000000CFF010000000000000000000000
2018-05-31 11:10:03.473  SQLQ query : SELECT ID,Name, Used, SwitchType, nValue, sValue, LastUpdate, Options FROM DeviceStatus WHERE (HardwareID=2 AND DeviceID='00014051' AND Unit=1 AND Type=244 AND SubType=73)
2018-05-31 11:10:03.473  SQLR result: 1;TestSwitch;1;0;1;0;2018-05-31 11:08:55;;
2018-05-31 11:10:03.483  SQLQ query : UPDATE DeviceStatus SET SignalLevel=12, BatteryLevel=255, nValue=0, sValue='0', LastUpdate='2018-05-31 11:10:03' WHERE (ID = 1)
2018-05-31 11:10:03.484  SQLQ query : INSERT INTO LightingLog (DeviceRowID, nValue, sValue) VALUES ('1', '0', '0')
2018-05-31 11:10:03.484  SQLQ query : SELECT Name,SwitchType,AddjValue,StrParam1,StrParam2,Options,LastLevel FROM DeviceStatus WHERE (ID = 1)
2018-05-31 11:10:03.484  SQLR result: TestSwitch;0;0.0;;;;0;
2018-05-31 11:10:03.484  RFXN : GetLightStatus Typ:244 STyp:73 nVal:0 sVal:0    llvl: 0 isDim:1 maxDim:100 GrpCmd:1 lstat:Off
2018-05-31 11:10:03.485  SQLH HandleOnOffAction: OffAction:
2018-05-31 11:10:03.485  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='EmailServer')
2018-05-31 11:10:03.485  SQLQ query : SELECT SceneRowID FROM SceneDevices WHERE (DeviceRowID == 1)
2018-05-31 11:10:03.486  SQLH UpdateValueInt TestSwitch HwID:2  DevID:00014051 Type:244  sType:73 nValue:0 sValue:0 
2018-05-31 11:10:03.486  SQLQ query : SELECT ID, SwitchType, LastUpdate, LastLevel, Options FROM DeviceStatus WHERE (Name == 'TestSwitch')
2018-05-31 11:10:03.486  SQLR result: 1;0;2018-05-31 11:10:03;0;;
2018-05-31 11:10:03.486  RFXN : GetLightStatus Typ:244 STyp:73 nVal:0 sVal:0    llvl: 0 isDim:1 maxDim:100 GrpCmd:1 lstat:Off
2018-05-31 11:10:03.487  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:10:03.487  SQLR result: 60;;
2018-05-31 11:10:03.488  SQLQ query : SELECT ID, Name, Enabled, Type, Mode1, Mode2 FROM Hardware
2018-05-31 11:10:03.488  SQLR result: 1;Domoticz Internal;1;67;0;0;
2018-05-31 11:10:03.488  SQLR result: 2;Dummy;1;15;0;0;
2018-05-31 11:10:03.489  SQLQ query : SELECT A.ID, A.DeviceID, A.Unit, A.Name, A.Used, A.Type, A.SubType, A.SignalLevel, A.BatteryLevel, A.nValue, A.sValue, A.LastUpdate, A.Favorite, A.SwitchType, A.HardwareID, A.AddjValue, A.AddjMulti, A.AddjValue2, A.AddjMulti2, A.LastLevel, A.CustomImage, A.StrParam1, A.StrParam2, A.Protected, IFNULL(B.XOffset,0), IFNULL(B.YOffset,0), IFNULL(B.PlanID,0), A.Description, A.Options, A.Color FROM DeviceStatus A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) WHERE (A.ID=='1')
2018-05-31 11:10:03.489  SQLR result: 1;00014051;1;TestSwitch;1;244;73;12;255;0;0;2018-05-31 11:10:03;1;0;2;0.0;1.0;0.0;1.0;0;0;;;0;0;0;0;;;;
2018-05-31 11:10:03.490  SQLQ query : SELECT COUNT(*) FROM Timers WHERE (DeviceRowID==1) AND (TimerPlan==0)
2018-05-31 11:10:03.491  SQLR result: 0;
2018-05-31 11:10:03.491  SQLQ query : SELECT COUNT(*) FROM SetpointTimers WHERE (DeviceRowID==1) AND (TimerPlan==0)
2018-05-31 11:10:03.491  SQLR result: 0;
2018-05-31 11:10:03.491  RFXN : GetLightStatus Typ:244 STyp:73 nVal:0 sVal:0    llvl: 0 isDim:1 maxDim:100 GrpCmd:1 lstat:Off
2018-05-31 11:10:03.492  SQLQ query : SELECT ID FROM LightSubDevices WHERE (DeviceRowID=='1')
2018-05-31 11:10:03.493  SQLQ query : SELECT ID FROM DeviceStatus WHERE (HardwareID=2 AND DeviceID='00014051' AND Unit=1 AND Type=244 AND SubType=73)
2018-05-31 11:10:03.493  SQLR result: 1;
2018-05-31 11:10:03.493  SQLQ query : SELECT A.ParentID, B.Name, B.HardwareID, B.[Type], B.[SubType], B.Unit FROM LightSubDevices as A, DeviceStatus as B WHERE (A.DeviceRowID=='1') AND (A.DeviceRowID!=A.ParentID) AND (B.[ID] == A.ParentID)
2018-05-31 11:10:03.494  SQLQ query : SELECT a.DeviceRowID, b.Type FROM LightSubDevices a, DeviceStatus b WHERE (a.ParentID=='1') AND (b.ID == a.DeviceRowID) AND (a.DeviceRowID!=a.ParentID)
2018-05-31 11:10:03.494  SQLQ query : SELECT ID, Activators, SceneType FROM Scenes WHERE (Activators!='')
2018-05-31 11:10:03.494  (Dummy) Light/Switch (TestSwitch)
2018-05-31 11:10:04.519  WEBH : Host:127.0.0.1 Uri;/json.htm?type=devices&filter=all&used=true&favorite=1&order=[Order]&plan=0&lastupdate=1527757736
2018-05-31 11:10:04.520  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='HideDisabledHardwareSensors')
2018-05-31 11:10:04.520  SQLR result: 1;;
2018-05-31 11:10:04.520  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:10:04.520  SQLR result: 60;;
2018-05-31 11:10:04.520  SQLQ query : SELECT ID, Name, Enabled, Type, Mode1, Mode2 FROM Hardware
2018-05-31 11:10:04.521  SQLR result: 1;Domoticz Internal;1;67;0;0;
2018-05-31 11:10:04.521  SQLR result: 2;Dummy;1;15;0;0;
2018-05-31 11:10:04.521  SQLQ query : SELECT A.ID, A.Name, A.nValue, A.LastUpdate, A.Favorite, A.SceneType, A.Protected, B.XOffset, B.YOffset, B.PlanID, A.Description FROM Scenes as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==1) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:10:04.521  SQLQ query : SELECT ID FROM Plans WHERE (Name=='$Hidden Devices')
2018-05-31 11:10:04.522  SQLR result: 1;
2018-05-31 11:10:04.522  SQLQ query : SELECT DeviceRowID FROM DeviceToPlansMap WHERE (PlanID=='1') AND (DevSceneType==0)
2018-05-31 11:10:04.523  SQLQ query : SELECT A.ID, A.DeviceID, A.Unit, A.Name, A.Used,A.Type, A.SubType, A.SignalLevel, A.BatteryLevel, A.nValue, A.sValue, A.LastUpdate, A.Favorite, A.SwitchType, A.HardwareID, A.AddjValue, A.AddjMulti, A.AddjValue2, A.AddjMulti2, A.LastLevel, A.CustomImage, A.StrParam1, A.StrParam2, A.Protected, IFNULL(B.XOffset,0), IFNULL(B.YOffset,0), IFNULL(B.PlanID,0), A.Description, A.Options, A.Color FROM DeviceStatus as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==0) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:10:04.523  SQLR result: 1;00014051;1;TestSwitch;1;244;73;12;255;0;0;2018-05-31 11:10:03;1;0;2;0.0;1.0;0.0;1.0;0;0;;;0;0;0;0;;;;
2018-05-31 11:10:04.524  SQLQ query : SELECT COUNT(*) FROM Timers WHERE (DeviceRowID==1) AND (TimerPlan==0)
2018-05-31 11:10:04.524  SQLR result: 0;
2018-05-31 11:10:04.524  SQLQ query : SELECT COUNT(*) FROM SetpointTimers WHERE (DeviceRowID==1) AND (TimerPlan==0)
2018-05-31 11:10:04.524  SQLR result: 0;
2018-05-31 11:10:04.524  RFXN : GetLightStatus Typ:244 STyp:73 nVal:0 sVal:0    llvl: 0 isDim:1 maxDim:100 GrpCmd:1 lstat:Off
2018-05-31 11:10:04.524  SQLQ query : SELECT ID FROM LightSubDevices WHERE (DeviceRowID=='1')
2018-05-31 11:10:14.557  WEBH : Host:127.0.0.1 Uri;/json.htm?type=devices&filter=all&used=true&favorite=1&order=[Order]&plan=0&lastupdate=1527757804
2018-05-31 11:10:14.558  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='HideDisabledHardwareSensors')
2018-05-31 11:10:14.558  SQLR result: 1;;
2018-05-31 11:10:14.559  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:10:14.559  SQLR result: 60;;
2018-05-31 11:10:14.560  SQLQ query : SELECT ID, Name, Enabled, Type, Mode1, Mode2 FROM Hardware
2018-05-31 11:10:14.560  SQLR result: 1;Domoticz Internal;1;67;0;0;
2018-05-31 11:10:14.560  SQLR result: 2;Dummy;1;15;0;0;
2018-05-31 11:10:14.561  SQLQ query : SELECT A.ID, A.Name, A.nValue, A.LastUpdate, A.Favorite, A.SceneType, A.Protected, B.XOffset, B.YOffset, B.PlanID, A.Description FROM Scenes as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==1) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:10:14.561  SQLQ query : SELECT ID FROM Plans WHERE (Name=='$Hidden Devices')
2018-05-31 11:10:14.561  SQLR result: 1;
2018-05-31 11:10:14.561  SQLQ query : SELECT DeviceRowID FROM DeviceToPlansMap WHERE (PlanID=='1') AND (DevSceneType==0)
2018-05-31 11:10:14.562  SQLQ query : SELECT A.ID, A.DeviceID, A.Unit, A.Name, A.Used,A.Type, A.SubType, A.SignalLevel, A.BatteryLevel, A.nValue, A.sValue, A.LastUpdate, A.Favorite, A.SwitchType, A.HardwareID, A.AddjValue, A.AddjMulti, A.AddjValue2, A.AddjMulti2, A.LastLevel, A.CustomImage, A.StrParam1, A.StrParam2, A.Protected, IFNULL(B.XOffset,0), IFNULL(B.YOffset,0), IFNULL(B.PlanID,0), A.Description, A.Options, A.Color FROM DeviceStatus as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==0) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:10:14.563  SQLR result: 1;00014051;1;TestSwitch;1;244;73;12;255;0;0;2018-05-31 11:10:03;1;0;2;0.0;1.0;0.0;1.0;0;0;;;0;0;0;0;;;;
2018-05-31 11:10:24.586  WEBH : Host:127.0.0.1 Uri;/json.htm?type=devices&filter=all&used=true&favorite=1&order=[Order]&plan=0&lastupdate=1527757804
2018-05-31 11:10:24.588  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='HideDisabledHardwareSensors')
2018-05-31 11:10:24.588  SQLR result: 1;;
2018-05-31 11:10:24.589  SQLQ query : SELECT nValue, sValue FROM Preferences WHERE (Key='SensorTimeout')
2018-05-31 11:10:24.589  SQLR result: 60;;
2018-05-31 11:10:24.589  SQLQ query : SELECT ID, Name, Enabled, Type, Mode1, Mode2 FROM Hardware
2018-05-31 11:10:24.589  SQLR result: 1;Domoticz Internal;1;67;0;0;
2018-05-31 11:10:24.590  SQLR result: 2;Dummy;1;15;0;0;
2018-05-31 11:10:24.590  SQLQ query : SELECT A.ID, A.Name, A.nValue, A.LastUpdate, A.Favorite, A.SceneType, A.Protected, B.XOffset, B.YOffset, B.PlanID, A.Description FROM Scenes as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==1) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:10:24.590  SQLQ query : SELECT ID FROM Plans WHERE (Name=='$Hidden Devices')
2018-05-31 11:10:24.591  SQLR result: 1;
2018-05-31 11:10:24.591  SQLQ query : SELECT DeviceRowID FROM DeviceToPlansMap WHERE (PlanID=='1') AND (DevSceneType==0)
2018-05-31 11:10:24.592  SQLQ query : SELECT A.ID, A.DeviceID, A.Unit, A.Name, A.Used,A.Type, A.SubType, A.SignalLevel, A.BatteryLevel, A.nValue, A.sValue, A.LastUpdate, A.Favorite, A.SwitchType, A.HardwareID, A.AddjValue, A.AddjMulti, A.AddjValue2, A.AddjMulti2, A.LastLevel, A.CustomImage, A.StrParam1, A.StrParam2, A.Protected, IFNULL(B.XOffset,0), IFNULL(B.YOffset,0), IFNULL(B.PlanID,0), A.Description, A.Options, A.Color FROM DeviceStatus as A LEFT OUTER JOIN DeviceToPlansMap as B ON (B.DeviceRowID==a.ID) AND (B.DevSceneType==0) ORDER BY A.[Order],A.LastUpdate DESC
2018-05-31 11:10:24.592  SQLR result: 1;00014051;1;TestSwitch;1;244;73;12;255;0;0;2018-05-31 11:10:03;1;0;2;0.0;1.0;0.0;1.0;0;0;;;0;0;0;0;;;;
2018-05-31 11:10:28.407  Closing application!...
2018-05-31 11:10:28.407  Stopping worker...
2018-05-31 11:10:28.407  RxQueue: queue worker stopped...
2018-05-31 11:10:28.408  WebServer(HTTP) stopped
2018-05-31 11:10:28.909  WebServer(SSL) stopped
2018-05-31 11:10:29.410  TCPServer: shared server stopped
2018-05-31 11:10:29.410  Stopping all hardware...
2018-05-31 11:10:29.410  Scheduler stopped...
2018-05-31 11:10:29.563  EventSystem: Stopped...

Re: phyton script in Events only runs once

Posted: Monday 04 June 2018 15:59
by Aurelio
I did some more testing with a basic script.

I started with the demoscript and started adding lines until i encountered the issue.
I can keep running the script until i add the "from Phidget22.Devices.VoltageOutput import *"- line. Then the script runs only once and can then no longer be executed.

Any toughts?

Code: Select all

import DomoticzEvents as DE
import sys
sys.path.append('/usr/local/lib/python3.4/dist-packages')
import time 


from Phidget22.Devices.VoltageOutput import *

DE.Log("Python: Changed: " + DE.changed_device.Describe())

if DE.changed_device_name == "Test":
    if DE.Devices["Test_Target"].n_value_string == "On":
        DE.Command("Test_Target", "Off")

    if DE.Devices["Test_Target"].n_value_string == "Off":
        DE.Command("Test_Target", "On")

DE.Log("Python: Number of user_variables: " + str(len(DE.user_variables)))

# All user_variables are treated as strings, convert as necessary
for key, value in DE.user_variables.items():
    DE.Log("Python: User-variable '{0}' has value: {1}".format(key, value))

# Description of Device_object should go here...

Re: phyton script in Events only runs once

Posted: Tuesday 05 June 2018 13:11
by Aurelio
I went a bit deeper through all the sub modules that are called with this import and I noticed that it is actually the import of module ctypes that causes the problem.

Any python Guru cares to shed his light on this?

The script below has the same behaviour.

Code: Select all

import DomoticzEvents as DE
import sys
sys.path.append('/usr/local/lib/python3.4/dist-packages')
import time 

import ctypes

DE.Log("Python: Changed: " + DE.changed_device.Describe())

if DE.changed_device_name == "Test":
    if DE.Devices["Test_Target"].n_value_string == "On":
        DE.Command("Test_Target", "Off")

    if DE.Devices["Test_Target"].n_value_string == "Off":
        DE.Command("Test_Target", "On")

DE.Log("Python: Number of user_variables: " + str(len(DE.user_variables)))

# All user_variables are treated as strings, convert as necessary
for key, value in DE.user_variables.items():
    DE.Log("Python: User-variable '{0}' has value: {1}".format(key, value))

# Description of Device_object should go here...

Re: phyton script in Events only runs once

Posted: Wednesday 12 December 2018 13:14
by neelix2018
I am experiencing the same behaviour with importing ctypes.
I have narrowed it down to the point that execution freezes when "_ctypes.pyd" is being imported. I believe all the paths are ok, as I can import ctypes in pure python with no problems.

Can anyone explain the reason for this ? Are my setting wrong or is it normal ?
Can this be fixed in any way ?

KR