You can subscribe to this list here.
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(121) |
Dec
(58) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
(38) |
Feb
(36) |
Mar
(7) |
Apr
(2) |
May
(32) |
Jun
(24) |
Jul
(16) |
Aug
(21) |
Sep
(17) |
Oct
(62) |
Nov
(60) |
Dec
(70) |
2012 |
Jan
(54) |
Feb
(41) |
Mar
(21) |
Apr
(38) |
May
(76) |
Jun
(47) |
Jul
(25) |
Aug
(72) |
Sep
(29) |
Oct
(64) |
Nov
(93) |
Dec
(97) |
2013 |
Jan
(100) |
Feb
(168) |
Mar
(115) |
Apr
(59) |
May
(37) |
Jun
(32) |
Jul
(45) |
Aug
(42) |
Sep
(24) |
Oct
(73) |
Nov
(64) |
Dec
(4) |
2014 |
Jan
(14) |
Feb
(57) |
Mar
(58) |
Apr
(10) |
May
(18) |
Jun
(12) |
Jul
(7) |
Aug
(12) |
Sep
(15) |
Oct
(6) |
Nov
(32) |
Dec
(17) |
2015 |
Jan
(50) |
Feb
(5) |
Mar
(1) |
Apr
(26) |
May
(10) |
Jun
(3) |
Jul
(3) |
Aug
(2) |
Sep
(3) |
Oct
(18) |
Nov
(18) |
Dec
(8) |
2016 |
Jan
(33) |
Feb
(35) |
Mar
(50) |
Apr
(20) |
May
(25) |
Jun
(17) |
Jul
(8) |
Aug
(73) |
Sep
(64) |
Oct
(51) |
Nov
(20) |
Dec
(14) |
2017 |
Jan
(41) |
Feb
(57) |
Mar
(44) |
Apr
(136) |
May
(32) |
Jun
(39) |
Jul
(2) |
Aug
(12) |
Sep
(32) |
Oct
(103) |
Nov
(12) |
Dec
(4) |
2018 |
Jan
(9) |
Feb
(1) |
Mar
(60) |
Apr
(24) |
May
(15) |
Jun
(1) |
Jul
(2) |
Aug
(23) |
Sep
(15) |
Oct
(57) |
Nov
(21) |
Dec
(77) |
2019 |
Jan
(62) |
Feb
(99) |
Mar
(98) |
Apr
(49) |
May
(6) |
Jun
(3) |
Jul
(6) |
Aug
(18) |
Sep
(9) |
Oct
(15) |
Nov
(30) |
Dec
(6) |
2020 |
Jan
(14) |
Feb
(2) |
Mar
(22) |
Apr
(33) |
May
(47) |
Jun
(12) |
Jul
|
Aug
|
Sep
(4) |
Oct
(2) |
Nov
(5) |
Dec
(5) |
2021 |
Jan
(4) |
Feb
(101) |
Mar
(13) |
Apr
(32) |
May
(40) |
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
(25) |
Nov
(12) |
Dec
|
2022 |
Jan
(154) |
Feb
(82) |
Mar
(63) |
Apr
(27) |
May
(26) |
Jun
(5) |
Jul
(12) |
Aug
(23) |
Sep
(17) |
Oct
(37) |
Nov
(13) |
Dec
(21) |
2023 |
Jan
(43) |
Feb
(43) |
Mar
(15) |
Apr
(8) |
May
(3) |
Jun
(25) |
Jul
(6) |
Aug
(38) |
Sep
(5) |
Oct
(20) |
Nov
(9) |
Dec
(28) |
2024 |
Jan
(15) |
Feb
(2) |
Mar
(12) |
Apr
(2) |
May
(8) |
Jun
(10) |
Jul
(10) |
Aug
(2) |
Sep
(3) |
Oct
(15) |
Nov
(6) |
Dec
(20) |
2025 |
Jan
|
Feb
(2) |
Mar
(6) |
Apr
(2) |
May
(2) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <ni...@us...> - 2010-11-19 21:54:38
|
Revision: 141 http://openautomation.svn.sourceforge.net/openautomation/?rev=141&view=rev Author: nilss1 Date: 2010-11-19 21:54:32 +0000 (Fri, 19 Nov 2010) Log Message: ----------- added healthcheck , checking Voltage of KNX Devices * individual threads for send, receive and healthcheck Modified Paths: -------------- PyWireGate/trunk/knx_connector/KNX_Connector.py Modified: PyWireGate/trunk/knx_connector/KNX_Connector.py =================================================================== --- PyWireGate/trunk/knx_connector/KNX_Connector.py 2010-11-19 21:43:22 UTC (rev 140) +++ PyWireGate/trunk/knx_connector/KNX_Connector.py 2010-11-19 21:54:32 UTC (rev 141) @@ -46,7 +46,8 @@ self.KNXSrc = EIBConnection.EIBAddr() self.KNXDst = EIBConnection.EIBAddr() - #self.sendQueue = Queue.PriorityQueue(maxsize=5000) + self.DeviceList = {} + self.sendQueue = KNXSendQueue(maxsize=5000) @@ -69,80 +70,80 @@ ## set local config self.config = self.WG.config[self.instanceName] + self._readThread = None + self._sendThread = None + self._checkThread = None + ## Start the Thread self.start() def run(self): - self._sendThread = threading.Thread(target=self._sendloop) - self._sendThread.setDaemon(True) - self._sendThread.start() while self.isrunning: ## Create Socket try: - self.KNX.EIBSocketURL(self.config['url']) - self.KNX.EIB_Cache_Enable() - if self.config['parser'] == "groupsocket": - self.debug("Using Groupsocket parser") - self.KNX.EIBOpen_GroupSocket_async(0) - else: - self.debug("Using Busmonitor Parser") - self.KNX.EIBOpenVBusmonitor_async() + ## wait a second for the Busmon to activate + if self._sendThread == None: + self._sendThread = threading.Thread(target=self._run) + self._sendThread.setDaemon(True) + self._sendThread.start() + if self._readThread == None: + self._readThread = threading.Thread(target=self._sendloop) + self._readThread.setDaemon(True) + self._readThread.start() + if self._checkThread == None: + self._checkThread = threading.Thread(target=self._healthCheck) + self._checkThread.setDaemon(True) + self._checkThread.start() - ## wait a second for the Busmon to activate - self.idle(1) - self._run() - try: - self.KNX.EIBClose() - except: - self.WG.errorlog() + + #self._run() + #try: + # self.KNX.EIBClose() + #except: + # self.WG.errorlog() except: self.WG.errorlog() if self.isrunning: - self.debug("Socket %r Closed waiting 5 sec" % self.config['url']) self.idle(5) def _shutdown(self): - try: - self._sendThread.join() - except: - pass - - def _run(self): - while self.isrunning: - ## Check if we are alive and responde until 10 secs - self.WG.watchdog(self.instanceName,10) + for rthread in [self._checkThread,self._sendThread,self._readThread]: try: - vbusmonin, vbusmonout, vbusmonerr = select.select([self.KNX.EIB_Poll_FD()],[],[],1) + rthread.join() except: - self.WG.errorlog() - break - if self.KNX.EIB_Poll_FD() in vbusmonin: - iscomplete=0 - while True: - try: - iscomplete = self.KNX.EIB_Poll_Complete() - ### evtl. fixed das die abgehackten Telegramme - if iscomplete==1: - break - except: - pass - if not iscomplete: - ## Eibd closed connection - break - if iscomplete==1: - ## capture BusMon packets - if self.config['parser'] == "groupsocket": - self.KNX.EIBGetGroup_Src(self.KNXBuffer,self.KNXSrc,self.KNXDst) - ## Only decode packets larger than 1 octet - if len(self.KNXBuffer.buffer) > 1 : - self.groupsocket.decode(self.KNXBuffer.buffer,self.KNXSrc.data,self.KNXDst.data) - else: - self.KNX.EIBGetBusmonitorPacket(self.KNXBuffer) - ## Only decode packets larger than 7 octets - if len(self.KNXBuffer.buffer) > 7 : - self.busmon.decode(self.KNXBuffer.buffer) - + pass + def _run(self): + try: + self.KNX.EIBSocketURL(self.config['url']) + self.KNX.EIB_Cache_Enable() + if self.config['parser'] == "groupsocket": + self.debug("Using Groupsocket parser") + self.KNX.EIBOpen_GroupSocket_async(0) + else: + self.debug("Using Busmonitor Parser") + self.KNX.EIBOpenVBusmonitor() + + while self.isrunning: + ## Check if we are alive and responde until 10 secs + self.WG.watchdog(self.instanceName,10) + if self.config['parser'] == "busmonior": + self.KNX.EIBGetBusmonitorPacket(self.KNXBuffer) + ## Only decode packets larger than 7 octets + if len(self.KNXBuffer.buffer) > 7 : + self.busmon.decode(self.KNXBuffer.buffer) + else: + self.KNX.EIBGetGroup_Src(self.KNXBuffer,self.KNXSrc,self.KNXDst) + ## Only decode packets larger than 1 octet + if self.KNXSrc.data not in self.DeviceList: + self.DeviceList[self.KNXSrc.data] = self.groupsocket._decodePhysicalAddr(self.KNXSrc.data) + if len(self.KNXBuffer.buffer) > 1 : + self.groupsocket.decode(self.KNXBuffer.buffer,self.KNXSrc.data,self.KNXDst.data) + finally: + self._readThread = None + self.KNX.EIBClose() + + def str2grpaddr(self,addrstr): grpaddr = self.GrpAddrRegex.findall(addrstr) if not grpaddr: @@ -161,17 +162,22 @@ def _sendloop(self): addr = 0 msg = [] - while self.isrunning: - try: - (addr,msg) = self.sendQueue.get(timeout=1) - self.KNX.EIBSendGroup(addr,msg) - except Empty: - pass - except: - self.WG.errorlog("Failed send %r %r" % (addr,msg)) + KNX = EIBConnection.EIBConnection() + try: + KNX.EIBSocketURL(self.config['url']) + while self.isrunning: + try: + (addr,msg) = self.sendQueue.get(timeout=1) + KNX.EIBSendGroup(addr,msg) + except Empty: + pass + except: + self.WG.errorlog("Failed send %r %r" % (addr,msg)) + finally: + self._sendThread = None + KNX.EIBClose() - def send(self,msg,dstaddr,flag=KNXWRITEFLAG): try: addr = self.str2grpaddr(dstaddr) @@ -198,7 +204,45 @@ except: print "----------- ERROR IN KNX_CONNECTOR.setValue ----------------" + def _healthCheck(self): + ebuf = EIBConnection.EIBBuffer() + KNX = EIBConnection.EIBConnection() + self.debug("Starting HealthCheck") + try: + KNX.EIBSocketURL(self.config['url']) + while self.isrunning: + self.idle(30) + for physaddr, device in self.DeviceList.items(): + if not self.isrunning: + break + if physaddr < 4352: + continue + id = "%s:PHY_%s" % (self.instanceName,device) + self.debug("Checking Voltage for %s" % id) + obj = self.WG.DATASTORE.get(id) + if 'ignorecheck' in obj.config: + continue + KNX.EIB_MC_Connect(physaddr) + ## read voltage + ret = KNX.EIB_MC_ReadADC(1,1,ebuf) + try: + if ret > -1: + value = ebuf.data * .15 + else: + value = -1 + self.WG.DATASTORE.update(id,value) + except: + pass + KNX.EIBReset() + ## wait 500ms between checks + self.idle(.5) + ## wait 5 Minutes + self.idle(300) + finally: + self._checkThread = None + KNX.EIBClose() + class KNXSendQueue(Queue): def _init(self, maxsize): self.maxsize = maxsize This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <net...@us...> - 2010-11-19 21:43:29
|
Revision: 140 http://openautomation.svn.sourceforge.net/openautomation/?rev=140&view=rev Author: netzkind Date: 2010-11-19 21:43:22 +0000 (Fri, 19 Nov 2010) Log Message: ----------- renamed styles to stylings, added dpt-dropdown for editor, fixed bugs: https://sourceforge.net/tracker/?func=detail&aid=3109425&group_id=296426&atid=1251141 https://sourceforge.net/tracker/?func=detail&aid=3109428&group_id=296426&atid=1251141 https://sourceforge.net/tracker/?func=detail&aid=3109427&group_id=296426&atid=1251141 https://sourceforge.net/tracker/?func=detail&aid=3109424&group_id=296426&atid=1251141 Modified Paths: -------------- CometVisu/trunk/ChangeLog CometVisu/trunk/visu/edit/save_config.php CometVisu/trunk/visu/edit/visuconfig_edit.js CometVisu/trunk/visu/lib/templateengine.js CometVisu/trunk/visu/lib/visudesign_custom.js CometVisu/trunk/visu/lib/visudesign_pure.js CometVisu/trunk/visu/visu_config.xml CometVisu/trunk/visu/visu_config.xsd Added Paths: ----------- CometVisu/trunk/visu/edit/dpt_list.csv CometVisu/trunk/visu/edit/dpt_list.json Modified: CometVisu/trunk/ChangeLog =================================================================== --- CometVisu/trunk/ChangeLog 2010-11-18 19:19:29 UTC (rev 139) +++ CometVisu/trunk/ChangeLog 2010-11-19 21:43:22 UTC (rev 140) @@ -12,6 +12,7 @@ - New Feature: tag for videos (HTML5 based) - changed procedures for creating new widgets - added design "discreet", set as default +- changed name for styles; new name: styling / stylings 0.5.0 ===== Added: CometVisu/trunk/visu/edit/dpt_list.csv =================================================================== --- CometVisu/trunk/visu/edit/dpt_list.csv (rev 0) +++ CometVisu/trunk/visu/edit/dpt_list.csv 2010-11-19 21:43:22 UTC (rev 140) @@ -0,0 +1,327 @@ +"dpt","name" +"1.001","DPT_Switch" +"1.002","DPT_Bool" +"1.003","DPT_Enable" +"1.004","DPT_Ramp" +"1.005","DPT_Alarm" +"1.006","DPT_BinaryValue" +"1.007","DPT_Step" +"1.008","DPT_UpDown" +"1.009","DPT_OpenClose" +"1.010","DPT_Start" +"1.011","DPT_State" +"1.012","DPT_Invert" +"1.013","DPT_DimSendStyle" +"1.014","DPT_InputSource" +"1.015","DPT_Reset" +"1.016","DPT_Ack" +"1.017","DPT_Trigger" +"1.018","DPT_Occupancy" +"1.019","DPT_Window_Door" +"1.021","DPT_LogicalFunction" +"1.022","DPT_Scene_AB" +"1.023","DPT_ShutterBlinds_Mode" +"1.100","DPT_Heat/Cool" +"2.001","DPT_Switch_Control" +"2.002","DPT_Bool_Control" +"2.003","DPT_Enable_Control" +"2.004","DPT_Ramp_Control" +"2.005","DPT_Alarm_Control" +"2.006","DPT_BinaryValue_Control" +"2.007","DPT_Step_Control" +"2.008","DPT_Direction1_Control" +"2.009","DPT_Direction2_Control" +"2.010","DPT_Start_Control" +"2.011","DPT_State_Control" +"2.012","DPT_Invert_Control" +"3.007","DPT_Control_Dimming" +"3.008","DPT_Control_Blinds" +"4.001","DPT_Char_ASCII" +"4.002","DPT_Char_8859_1" +"5.001","DPT_Scaling" +"5.003","DPT_Angle" +"5.004","DPT_Percent_U8" +"5.005","DPT_DecimalFactor" +"5.006","DPT_Tariff" +"5.010","DPT_Value_1_Ucount" +"6.001","DPT_Percent_V8" +"6.010","DPT_Value_1_Count" +"6.020","DPT_Status_Mode3" +"7.001","DPT_Value_2_Ucount" +"7.002","DPT_TimePeriodMsec" +"7.003","DPT_TimePeriod10MSec" +"7.004","DPT_TimePeriod100MSec" +"7.005","DPT_TimePeriodSec" +"7.006","DPT_TimePeriodMin" +"7.007","DPT_TimePeriodHrs" +"7.010","DPT_PropDataType" +"7.011","DPT_Length_mm" +"7.012","DPT_UElCurrentmA" +"7.013","DPT_Brightness" +"8.001","DPT_Value_2_Count" +"8.002","DPT_DeltaTimeMsec" +"8.003","DPT_DeltaTime10MSec" +"8.004","DPT_DeltaTime100MSec" +"8.005","DPT_DeltaTimeSec" +"8.006","DPT_DeltaTimeMin" +"8.007","DPT_DeltaTimeHrs" +"8.010","DPT_Percent_V16" +"8.011","DPT_Rotation_Angle" +"9.001","DPT_Value_Temp" +"9.002","DPT_Value_Tempd" +"9.003","DPT_Value_Tempa" +"9.004","DPT_Value_Lux" +"9.005","DPT_Value_Wsp" +"9.006","DPT_Value_Pres" +"9.007","DPT_Value_Humidity" +"9.008","DPT_Value_AirQuality" +"9.010","DPT_Value_Time1" +"9.011","DPT_Value_Time2" +"9.020","DPT_Value_Volt" +"9.021","DPT_Value_Curr" +"9.022","DPT_PowerDensity" +"9.023","DPT_KelvinPerPercent" +"9.024","DPT_Power" +"9.025","DPT_Value_Volume_Flow" +"9.026","DPT_Rain_Amount" +"9.027","DPT_Value_Temp_F" +"9.028","DPT_Value_Wsp_kmh" +"10.001","DPT_TimeOfDay" +"11.001","DPT_Date" +"12.001","DPT_Value_4_Ucount" +"13.001","DPT_Value_4_Count" +"13.010","DPT_ActiveEnergy" +"13.011","DPT_ApparantEnergy" +"13.012","DPT_ReactiveEnergy" +"13.013","DPT_ActiveEnergy_kWh" +"13.014","DPT_ApparantEnergy_kVAh" +"13.015","DPT_ReactiveEnergy_kVARh" +"13.100","DPT_LongDeltaTimeSec" +"14.000","DPT_Value_Acceleration" +"14.001","DPT_Value_Acceleration_Angular" +"14.002","DPT_Value_Activation_Energy" +"14.003","DPT_Value_Activity" +"14.004","DPT_Value_Mol" +"14.005","DPT_Value_Amplitude" +"14.006","DPT_Value_AngleRad" +"14.007","DPT_Value_AngleDeg" +"14.008","DPT_Value_Angular_Momentum" +"14.009","DPT_Value_Angular_Velocity" +"14.010","DPT_Value_Area" +"14.011","DPT_Value_Capacitance" +"14.012","DPT_Value_Charge_DensitySurface" +"14.013","DPT_Value_Charge_DensityVolume" +"14.014","DPT_Value_Compressibility" +"14.015","DPT_Value_Conductance" +"14.016","DPT_Value_Electrical_Conductivity" +"14.017","DPT_Value_Density" +"14.018","DPT_Value_Electric_Charge" +"14.019","DPT_Value_Electric_Current" +"14.020","DPT_Value_Electric_CurrentDensity" +"14.021","DPT_Value_Electric_DipoleMoment" +"14.022","DPT_Value_Electric_Displacement" +"14.023","DPT_Value_Electric_FieldStrength" +"14.024","DPT_Value_Electric_Flux" +"14.025","DPT_Value_Electric_FluxDensity" +"14.026","DPT_Value_Electric_Polarization" +"14.027","DPT_Value_Electric_Potential" +"14.028","DPT_Value_Electric_PotentialDifference" +"14.029","DPT_Value_ElectromagneticMoment" +"14.030","DPT_Value_Electromotive_Force" +"14.031","DPT_Value_Energy" +"14.032","DPT_Value_Force" +"14.033","DPT_Value_Frequency" +"14.034","DPT_Value_Angular_Frequency" +"14.035","DPT_Value_Heat_Capacity" +"14.036","DPT_Value_Heat_FlowRate" +"14.037","DPT_Value_Heat_Quantity" +"14.038","DPT_Value_Impedance" +"14.039","DPT_Value_Length" +"14.040","DPT_Value_Light_Quantity" +"14.041","DPT_Value_Luminance" +"14.042","DPT_Value_Luminous_Flux" +"14.043","DPT_Value_Luminous_Intensity" +"14.044","DPT_Value_Magnetic_FieldStrength" +"14.045","DPT_Value_Magnetic_Flux" +"14.046","DPT_Value_Magnetic_FluxDensity" +"14.047","DPT_Value_Magnetic_Moment" +"14.048","DPT_Value_Magnetic_Polarization" +"14.049","DPT_Value_Magnetization" +"14.050","DPT_Value_MagnetomotiveForce" +"14.051","DPT_Value_Mass" +"14.052","DPT_Value_MassFlux" +"14.053","DPT_Value_Momentum" +"14.054","DPT_Value_Phase_AngleRad" +"14.055","DPT_Value_Phase_AngleDeg" +"14.056","DPT_Value_Power" +"14.057","DPT_Value_Power_Factor" +"14.058","DPT_Value_Pressure" +"14.059","DPT_Value_Reactance" +"14.060","DPT_Value_Resistance" +"14.061","DPT_Value_Resistivity" +"14.062","DPT_Value_SelfInductance" +"14.063","DPT_Value_SolidAngle" +"14.064","DPT_Value_Sound_Intensity" +"14.065","DPT_Value_Speed" +"14.066","DPT_Value_Stress" +"14.067","DPT_Value_Surface_Tension" +"14.068","DPT_Value_Common_Temperature" +"14.069","DPT_Value_Absolute_Temperature" +"14.070","DPT_Value_TemperatureDifference" +"14.071","DPT_Value_Thermal_Capacity" +"14.072","DPT_Value_Thermal_Conductivity" +"14.073","DPT_Value_ThermoelectricPower" +"14.074","DPT_Value_Time" +"14.075","DPT_Value_Torque" +"14.076","DPT_Value_Volume" +"14.077","DPT_Value_Volume_Flux" +"14.078","DPT_Value_Weight" +"14.079","DPT_Value_Work" +"15.000","DPT_Access_Data" +"16.000","DPT_String_ASCII" +"16.001","DPT_String_8859_1" +"17.001","DPT_SceneNumber" +"18.001","DPT_SceneControl" +"19.001","DPT_DateTime" +"20.001","DPT_SCLOMode" +"20.002","DPT_BuildingMode" +"20.003","DPT_OccMode" +"20.004","DPT_Priority" +"20.005","DPT_LightApplicationMode" +"20.006","DPT_ApplicationArea" +"20.007","DPT_AlarmClassType" +"20.008","DPT_PSUMode" +"20.011","DPT_ErrorClass_System" +"20.012","DPT_ErrorClass_HVAC" +"20.013","DPT_Time_Delay" +"20.014","DPT_Beaufort_Wind_Force_Scale" +"20.017","DPT_SensorSelect" +"20.100","DPT_FuelType" +"20.101","DPT_BurnerType" +"20.102","DPT_HVACMode" +"20.103","DPT_DHWMode" +"20.104","DPT_LoadPriority" +"20.105","DPT_HVACContrMode" +"20.106","DPT_HVACEmergMode" +"20.107","DPT_ChangeoverMode" +"20.108","DPT_ValveMode" +"20.109","DPT_DamperMode" +"20.110","DPT_HeaterMode" +"20.111","DPT_FanMode" +"20.112","DPT_MasterSlaveMode" +"20.113","DPT_StatusRoomSetp" +"20.600","DPT_Behaviour_Lock_Unlock" +"20.601","DPT_Behaviour_Bus_Power_Up_Down" +"20.1000","DPT_CommMode" +"20.1001","DPT_AddInfoTypes" +"20.1002","DPT_RF_ModeSelect" +"20.1003","DPT_RF_FilterSelect" +"21.001","DPT_StatusGen" +"21.002","DPT_Device_Control" +"21.100","DPT_ForceSign" +"21.101","DPT_ForceSignCool" +"21.102","DPT_StatusRHC" +"21.103","DPT_StatusSDHWC" +"21.104","DPT_FuelTypeSet" +"21.105","DPT_StatusRCC" +"21.106","DPT_StatusAHU" +"21.1000","DPT_RF_ModeInfo" +"21.1001","DPT_RF_FilterInfo" +"21.1010","DPT_Channel_Activation_8" +"22.100","DPT_StatusDHWC" +"22.101","DPT_StatusRHCC" +"22.1000","DPT_Media" +"22.1010","DPT_Channel_Activation_16" +"23.001","DPT_OnOff_Action" +"23.002","DPT_Alarm_Reaction" +"23.003","DPT_UpDown_Action" +"23.102","DPT_HVAC_PB_Action" +"24.001","DPT_VarString_8859_1" +"25.1000","DPT_DoubleNibble" +"26.001","DPT_SceneInfo" +"27.001","DPT_CombinedInfoOnOff" +"28.001","DPT_UTF-8" +"29.010","DPT_ActiveEnergy_V64" +"29.011","DPT_ApparantEnergy_V64" +"29.012","DPT_ReactiveEnergy_V64" +"30.1010","DPT_Channel_Activation_24" +"31.101","DPT_PB_Action_HVAC_Extended" +"200.100","DPT_Heat/Cool_Z" +"200.101","DPT_BinaryValue_Z" +"201.100","DPT_HVACMode_Z" +"201.102","DPT_DHWMode_Z" +"201.104","DPT_HVACContrMode_Z" +"201.105","DPT_EnablH/Cstage_Z" +"201.107","DPT_BuildingMode_Z" +"201.108","DPT_OccMode_Z" +"201.109","DPT_HVACEmergMode_Z" +"202.001","DPT_RelValue_Z" +"202.002","DPT_UCountValue8_Z" +"203.002","DPT_TimePeriodMsec_Z" +"203.003","DPT_TimePeriod10Msec_Z" +"203.004","DPT_TimePeriod100Msec_Z" +"203.005","DPT_TimePeriodSec_Z" +"203.006","DPT_TimePeriodMin_Z" +"203.007","DPT_TimePeriodHrs_Z" +"203.011","DPT_UFlowRateLiter/h_Z" +"203.012","DPT_UCountValue16_Z" +"203.013","DPT_UElCurrent?A_Z" +"203.014","DPT_PowerKW_Z" +"203.015","DPT_AtmPressureAbs_Z" +"203.017","DPT_PercentU16_Z" +"203.100","DPT_HVACAirQual_Z" +"203.101","DPT_WindSpeed_Z" +"203.102","DPT_SunIntensity_Z" +"203.104","DPT_HVACAirFlowAbs_Z" +"204.001","DPT_RelSignedValue_Z" +"205.002","DPT_DeltaTimeMsec_Z" +"205.003","DPT_DeltaTime10Msec_Z" +"205.004","DPT_DeltaTime100Msec_Z" +"205.005","DPT_DeltaTimeSec_Z" +"205.006","DPT_DeltaTimeMin_Z" +"205.007","DPT_DeltaTimeHrs_Z" +"205.100","DPT_TempHVACAbs_Z" +"205.101","DPT_TempHVACRel_Z" +"205.102","DPT_HVACAirFlowRel_Z" +"206.100","DPT_HVACModeNext" +"206.102","DPT_DHWModeNext" +"206.104","DPT_OccModeNext" +"206.105","DPT_BuildingModeNext" +"207.100","DPT_StatusBUC" +"207.101","DPT_LockSign" +"207.102","DPT_ValueDemBOC" +"207.104","DPT_ActPosDemAbs" +"207.105","DPT_StatusAct" +"209.100","DPT_StatusHPM" +"209.101","DPT_TempRoomDemAbs" +"209.102","DPT_StatusCPM" +"209.103","DPT_StatusWTC" +"210.100","DPT_TempFlowWaterDemAbs" +"211.100","DPT_EnergyDemWater" +"212.100","DPT_TempRoomSetpSetShift[3]" +"212.101","DPT_TempRoomSetpSet[3]" +"213.100","DPT_TempRoomSetpSet[4]" +"213.101","DPT_TempDHWSetpSet[4]" +"213.102","DPT_TempRoomSetpSetShift[4]" +"214.100","DPT_PowerFlowWaterDemHPM" +"214.101","DPT_PowerFlowWaterDemCPM" +"215.100","DPT_StatusBOC" +"215.101","DPT_StatusCC" +"216.100","DPT_SpecHeatProd" +"217.001","DPT_Version" +"218.001","DPT_VolumeLiter_Z" +"219.001","DPT_AlarmInfo" +"220.100","DPT_TempHVACAbsNext" +"221.001","DPT_SerNum" +"222.100","DPT_TempRoomSetpSetF16[3]" +"222.101","DPT_TempRoomSetpSetShiftF16[3]" +"223.100","DPT_EnergyDemAir" +"224.100","DPT_TempSupply" +"225.001","DPT_ScalingSpeed" +"225.002","DPT_Scaling_Step_Time" +"229.001","DPT_MeteringValue" +"230.1000","DPT_MBus_Address" +"231.001","DPT_Locale_ASCII" +"232.600","DPT_Colour_RGB" +"234.001","DPT_LanguageCodeAlpha2_ASCII" +"234.002","DPT_RegionCodeAlpha2_ASCII" Added: CometVisu/trunk/visu/edit/dpt_list.json =================================================================== --- CometVisu/trunk/visu/edit/dpt_list.json (rev 0) +++ CometVisu/trunk/visu/edit/dpt_list.json 2010-11-19 21:43:22 UTC (rev 140) @@ -0,0 +1,1305 @@ +[{ + "dpt":"1.001", + "name":"DPT_Switch" + }, + { + "dpt":"1.002", + "name":"DPT_Bool" + }, + { + "dpt":"1.003", + "name":"DPT_Enable" + }, + { + "dpt":"1.004", + "name":"DPT_Ramp" + }, + { + "dpt":"1.005", + "name":"DPT_Alarm" + }, + { + "dpt":"1.006", + "name":"DPT_BinaryValue" + }, + { + "dpt":"1.007", + "name":"DPT_Step" + }, + { + "dpt":"1.008", + "name":"DPT_UpDown" + }, + { + "dpt":"1.009", + "name":"DPT_OpenClose" + }, + { + "dpt":"1.010", + "name":"DPT_Start" + }, + { + "dpt":"1.011", + "name":"DPT_State" + }, + { + "dpt":"1.012", + "name":"DPT_Invert" + }, + { + "dpt":"1.013", + "name":"DPT_DimSendStyle" + }, + { + "dpt":"1.014", + "name":"DPT_InputSource" + }, + { + "dpt":"1.015", + "name":"DPT_Reset" + }, + { + "dpt":"1.016", + "name":"DPT_Ack" + }, + { + "dpt":"1.017", + "name":"DPT_Trigger" + }, + { + "dpt":"1.018", + "name":"DPT_Occupancy" + }, + { + "dpt":"1.019", + "name":"DPT_Window_Door" + }, + { + "dpt":"1.021", + "name":"DPT_LogicalFunction" + }, + { + "dpt":"1.022", + "name":"DPT_Scene_AB" + }, + { + "dpt":"1.023", + "name":"DPT_ShutterBlinds_Mode" + }, + { + "dpt":"1.100", + "name":"DPT_Heat/Cool" + }, + { + "dpt":"2.001", + "name":"DPT_Switch_Control" + }, + { + "dpt":"2.002", + "name":"DPT_Bool_Control" + }, + { + "dpt":"2.003", + "name":"DPT_Enable_Control" + }, + { + "dpt":"2.004", + "name":"DPT_Ramp_Control" + }, + { + "dpt":"2.005", + "name":"DPT_Alarm_Control" + }, + { + "dpt":"2.006", + "name":"DPT_BinaryValue_Control" + }, + { + "dpt":"2.007", + "name":"DPT_Step_Control" + }, + { + "dpt":"2.008", + "name":"DPT_Direction1_Control" + }, + { + "dpt":"2.009", + "name":"DPT_Direction2_Control" + }, + { + "dpt":"2.010", + "name":"DPT_Start_Control" + }, + { + "dpt":"2.011", + "name":"DPT_State_Control" + }, + { + "dpt":"2.012", + "name":"DPT_Invert_Control" + }, + { + "dpt":"3.007", + "name":"DPT_Control_Dimming" + }, + { + "dpt":"3.008", + "name":"DPT_Control_Blinds" + }, + { + "dpt":"4.001", + "name":"DPT_Char_ASCII" + }, + { + "dpt":"4.002", + "name":"DPT_Char_8859_1" + }, + { + "dpt":"5.001", + "name":"DPT_Scaling" + }, + { + "dpt":"5.003", + "name":"DPT_Angle" + }, + { + "dpt":"5.004", + "name":"DPT_Percent_U8" + }, + { + "dpt":"5.005", + "name":"DPT_DecimalFactor" + }, + { + "dpt":"5.006", + "name":"DPT_Tariff" + }, + { + "dpt":"5.010", + "name":"DPT_Value_1_Ucount" + }, + { + "dpt":"6.001", + "name":"DPT_Percent_V8" + }, + { + "dpt":"6.010", + "name":"DPT_Value_1_Count" + }, + { + "dpt":"6.020", + "name":"DPT_Status_Mode3" + }, + { + "dpt":"7.001", + "name":"DPT_Value_2_Ucount" + }, + { + "dpt":"7.002", + "name":"DPT_TimePeriodMsec" + }, + { + "dpt":"7.003", + "name":"DPT_TimePeriod10MSec" + }, + { + "dpt":"7.004", + "name":"DPT_TimePeriod100MSec" + }, + { + "dpt":"7.005", + "name":"DPT_TimePeriodSec" + }, + { + "dpt":"7.006", + "name":"DPT_TimePeriodMin" + }, + { + "dpt":"7.007", + "name":"DPT_TimePeriodHrs" + }, + { + "dpt":"7.010", + "name":"DPT_PropDataType" + }, + { + "dpt":"7.011", + "name":"DPT_Length_mm" + }, + { + "dpt":"7.012", + "name":"DPT_UElCurrentmA" + }, + { + "dpt":"7.013", + "name":"DPT_Brightness" + }, + { + "dpt":"8.001", + "name":"DPT_Value_2_Count" + }, + { + "dpt":"8.002", + "name":"DPT_DeltaTimeMsec" + }, + { + "dpt":"8.003", + "name":"DPT_DeltaTime10MSec" + }, + { + "dpt":"8.004", + "name":"DPT_DeltaTime100MSec" + }, + { + "dpt":"8.005", + "name":"DPT_DeltaTimeSec" + }, + { + "dpt":"8.006", + "name":"DPT_DeltaTimeMin" + }, + { + "dpt":"8.007", + "name":"DPT_DeltaTimeHrs" + }, + { + "dpt":"8.010", + "name":"DPT_Percent_V16" + }, + { + "dpt":"8.011", + "name":"DPT_Rotation_Angle" + }, + { + "dpt":"9.001", + "name":"DPT_Value_Temp" + }, + { + "dpt":"9.002", + "name":"DPT_Value_Tempd" + }, + { + "dpt":"9.003", + "name":"DPT_Value_Tempa" + }, + { + "dpt":"9.004", + "name":"DPT_Value_Lux" + }, + { + "dpt":"9.005", + "name":"DPT_Value_Wsp" + }, + { + "dpt":"9.006", + "name":"DPT_Value_Pres" + }, + { + "dpt":"9.007", + "name":"DPT_Value_Humidity" + }, + { + "dpt":"9.008", + "name":"DPT_Value_AirQuality" + }, + { + "dpt":"9.010", + "name":"DPT_Value_Time1" + }, + { + "dpt":"9.011", + "name":"DPT_Value_Time2" + }, + { + "dpt":"9.020", + "name":"DPT_Value_Volt" + }, + { + "dpt":"9.021", + "name":"DPT_Value_Curr" + }, + { + "dpt":"9.022", + "name":"DPT_PowerDensity" + }, + { + "dpt":"9.023", + "name":"DPT_KelvinPerPercent" + }, + { + "dpt":"9.024", + "name":"DPT_Power" + }, + { + "dpt":"9.025", + "name":"DPT_Value_Volume_Flow" + }, + { + "dpt":"9.026", + "name":"DPT_Rain_Amount" + }, + { + "dpt":"9.027", + "name":"DPT_Value_Temp_F" + }, + { + "dpt":"9.028", + "name":"DPT_Value_Wsp_kmh" + }, + { + "dpt":"10.001", + "name":"DPT_TimeOfDay" + }, + { + "dpt":"11.001", + "name":"DPT_Date" + }, + { + "dpt":"12.001", + "name":"DPT_Value_4_Ucount" + }, + { + "dpt":"13.001", + "name":"DPT_Value_4_Count" + }, + { + "dpt":"13.010", + "name":"DPT_ActiveEnergy" + }, + { + "dpt":"13.011", + "name":"DPT_ApparantEnergy" + }, + { + "dpt":"13.012", + "name":"DPT_ReactiveEnergy" + }, + { + "dpt":"13.013", + "name":"DPT_ActiveEnergy_kWh" + }, + { + "dpt":"13.014", + "name":"DPT_ApparantEnergy_kVAh" + }, + { + "dpt":"13.015", + "name":"DPT_ReactiveEnergy_kVARh" + }, + { + "dpt":"13.100", + "name":"DPT_LongDeltaTimeSec" + }, + { + "dpt":"14.000", + "name":"DPT_Value_Acceleration" + }, + { + "dpt":"14.001", + "name":"DPT_Value_Acceleration_Angular" + }, + { + "dpt":"14.002", + "name":"DPT_Value_Activation_Energy" + }, + { + "dpt":"14.003", + "name":"DPT_Value_Activity" + }, + { + "dpt":"14.004", + "name":"DPT_Value_Mol" + }, + { + "dpt":"14.005", + "name":"DPT_Value_Amplitude" + }, + { + "dpt":"14.006", + "name":"DPT_Value_AngleRad" + }, + { + "dpt":"14.007", + "name":"DPT_Value_AngleDeg" + }, + { + "dpt":"14.008", + "name":"DPT_Value_Angular_Momentum" + }, + { + "dpt":"14.009", + "name":"DPT_Value_Angular_Velocity" + }, + { + "dpt":"14.010", + "name":"DPT_Value_Area" + }, + { + "dpt":"14.011", + "name":"DPT_Value_Capacitance" + }, + { + "dpt":"14.012", + "name":"DPT_Value_Charge_DensitySurface" + }, + { + "dpt":"14.013", + "name":"DPT_Value_Charge_DensityVolume" + }, + { + "dpt":"14.014", + "name":"DPT_Value_Compressibility" + }, + { + "dpt":"14.015", + "name":"DPT_Value_Conductance" + }, + { + "dpt":"14.016", + "name":"DPT_Value_Electrical_Conductivity" + }, + { + "dpt":"14.017", + "name":"DPT_Value_Density" + }, + { + "dpt":"14.018", + "name":"DPT_Value_Electric_Charge" + }, + { + "dpt":"14.019", + "name":"DPT_Value_Electric_Current" + }, + { + "dpt":"14.020", + "name":"DPT_Value_Electric_CurrentDensity" + }, + { + "dpt":"14.021", + "name":"DPT_Value_Electric_DipoleMoment" + }, + { + "dpt":"14.022", + "name":"DPT_Value_Electric_Displacement" + }, + { + "dpt":"14.023", + "name":"DPT_Value_Electric_FieldStrength" + }, + { + "dpt":"14.024", + "name":"DPT_Value_Electric_Flux" + }, + { + "dpt":"14.025", + "name":"DPT_Value_Electric_FluxDensity" + }, + { + "dpt":"14.026", + "name":"DPT_Value_Electric_Polarization" + }, + { + "dpt":"14.027", + "name":"DPT_Value_Electric_Potential" + }, + { + "dpt":"14.028", + "name":"DPT_Value_Electric_PotentialDifference" + }, + { + "dpt":"14.029", + "name":"DPT_Value_ElectromagneticMoment" + }, + { + "dpt":"14.030", + "name":"DPT_Value_Electromotive_Force" + }, + { + "dpt":"14.031", + "name":"DPT_Value_Energy" + }, + { + "dpt":"14.032", + "name":"DPT_Value_Force" + }, + { + "dpt":"14.033", + "name":"DPT_Value_Frequency" + }, + { + "dpt":"14.034", + "name":"DPT_Value_Angular_Frequency" + }, + { + "dpt":"14.035", + "name":"DPT_Value_Heat_Capacity" + }, + { + "dpt":"14.036", + "name":"DPT_Value_Heat_FlowRate" + }, + { + "dpt":"14.037", + "name":"DPT_Value_Heat_Quantity" + }, + { + "dpt":"14.038", + "name":"DPT_Value_Impedance" + }, + { + "dpt":"14.039", + "name":"DPT_Value_Length" + }, + { + "dpt":"14.040", + "name":"DPT_Value_Light_Quantity" + }, + { + "dpt":"14.041", + "name":"DPT_Value_Luminance" + }, + { + "dpt":"14.042", + "name":"DPT_Value_Luminous_Flux" + }, + { + "dpt":"14.043", + "name":"DPT_Value_Luminous_Intensity" + }, + { + "dpt":"14.044", + "name":"DPT_Value_Magnetic_FieldStrength" + }, + { + "dpt":"14.045", + "name":"DPT_Value_Magnetic_Flux" + }, + { + "dpt":"14.046", + "name":"DPT_Value_Magnetic_FluxDensity" + }, + { + "dpt":"14.047", + "name":"DPT_Value_Magnetic_Moment" + }, + { + "dpt":"14.048", + "name":"DPT_Value_Magnetic_Polarization" + }, + { + "dpt":"14.049", + "name":"DPT_Value_Magnetization" + }, + { + "dpt":"14.050", + "name":"DPT_Value_MagnetomotiveForce" + }, + { + "dpt":"14.051", + "name":"DPT_Value_Mass" + }, + { + "dpt":"14.052", + "name":"DPT_Value_MassFlux" + }, + { + "dpt":"14.053", + "name":"DPT_Value_Momentum" + }, + { + "dpt":"14.054", + "name":"DPT_Value_Phase_AngleRad" + }, + { + "dpt":"14.055", + "name":"DPT_Value_Phase_AngleDeg" + }, + { + "dpt":"14.056", + "name":"DPT_Value_Power" + }, + { + "dpt":"14.057", + "name":"DPT_Value_Power_Factor" + }, + { + "dpt":"14.058", + "name":"DPT_Value_Pressure" + }, + { + "dpt":"14.059", + "name":"DPT_Value_Reactance" + }, + { + "dpt":"14.060", + "name":"DPT_Value_Resistance" + }, + { + "dpt":"14.061", + "name":"DPT_Value_Resistivity" + }, + { + "dpt":"14.062", + "name":"DPT_Value_SelfInductance" + }, + { + "dpt":"14.063", + "name":"DPT_Value_SolidAngle" + }, + { + "dpt":"14.064", + "name":"DPT_Value_Sound_Intensity" + }, + { + "dpt":"14.065", + "name":"DPT_Value_Speed" + }, + { + "dpt":"14.066", + "name":"DPT_Value_Stress" + }, + { + "dpt":"14.067", + "name":"DPT_Value_Surface_Tension" + }, + { + "dpt":"14.068", + "name":"DPT_Value_Common_Temperature" + }, + { + "dpt":"14.069", + "name":"DPT_Value_Absolute_Temperature" + }, + { + "dpt":"14.070", + "name":"DPT_Value_TemperatureDifference" + }, + { + "dpt":"14.071", + "name":"DPT_Value_Thermal_Capacity" + }, + { + "dpt":"14.072", + "name":"DPT_Value_Thermal_Conductivity" + }, + { + "dpt":"14.073", + "name":"DPT_Value_ThermoelectricPower" + }, + { + "dpt":"14.074", + "name":"DPT_Value_Time" + }, + { + "dpt":"14.075", + "name":"DPT_Value_Torque" + }, + { + "dpt":"14.076", + "name":"DPT_Value_Volume" + }, + { + "dpt":"14.077", + "name":"DPT_Value_Volume_Flux" + }, + { + "dpt":"14.078", + "name":"DPT_Value_Weight" + }, + { + "dpt":"14.079", + "name":"DPT_Value_Work" + }, + { + "dpt":"15.000", + "name":"DPT_Access_Data" + }, + { + "dpt":"16.000", + "name":"DPT_String_ASCII" + }, + { + "dpt":"16.001", + "name":"DPT_String_8859_1" + }, + { + "dpt":"17.001", + "name":"DPT_SceneNumber" + }, + { + "dpt":"18.001", + "name":"DPT_SceneControl" + }, + { + "dpt":"19.001", + "name":"DPT_DateTime" + }, + { + "dpt":"20.001", + "name":"DPT_SCLOMode" + }, + { + "dpt":"20.002", + "name":"DPT_BuildingMode" + }, + { + "dpt":"20.003", + "name":"DPT_OccMode" + }, + { + "dpt":"20.004", + "name":"DPT_Priority" + }, + { + "dpt":"20.005", + "name":"DPT_LightApplicationMode" + }, + { + "dpt":"20.006", + "name":"DPT_ApplicationArea" + }, + { + "dpt":"20.007", + "name":"DPT_AlarmClassType" + }, + { + "dpt":"20.008", + "name":"DPT_PSUMode" + }, + { + "dpt":"20.011", + "name":"DPT_ErrorClass_System" + }, + { + "dpt":"20.012", + "name":"DPT_ErrorClass_HVAC" + }, + { + "dpt":"20.013", + "name":"DPT_Time_Delay" + }, + { + "dpt":"20.014", + "name":"DPT_Beaufort_Wind_Force_Scale" + }, + { + "dpt":"20.017", + "name":"DPT_SensorSelect" + }, + { + "dpt":"20.100", + "name":"DPT_FuelType" + }, + { + "dpt":"20.101", + "name":"DPT_BurnerType" + }, + { + "dpt":"20.102", + "name":"DPT_HVACMode" + }, + { + "dpt":"20.103", + "name":"DPT_DHWMode" + }, + { + "dpt":"20.104", + "name":"DPT_LoadPriority" + }, + { + "dpt":"20.105", + "name":"DPT_HVACContrMode" + }, + { + "dpt":"20.106", + "name":"DPT_HVACEmergMode" + }, + { + "dpt":"20.107", + "name":"DPT_ChangeoverMode" + }, + { + "dpt":"20.108", + "name":"DPT_ValveMode" + }, + { + "dpt":"20.109", + "name":"DPT_DamperMode" + }, + { + "dpt":"20.110", + "name":"DPT_HeaterMode" + }, + { + "dpt":"20.111", + "name":"DPT_FanMode" + }, + { + "dpt":"20.112", + "name":"DPT_MasterSlaveMode" + }, + { + "dpt":"20.113", + "name":"DPT_StatusRoomSetp" + }, + { + "dpt":"20.600", + "name":"DPT_Behaviour_Lock_Unlock" + }, + { + "dpt":"20.601", + "name":"DPT_Behaviour_Bus_Power_Up_Down" + }, + { + "dpt":"20.1000", + "name":"DPT_CommMode" + }, + { + "dpt":"20.1001", + "name":"DPT_AddInfoTypes" + }, + { + "dpt":"20.1002", + "name":"DPT_RF_ModeSelect" + }, + { + "dpt":"20.1003", + "name":"DPT_RF_FilterSelect" + }, + { + "dpt":"21.001", + "name":"DPT_StatusGen" + }, + { + "dpt":"21.002", + "name":"DPT_Device_Control" + }, + { + "dpt":"21.100", + "name":"DPT_ForceSign" + }, + { + "dpt":"21.101", + "name":"DPT_ForceSignCool" + }, + { + "dpt":"21.102", + "name":"DPT_StatusRHC" + }, + { + "dpt":"21.103", + "name":"DPT_StatusSDHWC" + }, + { + "dpt":"21.104", + "name":"DPT_FuelTypeSet" + }, + { + "dpt":"21.105", + "name":"DPT_StatusRCC" + }, + { + "dpt":"21.106", + "name":"DPT_StatusAHU" + }, + { + "dpt":"21.1000", + "name":"DPT_RF_ModeInfo" + }, + { + "dpt":"21.1001", + "name":"DPT_RF_FilterInfo" + }, + { + "dpt":"21.1010", + "name":"DPT_Channel_Activation_8" + }, + { + "dpt":"22.100", + "name":"DPT_StatusDHWC" + }, + { + "dpt":"22.101", + "name":"DPT_StatusRHCC" + }, + { + "dpt":"22.1000", + "name":"DPT_Media" + }, + { + "dpt":"22.1010", + "name":"DPT_Channel_Activation_16" + }, + { + "dpt":"23.001", + "name":"DPT_OnOff_Action" + }, + { + "dpt":"23.002", + "name":"DPT_Alarm_Reaction" + }, + { + "dpt":"23.003", + "name":"DPT_UpDown_Action" + }, + { + "dpt":"23.102", + "name":"DPT_HVAC_PB_Action" + }, + { + "dpt":"24.001", + "name":"DPT_VarString_8859_1" + }, + { + "dpt":"25.1000", + "name":"DPT_DoubleNibble" + }, + { + "dpt":"26.001", + "name":"DPT_SceneInfo" + }, + { + "dpt":"27.001", + "name":"DPT_CombinedInfoOnOff" + }, + { + "dpt":"28.001", + "name":"DPT_UTF-8" + }, + { + "dpt":"29.010", + "name":"DPT_ActiveEnergy_V64" + }, + { + "dpt":"29.011", + "name":"DPT_ApparantEnergy_V64" + }, + { + "dpt":"29.012", + "name":"DPT_ReactiveEnergy_V64" + }, + { + "dpt":"30.1010", + "name":"DPT_Channel_Activation_24" + }, + { + "dpt":"31.101", + "name":"DPT_PB_Action_HVAC_Extended" + }, + { + "dpt":"200.100", + "name":"DPT_Heat/Cool_Z" + }, + { + "dpt":"200.101", + "name":"DPT_BinaryValue_Z" + }, + { + "dpt":"201.100", + "name":"DPT_HVACMode_Z" + }, + { + "dpt":"201.102", + "name":"DPT_DHWMode_Z" + }, + { + "dpt":"201.104", + "name":"DPT_HVACContrMode_Z" + }, + { + "dpt":"201.105", + "name":"DPT_EnablH/Cstage_Z" + }, + { + "dpt":"201.107", + "name":"DPT_BuildingMode_Z" + }, + { + "dpt":"201.108", + "name":"DPT_OccMode_Z" + }, + { + "dpt":"201.109", + "name":"DPT_HVACEmergMode_Z" + }, + { + "dpt":"202.001", + "name":"DPT_RelValue_Z" + }, + { + "dpt":"202.002", + "name":"DPT_UCountValue8_Z" + }, + { + "dpt":"203.002", + "name":"DPT_TimePeriodMsec_Z" + }, + { + "dpt":"203.003", + "name":"DPT_TimePeriod10Msec_Z" + }, + { + "dpt":"203.004", + "name":"DPT_TimePeriod100Msec_Z" + }, + { + "dpt":"203.005", + "name":"DPT_TimePeriodSec_Z" + }, + { + "dpt":"203.006", + "name":"DPT_TimePeriodMin_Z" + }, + { + "dpt":"203.007", + "name":"DPT_TimePeriodHrs_Z" + }, + { + "dpt":"203.011", + "name":"DPT_UFlowRateLiter/h_Z" + }, + { + "dpt":"203.012", + "name":"DPT_UCountValue16_Z" + }, + { + "dpt":"203.013", + "name":"DPT_UElCurrent?A_Z" + }, + { + "dpt":"203.014", + "name":"DPT_PowerKW_Z" + }, + { + "dpt":"203.015", + "name":"DPT_AtmPressureAbs_Z" + }, + { + "dpt":"203.017", + "name":"DPT_PercentU16_Z" + }, + { + "dpt":"203.100", + "name":"DPT_HVACAirQual_Z" + }, + { + "dpt":"203.101", + "name":"DPT_WindSpeed_Z" + }, + { + "dpt":"203.102", + "name":"DPT_SunIntensity_Z" + }, + { + "dpt":"203.104", + "name":"DPT_HVACAirFlowAbs_Z" + }, + { + "dpt":"204.001", + "name":"DPT_RelSignedValue_Z" + }, + { + "dpt":"205.002", + "name":"DPT_DeltaTimeMsec_Z" + }, + { + "dpt":"205.003", + "name":"DPT_DeltaTime10Msec_Z" + }, + { + "dpt":"205.004", + "name":"DPT_DeltaTime100Msec_Z" + }, + { + "dpt":"205.005", + "name":"DPT_DeltaTimeSec_Z" + }, + { + "dpt":"205.006", + "name":"DPT_DeltaTimeMin_Z" + }, + { + "dpt":"205.007", + "name":"DPT_DeltaTimeHrs_Z" + }, + { + "dpt":"205.100", + "name":"DPT_TempHVACAbs_Z" + }, + { + "dpt":"205.101", + "name":"DPT_TempHVACRel_Z" + }, + { + "dpt":"205.102", + "name":"DPT_HVACAirFlowRel_Z" + }, + { + "dpt":"206.100", + "name":"DPT_HVACModeNext" + }, + { + "dpt":"206.102", + "name":"DPT_DHWModeNext" + }, + { + "dpt":"206.104", + "name":"DPT_OccModeNext" + }, + { + "dpt":"206.105", + "name":"DPT_BuildingModeNext" + }, + { + "dpt":"207.100", + "name":"DPT_StatusBUC" + }, + { + "dpt":"207.101", + "name":"DPT_LockSign" + }, + { + "dpt":"207.102", + "name":"DPT_ValueDemBOC" + }, + { + "dpt":"207.104", + "name":"DPT_ActPosDemAbs" + }, + { + "dpt":"207.105", + "name":"DPT_StatusAct" + }, + { + "dpt":"209.100", + "name":"DPT_StatusHPM" + }, + { + "dpt":"209.101", + "name":"DPT_TempRoomDemAbs" + }, + { + "dpt":"209.102", + "name":"DPT_StatusCPM" + }, + { + "dpt":"209.103", + "name":"DPT_StatusWTC" + }, + { + "dpt":"210.100", + "name":"DPT_TempFlowWaterDemAbs" + }, + { + "dpt":"211.100", + "name":"DPT_EnergyDemWater" + }, + { + "dpt":"212.100", + "name":"DPT_TempRoomSetpSetShift[3]" + }, + { + "dpt":"212.101", + "name":"DPT_TempRoomSetpSet[3]" + }, + { + "dpt":"213.100", + "name":"DPT_TempRoomSetpSet[4]" + }, + { + "dpt":"213.101", + "name":"DPT_TempDHWSetpSet[4]" + }, + { + "dpt":"213.102", + "name":"DPT_TempRoomSetpSetShift[4]" + }, + { + "dpt":"214.100", + "name":"DPT_PowerFlowWaterDemHPM" + }, + { + "dpt":"214.101", + "name":"DPT_PowerFlowWaterDemCPM" + }, + { + "dpt":"215.100", + "name":"DPT_StatusBOC" + }, + { + "dpt":"215.101", + "name":"DPT_StatusCC" + }, + { + "dpt":"216.100", + "name":"DPT_SpecHeatProd" + }, + { + "dpt":"217.001", + "name":"DPT_Version" + }, + { + "dpt":"218.001", + "name":"DPT_VolumeLiter_Z" + }, + { + "dpt":"219.001", + "name":"DPT_AlarmInfo" + }, + { + "dpt":"220.100", + "name":"DPT_TempHVACAbsNext" + }, + { + "dpt":"221.001", + "name":"DPT_SerNum" + }, + { + "dpt":"222.100", + "name":"DPT_TempRoomSetpSetF16[3]" + }, + { + "dpt":"222.101", + "name":"DPT_TempRoomSetpSetShiftF16[3]" + }, + { + "dpt":"223.100", + "name":"DPT_EnergyDemAir" + }, + { + "dpt":"224.100", + "name":"DPT_TempSupply" + }, + { + "dpt":"225.001", + "name":"DPT_ScalingSpeed" + }, + { + "dpt":"225.002", + "name":"DPT_Scaling_Step_Time" + }, + { + "dpt":"229.001", + "name":"DPT_MeteringValue" + }, + { + "dpt":"230.1000", + "name":"DPT_MBus_Address" + }, + { + "dpt":"231.001", + "name":"DPT_Locale_ASCII" + }, + { + "dpt":"232.600", + "name":"DPT_Colour_RGB" + }, + { + "dpt":"234.001", + "name":"DPT_LanguageCodeAlpha2_ASCII" + }, + { + "dpt":"234.002", + "name":"DPT_RegionCodeAlpha2_ASCII" + } +] \ No newline at end of file Modified: CometVisu/trunk/visu/edit/save_config.php =================================================================== --- CometVisu/trunk/visu/edit/save_config.php 2010-11-18 19:19:29 UTC (rev 139) +++ CometVisu/trunk/visu/edit/save_config.php 2010-11-19 21:43:22 UTC (rev 140) @@ -28,7 +28,7 @@ // JSON dekodieren und PHP-geeignetes Array-Object-Kram daraus erzeugen $objConfig = json_decode(stripslashes($strJson)); -/** die alten Mappings und Styles übernehmen */ +/** die alten Mappings und stylings übernehmen */ $objDOM = new DOMDocument("1.0", "UTF-8"); $objDOM->load($strConfig); $objDOM->formatOutput = true; @@ -40,7 +40,7 @@ foreach ($objTmp as $objTmpNode) { $objPages->removeChild($objTmpNode); } - /** mappings und styles übernommen */ + /** mappings und stylings übernommen */ $objPages->appendChild(createDOMFromJSON($objConfig)); $objDOM->appendChild($objPages); Modified: CometVisu/trunk/visu/edit/visuconfig_edit.js =================================================================== --- CometVisu/trunk/visu/edit/visuconfig_edit.js 2010-11-18 19:19:29 UTC (rev 139) +++ CometVisu/trunk/visu/edit/visuconfig_edit.js 2010-11-19 21:43:22 UTC (rev 140) @@ -24,6 +24,7 @@ } var addressesCache; +var dptCache; jQuery(document).ready(function() { @@ -38,9 +39,32 @@ } }); - // get all GA from the server - $.getJSON('edit/get_addresses.php', function(data) { addressesCache = data}); + // get all GAs from the server + $.ajax({ + url: "edit/get_addresses.php", + type: "GET", + dataType: "json", + success: function(data) { + addressesCache = data; + }, + error: function(xhr, textStatus, e) { + addressesCache = false; + } + }); + // get all known dpt from the server + $.ajax({ + url: "edit/dpt_list.json", + type: "GET", + dataType: "json", + success: function(data) { + dptCache = data; + }, + error: function(xhr, textStatus, e) { + dptCache = false; + } + }); + jQuery("#pages").bind("done", function() { $("#pages hr, #pages br").each(function() { if ($(this).closest(".widget").length == 0) { @@ -116,18 +140,6 @@ $("#addMaster").triggerHandler("show"); }); - - jQuery("#pages").bind("done", function() { - // die Selectlisten vorbelegen - $("#addMaster #add_mapping, #addMaster #add_style").empty().append($("<option />").attr("value", "").html("-")); - jQuery.each(mappings, function(i, element) { - $("#addMaster #add_mapping").append($("<option />").attr("value", i).html(i)); - }); - jQuery.each(styles, function(i, element) { - $("#addMaster #add_style").append($("<option />").attr("value", i).html(i)); - }); - }); - }); @@ -180,16 +192,19 @@ var container = $("#addMaster div.inputs"); var values = $.extend({}, $("#addMaster").data("widgetdata")); - // alte Werte zwischenspeichern - container.find(":input").each(function() { - if ($(this).val() != "") { - var name = $(this).data("name"); - values[name] = $(this).val(); - } - }) + if (!$("#pages .inedit").is(".widget")) { + // alte Werte zwischenspeichern + container.find(":input").each(function() { + if ($(this).val() != "") { + var name = $(this).data("name"); + values[name] = $(this).val(); + } + }) + } container.empty(); - if (creator.content == "string") { + if (typeof creator.content.type != "undefined" && creator.content.type == "string") { + var element = $("<div />").addClass("add_input").addClass("content") .append($("<label />").attr("for", "add_textContent").html("text-content")) .append($("<input type=\"text\" id=\"add_textContent\"/>")); @@ -197,6 +212,8 @@ element.find("input").val(values["textContent"]); } + element.find(":input").data("required", creator.content.required); + container.append(element); delete element; } @@ -207,24 +224,59 @@ switch (e.type) { case "address": - element.append($("<select id=\"add_" + index + "\" />") - .append($("<option />").attr("value", "").html("-"))); + if (typeof addressesCache == undefined || addressesCache == false) { + // appearantly we were unable to load the list of addresses from the server + // we will provide an input-field instead + element.append($("<input id=\"add_" + index + "\" />")); + if (typeof values[index] != "undefined") { + // pre-set the value + element.find(":input").val(values[index]); + } + } else { + element.append($("<select id=\"add_" + index + "\" />") + .append($("<option />").attr("value", "").html("-"))); - element.find("select:first").append(getAddressesObject()); + element.find("select:first").append(getAddressesObject()); - element.find("select").bind("change", function() { - // on changing the address, the coresponding datatype-field is - // automagically set - var name = $(this).attr("id"); - var dptFieldName = name.replace(/_?address$/i, "_datatype"); - var dpt = $(this).find("option:selected").attr("class").replace(/[^dpt_\d+\.\d+]*/, "").replace(/^dpt_/, ""); - $("#addMaster div.inputs #" + dptFieldName).val(dpt); - }); + element.find("select").bind("change", function() { + // on changing the address, the coresponding datatype-field is + // automagically set + var name = $(this).attr("id"); + var dptFieldName = name.replace(/_?address$/i, "_datatype"); + var dpt = $(this).find("option:selected").attr("class").replace(/[^dpt_\d+\.\d+]*/, "").replace(/^dpt_/, ""); + if ($("#addMaster #" + dptFieldName).is("input")) { + $("#addMaster div.inputs #" + dptFieldName).val(dpt); + } else if ($("#addMaster #" + dptFieldName).is("select")) { + $("#addMaster #" + dptFieldName).find("option[value=" + dpt + "]").attr("selected", "selected"); + } + }); - if (typeof values[index] != "undefined") { - element.find("option[value=" + values[index] + "]").attr("selected", "selected"); + if (typeof values[index] != "undefined") { + element.find("option[value=" + values[index] + "]").attr("selected", "selected"); + } + } + break; + case "datatype": + if (typeof dptCache == undefined || dptCache == false) { + // appearantly we were unable to load the list of datatypes from the server + // we will provide an input-field instead + element.append($("<input id=\"add_" + index + "\" />")); + if (typeof values[index] != "undefined") { + // pre-set the value + element.find(":input").val(values[index]); + } + } else { + element.append($("<select id=\"add_" + index + "\" />") + .append($("<option />").attr("value", "").html("-"))); + element.find("select:first").append(getDPTObject()); + + if (typeof values[index] != "undefined") { + element.find("option[value=" + values[index] + "]").attr("selected", "selected"); + } + + } break; case "mapping": @@ -240,11 +292,11 @@ break; - case "style": - element.append($("<select id=\"add_style\" />") + case "styling": + element.append($("<select id=\"add_styling\" />") .append($("<option />").attr("value", "").html("-"))); - jQuery.each(styles, function(i, tmp) { - element.find("select#add_style").append($("<option />").attr("value", i).html(i)); + jQuery.each(stylings, function(i, tmp) { + element.find("select#add_styling").append($("<option />").attr("value", i).html(i)); }); if (typeof values[index] != "undefined") { @@ -252,7 +304,8 @@ } break; - + case "datatype": + break; default: element.append($("<input type=\"text\" id=\"add_" + index + "\" />")); @@ -292,6 +345,8 @@ name = $(this).data("name"); } else if ($(this).closest("div.add_input").hasClass("content")) { name = "textContent"; + // preset text-content to be empty + dataObject[name] = ""; } if ($(this).val() != "") { @@ -363,6 +418,7 @@ case "address": return Boolean(val.match(/^[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{1,3}$/) != null); break; + case "datatype": case "numeric": return Boolean(val.match(/^\d+([\.,]\d+)?$/g)); break; @@ -373,8 +429,8 @@ case "mapping": return Boolean(typeof mappings[val] != "undefined"); break; - case "style": - return Boolean(typeof styles[val] != "undefined"); + case "styling": + return Boolean(typeof stylings[val] != "undefined"); break; } } @@ -508,4 +564,24 @@ cachedAddressesObject = element.children(); return cachedAddressesObject; +} + +var cachedDPTObject; +function getDPTObject() { + + if (typeof cachedDPTObject == "object") { + return cachedDPTObject.clone(); + } + + element = $("<select />"); + + $.each(dptCache, function(i, dptDefinition) { + element.append($("<option />").attr("value", dptDefinition.dpt) + .html("" + dptDefinition.dpt + ": " + dptDefinition.name) + ); + }); + + cachedDPTObject = element.children(); + + return cachedDPTObject; } \ No newline at end of file Modified: CometVisu/trunk/visu/lib/templateengine.js =================================================================== --- CometVisu/trunk/visu/lib/templateengine.js 2010-11-18 19:19:29 UTC (rev 139) +++ CometVisu/trunk/visu/lib/templateengine.js 2010-11-19 21:43:22 UTC (rev 140) @@ -18,7 +18,7 @@ var design = new VisuDesign_Custom(); var mappings = {}; // store the mappings -var styles = {}; // store the styles +var stylings = {}; // store the stylings var ga_list = []; @@ -39,16 +39,16 @@ element.data( 'value', value ); $('.value', element).text( map( value, element ) ); - var style = element.data('style'); - if( style && styles[style] && (styles[style][value] || styles[style]['range']) ) + var styling = element.data('styling'); + if( styling && stylings[styling] && (stylings[styling][value] || stylings[styling]['range']) ) { - if( styles[style]['range'] ) value = parseFloat( value ); + if( stylings[styling]['range'] ) value = parseFloat( value ); element.removeClass(); - if( styles[style][value] ) + if( stylings[styling][value] ) { - element.addClass( 'actor ' + GA + ' ' + styles[style][value] ); + element.addClass( 'actor ' + GA + ' ' + stylings[styling][value] ); } else { - var range = styles[style]['range']; + var range = stylings[styling]['range']; var not_found = true; for( var min in range ) { @@ -184,17 +184,17 @@ }); }); - // then the styles - $( 'pages > styles style', xml ).each( function(i){ + // then the stylings + $( 'pages > stylings styling', xml ).each( function(i){ var name = $(this).attr('name'); - styles[ name ] = {}; + stylings[ name ] = {}; $(this).find('entry').each( function(){ if( $(this).attr('value') ) { - styles[ name ][ $(this).attr('value') ] = $(this).text(); + stylings[ name ][ $(this).attr('value') ] = $(this).text(); } else { // a range - if( ! styles[ name ][ 'range' ] ) styles[ name ][ 'range' ] = {}; - styles[ name ][ 'range' ][ parseFloat($(this).attr('range_min')) ] = + if( ! stylings[ name ][ 'range' ] ) stylings[ name ][ 'range' ] = {}; + stylings[ name ][ 'range' ][ parseFloat($(this).attr('range_min')) ] = [ parseFloat( $(this).attr('range_max') ), $(this).text() ]; } }); Modified: CometVisu/trunk/visu/lib/visudesign_custom.js =================================================================== --- CometVisu/trunk/visu/lib/visudesign_custom.js 2010-11-18 19:19:29 UTC (rev 139) +++ CometVisu/trunk/visu/lib/visudesign_custom.js 2010-11-19 21:43:22 UTC (rev 140) @@ -49,26 +49,27 @@ var value = $('link[href*="designs"]').attr('href').split('/')[1]; actor += '<div class="value">' + value + '</div>'; actor += '</div>'; - ret_val.append( label ).append( $(actor).data( { - 'mapping' : $(page).attr('mapping'), - 'style' : $(page).attr('style'), - 'value' : value, - 'type' : 'toggle' - } ).bind('click',designToggleAction) ); + ret_val.append(label).append($(actor) + .data({ + 'mapping' : $(page).attr('mapping'), + 'styling' : $(page).attr('styling'), + 'value' : value, + 'type' : 'toggle' + }) + .bind('click', function() { + var designs = [ 'pure', 'discreet' ]; + var oldDesign = $('.value',this).text(); + var newDesign = designs[ (designs.indexOf(oldDesign) + 1) % designs.length ]; + $('.value',this).text(newDesign); + $('link[href*="designs"]').each(function(){ + this.href = this.href.replace( oldDesign, newDesign ); + }); + }) + ); return ret_val; }, attributes: { }, - content: "string" + content: {type: "string", required: true} }); -function designToggleAction() -{ - var designs = [ 'pure', 'discreet' ]; - var oldDesign = $('.value',this).text(); - var newDesign = designs[ (designs.indexOf(oldDesign) + 1) % designs.length ]; - $('.value',this).text(newDesign); - $('link[href*="designs"]').each(function(){ - this.href = this.href.replace( oldDesign, newDesign ); - }); -} Modified: CometVisu/trunk/visu/lib/visudesign_pure.js =================================================================== --- CometVisu/trunk/visu/lib/visudesign_pure.js 2010-11-18 19:19:29 UTC (rev 139) +++ CometVisu/trunk/visu/lib/visudesign_pure.js 2010-11-19 21:43:22 UTC (rev 140) @@ -92,7 +92,7 @@ attributes: { align: {type: "string", required: false} }, - content: "string" + content: {type: "string", required: true} }); this.addCreator("info", { @@ -110,19 +110,19 @@ 'GA': $(page).attr('address'), 'datatype': $(page).attr('datatype'), 'mapping' : $(page).attr('mapping'), - 'style' : $(page).attr('style') + 'styling' : $(page).attr('styling') } ) ); return ret_val; }, attributes: { address: {type: "address", required: true}, - datatype: {type: "numeric", required: true}, + datatype: {type: "datatype", required: true}, pre: {type: "string", required: false}, post: {type: "string", required: false}, mapping: {type: "mapping", required: false}, - style: {type: "style", required: false} + styling: {type: "styling", required: false} }, - content: "string" + content: {type: "string", required: true} }); this.addCreator("shade", this.getCreator("info")); @@ -144,7 +144,7 @@ 'GA': $(page).attr('address'), 'datatype': $(page).attr('datatype'), 'mapping' : $(page).attr('mapping'), - 'style' : $(page).attr('style'), + 'styling' : $(page).attr('styling'), 'min' : min, 'max' : max, 'step' : step, @@ -155,16 +155,16 @@ }, attributes: { address: {type: "address", required: true}, - datatype: {type: "numeric", required: true}, + datatype: {type: "datatype", required: true}, response_address: {type: "address", required: true}, - response_datatype: {type: "numeric", required: true}, + response_datatype: {type: "datatype", required: true}, min: {type: "numeric", required: false}, max: {type: "numeric", required: false}, step: {type: "numeric", required: false}, mapping: {type: "mapping", required: false}, - style: {type: "style", required: false} + styling: {type: "styling", required: false} }, - content: "string" + content: {type: "string", required: true} }); this.addCreator("slide", this.getCreator("dim")); @@ -185,22 +185,22 @@ 'GA': $(page).attr('address'), 'datatype': $(page).attr('datatype'), 'mapping' : $(page).attr('mapping'), - 'style' : $(page).attr('style'), + 'styling' : $(page).attr('styling'), 'type' : 'toggle' } ).bind('click',switchAction) ); return ret_val; }, attributes: { address: {type: "address", required: true}, - datatype: {type: "numeric", required: true}, + datatype: {type: "datatype", required: true}, response_address: {type: "address", required: true}, - response_datatype: {type: "numeric", required: true}, + response_datatype: {type: "datatype", required: true}, pre: {type: "string", required: false}, post: {type: "string", required: false}, mapping: {type: "mapping", required: false}, - style: {type: "style", required: false} + styling: {type: "styling", required: false} }, - content: "string" + content: {type: "string", required: true} }); this.addCreator("toggle", this.getCreator("switch")); @@ -222,10 +222,10 @@ if( $(page).attr('post') ) actor += $(page).attr('post'); actor += '</div>'; ret_val.append( label ).append( $(actor).data( { - 'GA': $(page).attr('address'), + 'GA' : $(page).attr('address'), 'datatype': $(page).attr('datatype'), 'mapping' : $(page).attr('mapping'), - 'style' : $(page).attr('style'), + 'styling' : $(page).attr('styling'), 'type' : 'trigger', 'sendValue': value } ).bind('click',triggerAction) ); @@ -234,14 +234,14 @@ }, attributes: { address: {type: "address", required: true}, - datatype: {type: "numeric", required: true}, + datatype: {type: "datatype", required: true}, value: {type: "string", required: true}, pre: {type: "string", required: false}, post: {type: "string", required: false}, mapping: {type: "mapping", required: false}, - style: {type: "style", required: false} + styling: {type: "styling", required: false} }, - content: "string" + content: {type: "string", required: true} }); this.addCreator("image", { @@ -266,7 +266,7 @@ height: {type: "string", required: false}, refresh: {type: "numeric", required: false} }, - content: "string" + content: {type: "string", required: false} }); this.addCreator("video", { @@ -291,7 +291,7 @@ height: {type: "string", required: false}, refresh: {type: "numeric", required: false} }, - content: "string" + content: {type: "string", required: true} }); this.addCreator("unknown", { @@ -302,7 +302,7 @@ }, attributes: { }, - content: "string" + content: {type: "string", required: true} }); this.switchAction = function() { Modified: CometVisu/trunk/visu/visu_config.xml =================================================================== --- CometVisu/trunk/visu/visu_config.xml 2010-11-18 19:19:29 UTC (rev 139) +++ CometVisu/trunk/visu/visu_config.xml 2010-11-19 21:43:22 UTC (rev 140) @@ -15,24 +15,24 @@ <entry range_min="0" range_max="1e99">Positiv</entry> </mapping> </mappings> - <styles> - <style name="RedGreen"> + <stylings> + <styling name="RedGreen"> <entry value="0">red</entry> <entry value="1">green</entry> - </style> - <style name="GreenRed"> + </styling> + <styling name="GreenRed"> <entry value="0">green</entry> <entry value="1">red</entry> - </style> - <style name="BluePurpleRed"> + </styling> + <styling name="BluePurpleRed"> <entry range_min="-100" range_max="0" >blue</entry> <entry value="0" >purple</entry> <entry range_min="0" range_max="100">red</entry> - </style> - </styles> + </styling> + </stylings> <page name="Übersicht" flavour="orange"> <text align="center">Willkommen bei der CometVisu!</text> - <toggle address="1/0/2" datatype="1.001" response_address="1/0/2" mapping="OnOff" style="RedGreen" >Terrase Licht</toggle> + <toggle address="1/0/2" datatype="1.001" response_address="1/0/2" mapping="OnOff" styling="RedGreen" >Terrase Licht</toggle> <trigger address="1/0/2" datatype="1.001" value="0" mapping="OnOff">Terrase Licht 0</trigger> <trigger address="1/0/2" datatype="1.001" value="1" mapping="OnOff">Terrase Licht 1</trigger> <trigger address="2/2/5" datatype="5.001" value="0" >Rolladen Licht 0</trigger> @@ -42,8 +42,8 @@ <dim address="1/2/51" datatype="5.010" response_address="1/3/51" response_datatype="5.010">Dim Esstisch</dim> <shade address="2/4/5" datatype="5.001">Rollladen links</shade> <slide address="12/4/250" datatype="9" min="-18" max="26">Slide</slide> - <info address="12/4/250" datatype="9" style="BluePurpleRed">Slide Info</info> - <info address="12/4/250" datatype="9" style="BluePurpleRed" mapping="Sign">Slide Info</info> + <info address="12/4/250" datatype="9" styling="BluePurpleRed">Slide Info</info> + <info address="12/4/250" datatype="9" styling="BluePurpleRed" mapping="Sign">Slide Info</info> <designtoggle>Change design</designtoggle> <line /> <image src="icon/comet_128_ff8000.png" >Ein Bild</image> @@ -55,23 +55,23 @@ <line /> <info address="1/0/41" datatype="1.000" mapping="OnOff">Treppenlicht</info> <page name="Fenster Kontakte" flavour="blue"> - <info address="4/3/10" datatype="1" mapping="OpenClose" style="GreenRed">Bad EG Reed Fenster</info> - <info address="4/3/20" datatype="1.001" mapping="OpenClose" style="GreenRed">WC Reed Fenster</info> - <info address="4/3/30" datatype="1" mapping="OpenClose" style="GreenRed">Schlafen Reed Fenster links</info> - <info address="4/3/31" datatype="1.001" mapping="OpenClose" style="GreenRed">Schlafen Reed Fenster rechts</info> - <info address="4/3/32" datatype="1.001" mapping="OpenClose" style="GreenRed">Schlafen Reed Tuere</info> - <info address="4/3/40" datatype="1.001" mapping="OpenClose" style="GreenRed">Kueche Reed Fenster</info> - <info address="4/3/50" datatype="1.001" mapping="OpenClose" style="GreenRed">Wohnzimmer Reed Tuere Essen</info> - <info address="4/3/51" datatype="1.001" mapping="OpenClose" style="GreenRed">Wohnzimmer Reed Schiebetuere</info> - <info address="4/3/52" datatype="1.001" mapping="OpenClose" style="GreenRed">Wohnzimmer Reed Tuere Mitte</info> - <info address="4/3/53" datatype="1.001" mapping="OpenClose" style="GreenRed">Wohnzimmer Reed Doppeltuere links</info> - <info address="4/3/54" datatype="1.001" mapping="OpenClose" style="GreenRed">Wohnzimmer Reed Doppeltuere rechts</info> - <info address="4/3/70" datatype="1.001" mapping="OpenClose" style="GreenRed">Diele EG Reed Tuere</info> - <info address="4/3/71" datatype="1.001" pre="!" mapping="OpenClose" style="GreenRed">Diele EG Reed Riegel</info> - <info address="4/3/110" datatype="1.001" mapping="OpenClose" style="GreenRed">Diele UG Reed Tuere</info> - <info address="4/3/111" datatype="1.001" pre="!" mapping="OpenClose" style="GreenRed">Diele UG Reed Riegel</info> - <info address="4/3/120" datatype="1.001" mapping="OpenClose" style="GreenRed">Bad UG Reed Fenster</info> - <info address="4/3/130" datatype="1.001" mapping="OpenClose" style="GreenRed">Hobby1 Reed Fenster</info> + <info address="4/3/10" datatype="1" mapping="OpenClose" styling="GreenRed">Bad EG Reed Fenster</info> + <info address="4/3/20" datatype="1.001" mapping="OpenClose" styling="GreenRed">WC Reed Fenster</info> + <info address="4/3/30" datatype="1" mapping="OpenClose" styling="GreenRed">Schlafen Reed Fenster links</info> + <info address="4/3/31" datatype="1.001" mapping="OpenClose" styling="GreenRed">Schlafen Reed Fenster rechts</info> + <info address="4/3/32" datatype="1.001" mapping="OpenClose" styling="GreenRed">Schlafen Reed Tuere</info> + <info address="4/3/40" datatype="1.001" mapping="OpenClose" styling="GreenRed">Kueche Reed Fenster</info> + <info address="4/3/50" datatype="1.001" mapping="OpenClose" styling="GreenRed">Wohnzimmer Reed Tuere Essen</info> + <info address="4/3/51" datatype="1.001" mapping="OpenClose" styling="GreenRed">Wohnzimmer Reed Schiebetuere</info> + <info address="4/3/52" datatype="1.001" mapping="OpenClose" styling="GreenRed">Wohnzimmer Reed Tuere Mitte</info> + <info address="4/3/53" datatype="1.001" mapping="OpenClose" styling="GreenRed">Wohnzimmer Reed Doppeltuere links</info> + <info address="4/3/54" datatype="1.001" mapping="OpenClose" styling="GreenRed">Wohnzimmer Reed Doppeltuere rechts</info> + <info address="4/3/70" datatype="1.001" mapping="OpenClose" styling="GreenRed">Diele EG Reed Tuere</info> + <info address="4/3/71" datatype="1.001" pre="!" mapping="OpenCl... [truncated message content] |
From: <ni...@us...> - 2010-11-18 19:19:36
|
Revision: 139 http://openautomation.svn.sourceforge.net/openautomation/?rev=139&view=rev Author: nilss1 Date: 2010-11-18 19:19:29 +0000 (Thu, 18 Nov 2010) Log Message: ----------- changed ID style Modified Paths: -------------- PyWireGate/trunk/lirc_connector/LIRC_Connector.py Modified: PyWireGate/trunk/lirc_connector/LIRC_Connector.py =================================================================== --- PyWireGate/trunk/lirc_connector/LIRC_Connector.py 2010-11-18 19:15:50 UTC (rev 138) +++ PyWireGate/trunk/lirc_connector/LIRC_Connector.py 2010-11-18 19:19:29 UTC (rev 139) @@ -74,7 +74,7 @@ try: raw, counter, button, channel = rawmsg.split() ## default "LIRC:channel_button - id = u"%s:%s_%s" % (self.instanceName,channel,button) + id = u"%s:%s:%s" % (self.instanceName,channel,button) self.WG.DATASTORE.update(id,int(counter,16)) id = u"%s:%s" % (self.instanceName,button) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-18 19:15:57
|
Revision: 138 http://openautomation.svn.sourceforge.net/openautomation/?rev=138&view=rev Author: nilss1 Date: 2010-11-18 19:15:50 +0000 (Thu, 18 Nov 2010) Log Message: ----------- Fixed some encoding issues Modified Paths: -------------- PyWireGate/trunk/WireGate.py PyWireGate/trunk/datastore.py PyWireGate/trunk/lirc_connector/LIRC_Connector.py Modified: PyWireGate/trunk/WireGate.py =================================================================== --- PyWireGate/trunk/WireGate.py 2010-11-18 16:01:07 UTC (rev 137) +++ PyWireGate/trunk/WireGate.py 2010-11-18 19:15:50 UTC (rev 138) @@ -63,7 +63,7 @@ 'logfile' : "%s/wiregated.log" % self.scriptpath, 'errorlog' : "%s/wiregated-error.log" % self.scriptpath, 'loglevel': 'info', - 'defaultencoding': 'UTF-8' + 'defaultencoding': 'iso-8859-15' } self.checkconfig("WireGate",defaultconfig) @@ -249,7 +249,7 @@ logger.setLevel(level) if filename: ## python handle logrotating - handler = log.logging.handlers.TimedRotatingFileHandler(filename,'MIDNIGHT',encoding=self.WG.config['WireGate']['defaultencoding'],backupCount=7) + handler = log.logging.handlers.TimedRotatingFileHandler(filename,'MIDNIGHT',encoding='UTF-8',backupCount=7) ## Handler if logrotate handles Logfiles #handler = logging.handlers.WatchedFileHandle(filename) Modified: PyWireGate/trunk/datastore.py =================================================================== --- PyWireGate/trunk/datastore.py 2010-11-18 16:01:07 UTC (rev 137) +++ PyWireGate/trunk/datastore.py 2010-11-18 19:15:50 UTC (rev 138) @@ -103,7 +103,7 @@ def load(self): self.debug("load DATASTORE") try: - db = codecs.open(self.WG.config['WireGate']['datastore'],"r",encoding=self.WG.config['WireGate']['defaultencoding']) + db = codecs.open(self.WG.config['WireGate']['datastore'],"r",encoding='UTF-8') loaddict = json.load(db) db.close() for name, obj in loaddict.items(): @@ -145,7 +145,7 @@ 'config' : obj.config, 'connected' : obj.connected } - dbfile = codecs.open(self.WG.config['WireGate']['datastore'],"w",encoding=self.WG.config['WireGate']['defaultencoding']) + dbfile = codecs.open(self.WG.config['WireGate']['datastore'],"w",encoding='UTF-8') utfdb = json.dumps(savedict,dbfile,ensure_ascii=False,sort_keys=True,indent=3) dbfile.write(utfdb) dbfile.close() Modified: PyWireGate/trunk/lirc_connector/LIRC_Connector.py =================================================================== --- PyWireGate/trunk/lirc_connector/LIRC_Connector.py 2010-11-18 16:01:07 UTC (rev 137) +++ PyWireGate/trunk/lirc_connector/LIRC_Connector.py 2010-11-18 19:15:50 UTC (rev 138) @@ -74,13 +74,13 @@ try: raw, counter, button, channel = rawmsg.split() ## default "LIRC:channel_button - id = "%s:%s_%s" % (self.instanceName,channel,button) - self.WG.DATASTORE.update(id,counter) + id = u"%s:%s_%s" % (self.instanceName,channel,button) + self.WG.DATASTORE.update(id,int(counter,16)) - id = "%s:%s" % (self.instanceName,button) + id = u"%s:%s" % (self.instanceName,button) ## dont't create it "LIRC:Button" if id in self.WG.DATASTORE.dataobjects: - self.WG.DATASTORE.update(id,channel) + self.WG.DATASTORE.update(id,channel.decode(self.WG.config['WireGate']['defaultencoding'])) except ValueError: self.debug("invalid Data %r" % rawmsg) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-18 16:01:15
|
Revision: 137 http://openautomation.svn.sourceforge.net/openautomation/?rev=137&view=rev Author: nilss1 Date: 2010-11-18 16:01:07 +0000 (Thu, 18 Nov 2010) Log Message: ----------- lirc-connector Added Paths: ----------- PyWireGate/trunk/lirc_connector/ PyWireGate/trunk/lirc_connector/LIRC_Connector.py PyWireGate/trunk/lirc_connector/__init__.py Added: PyWireGate/trunk/lirc_connector/LIRC_Connector.py =================================================================== --- PyWireGate/trunk/lirc_connector/LIRC_Connector.py (rev 0) +++ PyWireGate/trunk/lirc_connector/LIRC_Connector.py 2010-11-18 16:01:07 UTC (rev 137) @@ -0,0 +1,88 @@ +#!/usr/bin/env python +# -*- coding: iso8859-1 -*- +## ----------------------------------------------------- +## WireGate.py +## ----------------------------------------------------- +## Copyright (c) 2010, knx-user-forum e.V, All rights reserved. +## +## This program is free software; you can redistribute it and/or modify it under the terms +## of the GNU General Public License as published by the Free Software Foundation; either +## version 3 of the License, or (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +## without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +## See the GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License along with this program; +## if not, see <http://www.gnu.de/documents/gpl-3.0.de.html>. + +from connector import Connector +import socket +import select +import re + +class lirc_connector(Connector): + + + CONNECTOR_NAME = 'LIRC Connector' + CONNECTOR_VERSION = 0.1 + CONNECTOR_LOGNAME = 'lirc_connector' + def __init__(self,parent, instanceName): + self._parent = parent + self.WG = parent.WG + self.instanceName = instanceName + + defaultconfig = { + 'server' : '127.0.0.1', + 'port' : 8765 + } + self.WG.checkconfig(self.instanceName,defaultconfig) + self.config = self.WG.config[instanceName] + + self.start() + + + def run(self): + while self.isrunning: + ## Create Socket + try: + self._socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM) + try: + self._socket.connect((self.config['server'],self.config['port'])) + self._sockfile = self._socket.makefile() + self._run() + except socket.error ,e: + if e[0] == 111: + print "NO Connection" + + finally: + try: + self._socket.close() + except: + pass + if self.isrunning: + self.debug("Socket to %s:%d Closed waiting 5 sec" % (self.config['server'],self.config['port'])) + self.idle(5) + + def _run(self): + while self.isrunning: + ##00000014de890000 00 BTN_VOLUP X10_CHAN9 + r,w,e = select.select([self._socket],[],[],1) + if not r: + continue + rawmsg = self._sockfile.readline() + try: + raw, counter, button, channel = rawmsg.split() + ## default "LIRC:channel_button + id = "%s:%s_%s" % (self.instanceName,channel,button) + self.WG.DATASTORE.update(id,counter) + + id = "%s:%s" % (self.instanceName,button) + ## dont't create it "LIRC:Button" + if id in self.WG.DATASTORE.dataobjects: + self.WG.DATASTORE.update(id,channel) + + except ValueError: + self.debug("invalid Data %r" % rawmsg) + + Added: PyWireGate/trunk/lirc_connector/__init__.py =================================================================== --- PyWireGate/trunk/lirc_connector/__init__.py (rev 0) +++ PyWireGate/trunk/lirc_connector/__init__.py 2010-11-18 16:01:07 UTC (rev 137) @@ -0,0 +1 @@ +from LIRC_Connector import lirc_connector This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-18 14:07:48
|
Revision: 136 http://openautomation.svn.sourceforge.net/openautomation/?rev=136&view=rev Author: nilss1 Date: 2010-11-18 14:07:41 +0000 (Thu, 18 Nov 2010) Log Message: ----------- send busmaster id to ibutton DSobject * Fixed a bug which lets the Thread stop Modified Paths: -------------- PyWireGate/trunk/owfs_connector/OWFS_Connector.py Modified: PyWireGate/trunk/owfs_connector/OWFS_Connector.py =================================================================== --- PyWireGate/trunk/owfs_connector/OWFS_Connector.py 2010-11-17 12:07:57 UTC (rev 135) +++ PyWireGate/trunk/owfs_connector/OWFS_Connector.py 2010-11-18 14:07:41 UTC (rev 136) @@ -89,7 +89,7 @@ try: cfg,interface,config = key.split("_",2) self.supportedsensors[sensor]['interfaces'][interface]['config'][config] = sensorconfig[sensor][key] - print self.supportedsensors[sensor]['interfaces'][interface] + self.debug("Interface %s-%s config: %r" % (sensor,interface,self.supportedsensors[sensor]['interfaces'][interface]['config'])) except KeyError: pass @@ -175,7 +175,6 @@ finally: self.mutex.release() self.findsensors(bus) - self.checkBusCycleTime(bus) except: ## ignore all OWFS Errors pass @@ -207,36 +206,38 @@ except: ## nothing found pass - + if sensor[:2] == "81": + ## this must be the Busmaster .. threre should only be one + self.busmaster[path]['busmaster'] = sensor + if sensortype not in self.supportedsensors: self.debug("unsupported Type: %r" % sensortype) - continue - + continue + if 'interfaces' not in self.supportedsensors[sensortype]: self.debug("Sensor Type: %r has no supported Interfaces" % sensortype) continue - sensorlist = "sensors" cycle = 600 if 'cycle' in self.supportedsensors[sensortype]: cycle = self.supportedsensors[sensortype]['cycle'] try: self.mutex.acquire() - print "Sensortype: %s config: %r" % (sensortype,self.supportedsensors[sensortype]['interfaces']) + self.debug("Sensortype: %s config: %r" % (sensortype,self.supportedsensors[sensortype]['interfaces'])) self.sensors[sensor] = { 'type':sensortype, 'cycle':cycle, 'nextrun':0, - 'present': True, + 'present': self.busmaster[path].get('busmaster',True), 'interfaces': self.supportedsensors[sensortype]['interfaces'] } finally: self.mutex.release() self._addQueue(path,sensor) - + def read(self): for busname in self.busmaster.keys(): if not self.busmaster[busname]['readQueue'].empty(): @@ -278,11 +279,15 @@ #self.WG.errorlog("Reading from path %s failed" % owfspath) self.log("Reading from path %s failed" % owfspath) + if iface == "present": + if str(data) <> "1": + self.sensors[sensor]['present'] = False + else: + data = self.busmaster[busname].get('busmaster',True) + if data: self.debug("%s: %r" % (id,data)) self.WG.DATASTORE.update(id,data) - if iface == "present" and str(data) <> "1": - self.sensors[sensor]['present'] = False self._addQueue(busname,sensor) @@ -294,6 +299,8 @@ if self.sensors[sensor]['present']: self.busmaster[busname]['readQueue'].put((cycletime,sensor)) else: + if 'present' not in self.sensors[sensor]['interfaces']: + return for busmaster in self.busmaster.keys(): ## add to all busmaster queues self.busmaster[busmaster]['readQueue'].put((cycletime,sensor)) @@ -306,6 +313,7 @@ if not self.isrunning: break time.sleep(.1) + self.debug("Queue for bus %s : %r" % (busname, self.busmaster[busname]['readQueue'])) rtime, sensor = self.busmaster[busname]['readQueue'].get() self._read(busname,sensor) finally: @@ -325,7 +333,7 @@ # Check whether the queue is empty def _empty(self): return not self.queue - + # Check whether the queue is full def _full(self): return self.maxsize > 0 and len(self.queue) == self.maxsize @@ -348,4 +356,7 @@ next = next[0] else: next = 0 - return (next <= time.time()) \ No newline at end of file + return (next <= time.time()) + + def __repr__(self): + return repr(self.queue) \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-17 12:08:03
|
Revision: 135 http://openautomation.svn.sourceforge.net/openautomation/?rev=135&view=rev Author: nilss1 Date: 2010-11-17 12:07:57 +0000 (Wed, 17 Nov 2010) Log Message: ----------- Fixed DPT14 as IEEE754 is pythons internal float Modified Paths: -------------- PyWireGate/trunk/knx_connector/DPT_Types.py Modified: PyWireGate/trunk/knx_connector/DPT_Types.py =================================================================== --- PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-15 23:09:17 UTC (rev 134) +++ PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-17 12:07:57 UTC (rev 135) @@ -143,6 +143,8 @@ instance = "dpt-types" if self._parent: self._parent.log(msg,severity,instance) + else: + print msg def toByteArray(self,val,length): ## Set ByteArray @@ -413,28 +415,16 @@ ## S (Sign) = {0,1} ## Exponent = [0 ... 255] ## Fraction = [0 .. 8 388 607] - val = self.toBigInt(raw) - sign = (val & 0x80000000) >> 31 - exp = (val & 0x7f8000) >> 23 - mant = val & 0x7fffff - if sign <> 0: - mant = -(~(mant - 1) & 0x7fffff) - self.debug("DPT14: value: %d sign: %d exp: %d mant: %f" % (val, sign,exp,mant)) - return (1 << exp) * 0.01 * mant + ##use struct as internal the same + if len(raw)==4: + ret = struct.unpack(">f","".join([chr(i) for i in raw])) + if type(ret) == tuple: + ret = ret[0] + return ret def encodeDPT14(self,val): - sign = 0 - exp = 0 - if val < 0: - sign = 0x80000000 - mant = val * 100 - while mant > 0x7fffff: - mant = mant >> 1 - exp +=1 - data = sign | (exp << 23) | (int(mant) & 0x07ff) - self.debug("DPT14: value: %d sign: %d exp: %d mant: %r" % (val, sign,exp,mant)) - ## change to 4Byte bytearray - return self.toByteArray(data,4) + ## internal the same + return [ord(i) for i in struct.pack(">f",float(val))] def decodeDPT16(self,raw): res = "" @@ -507,7 +497,9 @@ if __name__ == "__main__": dpttypes = dpt_type(False) - print dpttypes.decode([24,88],dptid=9) - print dpttypes.decode([1],dptid=1) - print dpttypes.decode([35,76,58],dptid=16) - print dpttypes.encode("Das ist",dptid=16) \ No newline at end of file + #print dpttypes.decode([24,88],dptid=9) + #print dpttypes.decode([1],dptid=1) + #print dpttypes.decode([35,76,58],dptid=16) + print dpttypes.encode(15.5,dptid=14) + print dpttypes.decode([0, 0, 6, 14],dptid=14) + print dpttypes.decode([65, 120, 0, 0],dptid=14) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-15 23:09:27
|
Revision: 134 http://openautomation.svn.sourceforge.net/openautomation/?rev=134&view=rev Author: nilss1 Date: 2010-11-15 23:09:17 +0000 (Mon, 15 Nov 2010) Log Message: ----------- if a present interface is defined, the sensor is put to all busmaster queues until found Modified Paths: -------------- PyWireGate/trunk/owfs_connector/OWFS_Connector.py Modified: PyWireGate/trunk/owfs_connector/OWFS_Connector.py =================================================================== --- PyWireGate/trunk/owfs_connector/OWFS_Connector.py 2010-11-15 21:59:52 UTC (rev 133) +++ PyWireGate/trunk/owfs_connector/OWFS_Connector.py 2010-11-15 23:09:17 UTC (rev 134) @@ -229,6 +229,7 @@ 'type':sensortype, 'cycle':cycle, 'nextrun':0, + 'present': True, 'interfaces': self.supportedsensors[sensortype]['interfaces'] } finally: @@ -251,18 +252,21 @@ def _read(self,busname,sensor): - for get in self.sensors[sensor]['interfaces'].keys(): + for iface in self.sensors[sensor]['interfaces'].keys(): + if not self.sensors[sensor]['present'] and iface <> "present": + ## if not present check only for present + continue ## make an id for the sensor (OW:28.043242a32_temperature - id = "%s:%s_%s" % (self.instanceName,sensor,get) + id = "%s:%s_%s" % (self.instanceName,sensor,iface) ## get the Datastore Object and look for config obj = self.WG.DATASTORE.get(id) sensortype = self.sensors[sensor]['type'] ## recheck config - self.checkConfigDefaults(obj,self.supportedsensors[sensortype]['interfaces'][get]) + self.checkConfigDefaults(obj,self.supportedsensors[sensortype]['interfaces'][iface]) - owfspath = "/uncached/%s/%s%s" % (sensor,get,obj.config.get('resolution','')) + owfspath = "/uncached/%s/%s%s" % (sensor,iface,obj.config.get('resolution','')) self.debug("Reading from path %s" % owfspath) data = None @@ -277,6 +281,9 @@ if data: self.debug("%s: %r" % (id,data)) self.WG.DATASTORE.update(id,data) + if iface == "present" and str(data) <> "1": + self.sensors[sensor]['present'] = False + self._addQueue(busname,sensor) def _addQueue(self,busname,sensor): @@ -284,7 +291,12 @@ self.debug("ADDED %s on %s with %s (%d)s" % (sensor,busname, time.asctime(time.localtime(cycletime)),self.sensors[sensor]['cycle'])) ## FIXME: not present iButtons should be added to all Busmaster Queues #if self.sensors[sensor][''] - self.busmaster[busname]['readQueue'].put((cycletime,sensor)) + if self.sensors[sensor]['present']: + self.busmaster[busname]['readQueue'].put((cycletime,sensor)) + else: + for busmaster in self.busmaster.keys(): + ## add to all busmaster queues + self.busmaster[busmaster]['readQueue'].put((cycletime,sensor)) def _readThread(self,busname): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2010-11-15 21:59:58
|
Revision: 133 http://openautomation.svn.sourceforge.net/openautomation/?rev=133&view=rev Author: makki1 Date: 2010-11-15 21:59:52 +0000 (Mon, 15 Nov 2010) Log Message: ----------- remove obolsete tags/Groupsocket Removed Paths: ------------- PyWireGate/tags/GroupSocket/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-15 21:21:28
|
Revision: 132 http://openautomation.svn.sourceforge.net/openautomation/?rev=132&view=rev Author: nilss1 Date: 2010-11-15 21:21:16 +0000 (Mon, 15 Nov 2010) Log Message: ----------- added reading and readflag in datastore object config Modified Paths: -------------- PyWireGate/trunk/knx_connector/GroupSocket.py PyWireGate/trunk/knx_connector/KNX_Connector.py Modified: PyWireGate/trunk/knx_connector/GroupSocket.py =================================================================== --- PyWireGate/trunk/knx_connector/GroupSocket.py 2010-11-15 21:20:31 UTC (rev 131) +++ PyWireGate/trunk/knx_connector/GroupSocket.py 2010-11-15 21:21:16 UTC (rev 132) @@ -57,16 +57,21 @@ ##FIXME: unknown APDU self.debug("unknown APDU from "+msg['srcaddr']+" to "+msg['dstaddr']+ " raw:"+buf) else: + dsobj = self.WG.DATASTORE.get(id) if (buf[1] & 0xC0 == 0x00): msg['type'] = "read" + if dsobj.config.get('readflag',False): + self.debug("Read from %s" % id) + self._parent.setValue(dsobj,flag=0x40) + ##FIXME: Check (ds) if we should respond - elif (buf[1] & 0xC0 == 0x40): - msg['type'] = "response" - ##FIXME: Update ds also? - elif (buf[1] & 0xC0 == 0x80): - msg['type'] = "write" + elif (buf[1] & 0xC0 == 0x40) or (buf[1] & 0xC0 == 0x80): + if (buf[1] & 0xC0 == 0x40): + msg['type'] = "response" + else: + msg['type'] = "write" ## search Datastoreobject - dsobj = self.WG.DATASTORE.get(id) + ## Decode the DPT Value if (len(buf) >2): msg['value'] = self.dpt.decode( buf[2:],dsobj=dsobj) @@ -94,7 +99,7 @@ def log(self,msg,severity='info',instance=False): if not instance: - instance = self.instanceName + instance = 'KNX' self._parent.log(msg,severity,instance) def debug(self,msg): Modified: PyWireGate/trunk/knx_connector/KNX_Connector.py =================================================================== --- PyWireGate/trunk/knx_connector/KNX_Connector.py 2010-11-15 21:20:31 UTC (rev 131) +++ PyWireGate/trunk/knx_connector/KNX_Connector.py 2010-11-15 21:21:16 UTC (rev 132) @@ -172,15 +172,15 @@ - def send(self,msg,dstaddr): + def send(self,msg,dstaddr,flag=KNXWRITEFLAG): try: addr = self.str2grpaddr(dstaddr) if addr: apdu = [0] if type(msg) == int: - apdu.append(KNXWRITEFLAG | msg) + apdu.append(flag | msg) elif type(msg) == list: - apdu = apdu +[KNXWRITEFLAG]+ msg + apdu = apdu +[flag]+ msg else: self.WG.errorlog("invalid Message %r to %r" % (msg,dstaddr)) return @@ -189,12 +189,12 @@ except: self.WG.errorlog("Failed send %r to %r" % (msg,dstaddr)) - def setValue(self,dsobj,msg=False): + def setValue(self,dsobj,msg=False,flag=KNXWRITEFLAG): try: if not msg: msg = dsobj.getValue() self.debug("SEND %r to %s (%s)" % (msg,dsobj.name,dsobj.id)) - self.send(self.dpt.encode(msg,dsobj=dsobj),dsobj.id) + self.send(self.dpt.encode(msg,dsobj=dsobj),dsobj.id,flag=flag) except: print "----------- ERROR IN KNX_CONNECTOR.setValue ----------------" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-15 21:20:42
|
Revision: 131 http://openautomation.svn.sourceforge.net/openautomation/?rev=131&view=rev Author: nilss1 Date: 2010-11-15 21:20:31 +0000 (Mon, 15 Nov 2010) Log Message: ----------- Fixed weekday Modified Paths: -------------- PyWireGate/trunk/knx_connector/DPT_Types.py Modified: PyWireGate/trunk/knx_connector/DPT_Types.py =================================================================== --- PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-15 19:58:41 UTC (rev 130) +++ PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-15 21:20:31 UTC (rev 131) @@ -331,7 +331,7 @@ now = time.localtime() else: now = time.localtime(val) - weekday = now[6] + weekday = now[6]+1 hour = now[3] min = now[4] sec = now[5] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-15 19:58:52
|
Revision: 130 http://openautomation.svn.sourceforge.net/openautomation/?rev=130&view=rev Author: nilss1 Date: 2010-11-15 19:58:41 +0000 (Mon, 15 Nov 2010) Log Message: ----------- Use Queue based readThreads and support subtypes (DS2438TH/DS2438THS) Modified Paths: -------------- PyWireGate/trunk/owfs_connector/OWFS_Connector.py PyWireGate/trunk/owfs_connector/sensors.ini Modified: PyWireGate/trunk/owfs_connector/OWFS_Connector.py =================================================================== --- PyWireGate/trunk/owfs_connector/OWFS_Connector.py 2010-11-15 19:56:47 UTC (rev 129) +++ PyWireGate/trunk/owfs_connector/OWFS_Connector.py 2010-11-15 19:58:41 UTC (rev 130) @@ -22,22 +22,25 @@ import threading import time +from Queue import Empty,Full,Queue +import heapq + + class owfs_connector(Connector): + + CONNECTOR_NAME = 'OWFS Connector' CONNECTOR_VERSION = 0.2 CONNECTOR_LOGNAME = 'owfs_connector' def __init__(self,parent, instanceName): self._parent = parent - if parent: - self.WG = parent.WG - else: - self.WG = False + self.WG = parent.WG self.instanceName = instanceName self.mutex = threading.RLock() defaultconfig = { - 'cycletime' : 15, + 'cycletime' : 600, 'server' : '127.0.0.1', 'port' : 4304 } @@ -61,7 +64,7 @@ self.supportedsensors[sensor] = {} cycledefault = defaultconfig['cycletime'] if 'cycle' in sensorconfig[sensor]: - cycledefault = sensorconfig[sensor]['cycle'] + self.supportedsensors[sensor]['cycle'] = sensorconfig[sensor]['cycle'] del sensorconfig[sensor]['cycle'] if 'interfaces' in sensorconfig[sensor]: self.supportedsensors[sensor]['interfaces'] = {} @@ -70,6 +73,17 @@ ## remove Interface key from dict del sensorconfig[sensor]['interfaces'] + if 'subtypes' in sensorconfig[sensor]: + subtypes = sensorconfig[sensor]['subtypes'].split(",") + self.supportedsensors[sensor]['subtypes'] = {} + for stype in subtypes: + id,subname = stype.split(":",1) + try: + self.supportedsensors[sensor]['subtypes'][int(id,16)] = subname + except: + pass + del sensorconfig[sensor]['subtypes'] + for key in sensorconfig[sensor].keys(): if key.startswith("config_"): try: @@ -102,11 +116,11 @@ return config def run(self): - cnt = 10 + busscantime = 0 while self.isrunning: ## every 10 runs search new sensors - if cnt == 10: - cnt = 0 + if busscantime < time.time(): + busscantime = time.time() + self.config['cycletime'] ## find new sensors #self.findsensors() try: @@ -122,27 +136,27 @@ ## IDLE for cycletime seconds (default 15sec) ## Fixme: maybe optimize cycletime dynamic based on busload - self.idle(self.config['cycletime']) + self.idle(.1) + for busname in self.busmaster.keys(): + if self.busmaster[busname]['readthread'] <> None: + self.busmaster[busname]['readthread'].join() - ## counter increment for sensorsearch - cnt += 1 - def findbusmaster(self,path=""): ## search for active busses - nochilds = True + childs = False uncachedpath = "/uncached%s" % path for bus in self.owfs.dir(uncachedpath): bus = bus[9:] if self.isbus.search(bus): - nochilds = False + childs = True ## get the bus ID busname = self.isbus.search(bus) if busname: try: - if self.findbusmaster(bus): + if not self.findbusmaster(bus): ## if this has no subbuses add it to the list try: self.mutex.acquire() @@ -152,9 +166,11 @@ except KeyError: ## add to list self.busmaster[bus] = { - 'sensors' : {}, + 'buscycle' : 600, + 'nextrun' : 0, 'lastseen' : time.time(), - 'readthread' : None + 'readthread' : None, + 'readQueue' : ReadQueue(200) } finally: self.mutex.release() @@ -163,14 +179,12 @@ except: ## ignore all OWFS Errors pass - return nochilds + return childs - def checkBusCycleTime(self,bus): - pass - def findsensors(self,path=""): uncachedpath = "/uncached%s" % path + mincycle = 600 for sensor in self.owfs.dir(uncachedpath): ## remove /uncached/bus.x from sensorname sensor = sensor.split("/")[-1] @@ -184,82 +198,142 @@ except: ## ignore all OWFS Errors continue + if 'subtypes' in self.supportedsensors[sensortype]: + ##check subtypes + try: + info = ord(self.owfs.read("%s/pages/page.3" % sensor)[0]) + sensortype += self.supportedsensors[sensortype]['subtypes'][info] + self.debug("Sensor Subtype %s is used" % sensortype) + except: + ## nothing found + pass + if sensortype not in self.supportedsensors: self.debug("unsupported Type: %r" % sensortype) continue + if 'interfaces' not in self.supportedsensors[sensortype]: self.debug("Sensor Type: %r has no supported Interfaces" % sensortype) continue - ### add it to the list of active sensors - ## FIXME: check for old sensor no longer active and remove + sensorlist = "sensors" + cycle = 600 + if 'cycle' in self.supportedsensors[sensortype]: + cycle = self.supportedsensors[sensortype]['cycle'] + try: self.mutex.acquire() - self.busmaster[path]['sensors'][sensor] = { + print "Sensortype: %s config: %r" % (sensortype,self.supportedsensors[sensortype]['interfaces']) + + self.sensors[sensor] = { 'type':sensortype, + 'cycle':cycle, + 'nextrun':0, 'interfaces': self.supportedsensors[sensortype]['interfaces'] } finally: self.mutex.release() + + self._addQueue(path,sensor) + + def read(self): + for busname in self.busmaster.keys(): + if not self.busmaster[busname]['readQueue'].empty(): + if not self.busmaster[busname]['readthread']: + self.debug("Start read Thread for %s" % busname) + threadname = "OWFS-Reader_%s" % busname + try: + self.mutex.acquire() + self.busmaster[busname]['readthread'] = threading.Thread(target=self._readThread,args=[busname],name=threadname) + self.busmaster[busname]['readthread'].start() + finally: + self.mutex.release() - - def _read(self,busname): - ## loop through all sensors in lokal busmaster list - self.debug("Thread running for %s" % busname) - readtime = time.time() - for sensor in self.busmaster[busname]['sensors'].keys(): - #self.sensors[sensor]['power'] = self.owfs.read("/"+sensor+"/power") + def _read(self,busname,sensor): + for get in self.sensors[sensor]['interfaces'].keys(): + ## make an id for the sensor (OW:28.043242a32_temperature + id = "%s:%s_%s" % (self.instanceName,sensor,get) + ## get the Datastore Object and look for config + obj = self.WG.DATASTORE.get(id) - ## loop through their interfaces - for get in self.busmaster[busname]['sensors'][sensor]['interfaces'].keys(): - resolution = "" - id = "%s:%s_%s" % (self.instanceName,sensor,get) + sensortype = self.sensors[sensor]['type'] - ## get the Datastore Object and look for config - obj = self.WG.DATASTORE.get(id) - sensortype = self.busmaster[busname]['sensors'][sensor]['type'] - self.checkConfigDefaults(obj,self.supportedsensors[sensortype]['interfaces'][get]) - if "resolution" in obj.config: - resolution = str(obj.config['resolution']) - - owfspath = "/uncached/%s/%s%s" % (sensor,get,resolution) - self.debug("Reading from path %s" % owfspath) - data = False - try: - ## read uncached and put into local-list - data = self.owfs.read(owfspath) - except: - ## ignore all OWFS Errors - #self.WG.errorlog("Reading from path %s failed" % owfspath) - self.log("Reading from path %s failed" % owfspath) + ## recheck config + self.checkConfigDefaults(obj,self.supportedsensors[sensortype]['interfaces'][get]) + + owfspath = "/uncached/%s/%s%s" % (sensor,get,obj.config.get('resolution','')) + self.debug("Reading from path %s" % owfspath) - try: - self.mutex.acquire() - self.busmaster[busname]['sensors'][sensor][get] = data - finally: - self.mutex.release() - ## make an id for the sensor (OW:28.043242a32_temperature - try: - ## only if there is any Data update it in the DATASTORE - if self.busmaster[busname]['sensors'][sensor][get]: - self.WG.DATASTORE.update(id,self.busmaster[busname]['sensors'][sensor][get]) - except: - self.WG.errorlog() - self.busmaster[busname]['readthread'] = None - self.debug("Thread for %s finshed reading %d sensors in %f secs " % (busname,len(self.busmaster[busname]['sensors']), time.time() - readtime)) - - def read(self): - for busname in self.busmaster.keys(): - if len(self.busmaster[busname]['sensors'])>0: - if not self.busmaster[busname]['readthread']: - self.debug("Start read Thread for %s" % busname) - threadname = "OWFS-Reader_%s" % busname - try: - self.mutex.acquire() - self.busmaster[busname]['readthread'] = threading.Thread(target=self._read,args=[busname],name=threadname) - self.busmaster[busname]['readthread'].start() - finally: - self.mutex.release() + data = None + try: + ## read uncached and put into local-list + data = self.owfs.read(owfspath) + except: + ## ignore all OWFS Errors + #self.WG.errorlog("Reading from path %s failed" % owfspath) + self.log("Reading from path %s failed" % owfspath) + if data: + self.debug("%s: %r" % (id,data)) + self.WG.DATASTORE.update(id,data) + self._addQueue(busname,sensor) + def _addQueue(self,busname,sensor): + cycletime = time.time() +self.sensors[sensor]['cycle'] + self.debug("ADDED %s on %s with %s (%d)s" % (sensor,busname, time.asctime(time.localtime(cycletime)),self.sensors[sensor]['cycle'])) + ## FIXME: not present iButtons should be added to all Busmaster Queues + #if self.sensors[sensor][''] + self.busmaster[busname]['readQueue'].put((cycletime,sensor)) + + + def _readThread(self,busname): + try: + while self.isrunning: + while not self.busmaster[busname]['readQueue'].check(): + if not self.isrunning: + break + time.sleep(.1) + rtime, sensor = self.busmaster[busname]['readQueue'].get() + self._read(busname,sensor) + finally: + if self.isrunning: + self.busmaster[busname]['readthread'] = None + + + +class ReadQueue(Queue): + def _init(self, maxsize): + self.maxsize = maxsize + self.queue = [] + + def _qsize(self): + return len(self.queue) + + # Check whether the queue is empty + def _empty(self): + return not self.queue + + # Check whether the queue is full + def _full(self): + return self.maxsize > 0 and len(self.queue) == self.maxsize + + # Put a new item in the queue + def _put(self, item): + ## only new Sensors + if not filter(lambda x: x[1]==item[1],self.queue): + heapq.heappush(self.queue,item) + + # Get an item from the queue + def _get(self): + return heapq.heappop(self.queue) + + def check(self): + if len(self.queue) == 0: + return False + next = min(self.queue) + if len(next)==2: + next = next[0] + else: + next = 0 + return (next <= time.time()) \ No newline at end of file Modified: PyWireGate/trunk/owfs_connector/sensors.ini =================================================================== --- PyWireGate/trunk/owfs_connector/sensors.ini 2010-11-15 19:56:47 UTC (rev 129) +++ PyWireGate/trunk/owfs_connector/sensors.ini 2010-11-15 19:58:41 UTC (rev 130) @@ -28,9 +28,17 @@ # Battery-monitor with Vxx and current, family 26 # /pages/page.3 conatins type: 0x19 or 0xF1 = TH, 0xF2 = THS # FIXME: several more (not widely used) to be added +subtypes = 0x19:TH,0xf1:TH,0xF2:THS cycle = 60 interfaces = temperature,HIH4000/humidity,vis,VAD,VDD +[DS2438TH] +cycle = 60 +interfaces = temperature,HIH4000/humidity + +[DS2438THS] +cycle = 60 + [DS2406] # dual switch / IO, family 12 # PIO.[A|B] if used as output This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-15 19:56:58
|
Revision: 129 http://openautomation.svn.sourceforge.net/openautomation/?rev=129&view=rev Author: nilss1 Date: 2010-11-15 19:56:47 +0000 (Mon, 15 Nov 2010) Log Message: ----------- readded owfs exceptions Modified Paths: -------------- PyWireGate/trunk/owfs_connector/connection.py Modified: PyWireGate/trunk/owfs_connector/connection.py =================================================================== --- PyWireGate/trunk/owfs_connector/connection.py 2010-11-15 07:26:16 UTC (rev 128) +++ PyWireGate/trunk/owfs_connector/connection.py 2010-11-15 19:56:47 UTC (rev 129) @@ -1,284 +1,256 @@ -# -*- coding: iso-8859-1 -*- -""" -::BOH -$Id: connection.py,v 1.7 2009/04/13 01:17:09 alfille Exp $ -$HeadURL: http://subversion/stuff/svn/owfs/trunk/ow/__init__.py $ - -Copyright (c) 2006 Peter Kropf. All rights reserved. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or (at -your option) any later version. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -::EOH - -OWFS is an open source project developed by Paul Alfille and hosted at -http://www.owfs.org -""" - - -import sys -import os -import socket -import struct -import re - - -__author__ = 'Peter Kropf' -__email__ = 'pk...@gm...' -__version__ = '$Id: connection.py,v 1.7 2009/04/13 01:17:09 alfille Exp $'.split()[2] - - -class exError(Exception): - """base exception for all one wire raised exceptions.""" - - -class exErrorValue(exError): - """Base exception for all one wire raised exceptions with a value.""" - def __init__(self, value): - self.value = value - - def __str__(self): - return repr(self.value) - - -class exInvalidMessage(exErrorValue): - """Exception raised when trying to unpack a message that doesn't meet specs.""" - - -class exShortRead(exError): - """Exception raised when too few bytes are received from the owserver.""" - - -class OWMsg: - """ - Constants for the owserver api message types. - """ - error = 0 - nop = 1 - read = 2 - write = 3 - dir = 4 - size = 5 - presence = 6 - - -class Connection(object): - """ - A Connection provides access to a owserver without the standard - core ow libraries. Instead, it impliments the wire protocol for - communicating with the owserver. This allows Python programs to - interact with the ow sensors on any platform supported by Python. - """ - - def __init__(self, server="127.0.0.1", port=4304): - """ - Create a new connection object. - """ - #print 'Connection.__init__(%s, %i)' % (server, port) - - self._server = server - self._port = port - self.checknum = re.compile(r"(^\d+$)|(^\d+\x2e\d+$)", re.MULTILINE) - - - def __str__(self): - """ - Print a string representation of the Connection in the form of: - - server:port - """ - - #print 'Connection.__str__' - return "%s:%i" % (self._server, self._port) - - - def __repr__(self): - """ - Print a representation of the Connection in the form of: - - Connection(server, port) - - Example: - - >>> Connection('xyzzy', 9876) - Connection(server="xyzzy", port=9876) - """ - - #print 'Connection.__repr__' - return 'Connection("%s", %i)' % (self._server, self._port) - - - def read(self, path): - """ - """ - - #print 'Connection.read("%s")' % (path) - - rtn = None - ## we don't want errors - try: - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - try: - s.connect((self._server, self._port)) - except: - ## - return rtn - - smsg = self.pack(OWMsg.read, len(path) + 1, 8192) - s.sendall(smsg) - s.sendall(path + '\x00') - - while 1: - try: - data = s.recv(24) - except: - ## - return rtn - - payload_len = -1 - if len(data) is 24: - ret, payload_len, data_len = self.unpack(data) - - if payload_len >= 0: - data = s.recv(payload_len) - return self.toNumber(data[:data_len]) - else: - # ping response - return None - - finally: - s.close() - - - - def write(self, path, value): - """ - """ - ret = None - try: - #print 'Connection.write("%s", "%s")' % (path, str(value)) - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - try: - s.connect((self._server, self._port)) - except: - return ret - - value = str(value) - smsg = self.pack(OWMsg.write, len(path) + 1 + len(value) + 1, len(value) + 1) - s.sendall(smsg) - s.sendall(path + '\x00' + value + '\x00') - - try: - data = s.recv(24) - except: - return ret - - if len(data) is 24: - ret, payload_len, data_len = self.unpack(data) - return ret - - - finally: - s.close() - - - - def dir(self, path): - """ - """ - - fields = [] - try: - #print 'Connection.dir("%s")' % (path) - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - try: - s.connect((self._server, self._port)) - except: - return fields - - smsg = self.pack(OWMsg.dir, len(path) + 1, 0) - s.sendall(smsg) - s.sendall(path + '\x00') - - while 1: - try: - data = s.recv(24) - except: - return fields - - if len(data) is not 24: - return fields - - ret, payload_len, data_len = self.unpack(data) - - if payload_len > 0: - try: - data = s.recv(payload_len) - except: - return fields - fields.append(data[:data_len]) - else: - # end of dir list or 'ping' response - return fields - - finally: - s.close() - - - def pack(self, function, payload_len, data_len): - """ - """ - - #print 'Connection.pack(%i, %i, %i)' % (function, payload_len, data_len) - return struct.pack('IIIIII', - socket.htonl(0), #version - socket.htonl(payload_len), #payload length - socket.htonl(function), #type of function call - socket.htonl(258), #format flags -- 266 for alias upport - socket.htonl(data_len), #size of data element for read or write - socket.htonl(0), #offset for read or write - ) - - - def unpack(self, msg): - """ - """ - - #print 'Connection.unpack("%s")' % msg - if len(msg) is not 24: - raise exInvalidMessage, msg - - val = struct.unpack('IIIIII', msg) - - version = socket.ntohl(val[0]) - payload_len = socket.ntohl(val[1]) - ret_value = socket.ntohl(val[2]) - format_flags = socket.ntohl(val[3]) - data_len = socket.ntohl(val[4]) - offset = socket.ntohl(val[5]) - - return ret_value, payload_len, data_len - - - def toNumber(self, owstr): - """ - """ - owstr = owstr.strip() - numresult = self.checknum.findall(owstr) - if numresult: - if numresult[0][0]: - return int(numresult[0][0]) - elif numresult[0][1]: - return float(numresult[0][1]) - - return owstr +# -*- coding: iso-8859-1 -*- +""" +::BOH +$Id: connection.py,v 1.7 2009/04/13 01:17:09 alfille Exp $ +$HeadURL: http://subversion/stuff/svn/owfs/trunk/ow/__init__.py $ + +Copyright (c) 2006 Peter Kropf. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +::EOH + +OWFS is an open source project developed by Paul Alfille and hosted at +http://www.owfs.org +""" + + +import sys +import os +import socket +import struct +import re + + +__author__ = 'Peter Kropf' +__email__ = 'pk...@gm...' +__version__ = '$Id: connection.py,v 1.7 2009/04/13 01:17:09 alfille Exp $'.split()[2] + + +class exError(Exception): + """base exception for all one wire raised exceptions.""" + + +class exErrorValue(exError): + """Base exception for all one wire raised exceptions with a value.""" + def __init__(self, value): + self.value = value + + def __str__(self): + return repr(self.value) + + +class exInvalidMessage(exErrorValue): + """Exception raised when trying to unpack a message that doesn't meet specs.""" + + +class exShortRead(exError): + """Exception raised when too few bytes are received from the owserver.""" + + +class OWMsg: + """ + Constants for the owserver api message types. + """ + error = 0 + nop = 1 + read = 2 + write = 3 + dir = 4 + size = 5 + presence = 6 + + +class Connection(object): + """ + A Connection provides access to a owserver without the standard + core ow libraries. Instead, it impliments the wire protocol for + communicating with the owserver. This allows Python programs to + interact with the ow sensors on any platform supported by Python. + """ + + def __init__(self, server="127.0.0.1", port=4304): + """ + Create a new connection object. + """ + #print 'Connection.__init__(%s, %i)' % (server, port) + + self._server = server + self._port = port + self.checknum = re.compile(r"(^\d+$)|(^\d+\x2e\d+$)", re.MULTILINE) + + + def __str__(self): + """ + Print a string representation of the Connection in the form of: + + server:port + """ + + #print 'Connection.__str__' + return "%s:%i" % (self._server, self._port) + + + def __repr__(self): + """ + Print a representation of the Connection in the form of: + + Connection(server, port) + + Example: + + >>> Connection('xyzzy', 9876) + Connection(server="xyzzy", port=9876) + """ + + #print 'Connection.__repr__' + return 'Connection("%s", %i)' % (self._server, self._port) + + + def read(self, path): + """ + """ + + #print 'Connection.read("%s", %i, "%s")' % (path) + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.connect((self._server, self._port)) + + smsg = self.pack(OWMsg.read, len(path) + 1, 8192) + s.sendall(smsg) + s.sendall(path + '\x00') + + while 1: + data = s.recv(24) + + if len(data) is not 24: + raise exShortRead + + ret, payload_len, data_len = self.unpack(data) + + if payload_len >= 0: + data = s.recv(payload_len) + rtn = self.toNumber(data[:data_len]) + break + else: + # ping response + rtn = None + break + + s.close() + return rtn + + + def write(self, path, value): + """ + """ + + #print 'Connection.write("%s", "%s")' % (path, str(value)) + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.connect((self._server, self._port)) + + value = str(value) + smsg = self.pack(OWMsg.write, len(path) + 1 + len(value) + 1, len(value) + 1) + s.sendall(smsg) + s.sendall(path + '\x00' + value + '\x00') + + data = s.recv(24) + + if len(data) is not 24: + raise exShortRead + + ret, payload_len, data_len = self.unpack(data) + + s.close() + return ret + + + def dir(self, path): + """ + """ + + #print 'Connection.dir("%s")' % (path) + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.connect((self._server, self._port)) + + smsg = self.pack(OWMsg.dir, len(path) + 1, 0) + s.sendall(smsg) + s.sendall(path + '\x00') + + fields = [] + while 1: + data = s.recv(24) + + if len(data) is not 24: + raise exShortRead + + ret, payload_len, data_len = self.unpack(data) + + if payload_len > 0: + data = s.recv(payload_len) + fields.append(data[:data_len]) + else: + # end of dir list or 'ping' response + break + + s.close() + return fields + + + def pack(self, function, payload_len, data_len): + """ + """ + + #print 'Connection.pack(%i, %i, %i)' % (function, payload_len, data_len) + return struct.pack('IIIIII', + socket.htonl(0), #version + socket.htonl(payload_len), #payload length + socket.htonl(function), #type of function call + socket.htonl(258), #format flags -- 266 for alias upport + socket.htonl(data_len), #size of data element for read or write + socket.htonl(0), #offset for read or write + ) + + + def unpack(self, msg): + """ + """ + + #print 'Connection.unpack("%s")' % msg + if len(msg) is not 24: + raise exInvalidMessage, msg + + val = struct.unpack('IIIIII', msg) + + version = socket.ntohl(val[0]) + payload_len = socket.ntohl(val[1]) + ret_value = socket.ntohl(val[2]) + format_flags = socket.ntohl(val[3]) + data_len = socket.ntohl(val[4]) + offset = socket.ntohl(val[5]) + + return ret_value, payload_len, data_len + + + def toNumber(self, owstr): + """ + """ + owstr = owstr.strip() + numresult = self.checknum.findall(owstr) + if numresult: + if numresult[0][0]: + return int(numresult[0][0]) + elif numresult[0][1]: + return float(numresult[0][1]) + + return owstr This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-15 07:26:27
|
Revision: 128 http://openautomation.svn.sourceforge.net/openautomation/?rev=128&view=rev Author: nilss1 Date: 2010-11-15 07:26:16 +0000 (Mon, 15 Nov 2010) Log Message: ----------- use N: instead of lastupdate time to avoid illegal attempt to update error Modified Paths: -------------- PyWireGate/trunk/rrd_connector/RRD_Connector.py Modified: PyWireGate/trunk/rrd_connector/RRD_Connector.py =================================================================== --- PyWireGate/trunk/rrd_connector/RRD_Connector.py 2010-11-14 23:39:30 UTC (rev 127) +++ PyWireGate/trunk/rrd_connector/RRD_Connector.py 2010-11-15 07:26:16 UTC (rev 128) @@ -57,12 +57,12 @@ rrdfilename = self.config['path'] +"/"+ self.makeASCII.sub("_",(str(dsobj.id)))+".rrd" if not os.path.exists(rrdfilename): self.create(dsobj,rrdfilename) - val, utime = dsobj.getValue('lastupdate') + val = dsobj.getValue() if val == None or type(val) not in (int,float): val = "U" else: val = "%.2f" % val - val = "%d:%s" % (utime,val) + val = "N:%s" % val self.debug("set RRD %s VAL: %r" % (rrdfilename,val)) rrdtool.update(rrdfilename,val) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-14 23:39:41
|
Revision: 127 http://openautomation.svn.sourceforge.net/openautomation/?rev=127&view=rev Author: nilss1 Date: 2010-11-14 23:39:30 +0000 (Sun, 14 Nov 2010) Log Message: ----------- rrdfilename in datastoreobject config added Modified Paths: -------------- PyWireGate/trunk/rrd_connector/RRD_Connector.py Modified: PyWireGate/trunk/rrd_connector/RRD_Connector.py =================================================================== --- PyWireGate/trunk/rrd_connector/RRD_Connector.py 2010-11-14 23:22:12 UTC (rev 126) +++ PyWireGate/trunk/rrd_connector/RRD_Connector.py 2010-11-14 23:39:30 UTC (rev 127) @@ -70,9 +70,10 @@ def create(self,dsobj,rrdfilename): rrdarchiv = {} - rrdconfig = {} - if 'rrd' in dsobj.config: - rrdconfig = dsobj.config['rrd'] + if 'rrd' not in dsobj.config: + dsobj.config['rrd'] = {} + rrdconfig = dsobj.config['rrd'] + rrdconfig['rrdfilename'] = rrdfilename for cfg in ['RRA','ARCHIV','VALTYPE','HEARTBEAT','MIN','MAX']: if cfg in rrdconfig: rrdarchiv[cfg] = rrdconfig[cfg] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-14 23:22:20
|
Revision: 126 http://openautomation.svn.sourceforge.net/openautomation/?rev=126&view=rev Author: nilss1 Date: 2010-11-14 23:22:12 +0000 (Sun, 14 Nov 2010) Log Message: ----------- changed to single datasource per rrd Modified Paths: -------------- PyWireGate/trunk/rrd_connector/RRD_Connector.py Modified: PyWireGate/trunk/rrd_connector/RRD_Connector.py =================================================================== --- PyWireGate/trunk/rrd_connector/RRD_Connector.py 2010-11-14 17:28:46 UTC (rev 125) +++ PyWireGate/trunk/rrd_connector/RRD_Connector.py 2010-11-14 23:22:12 UTC (rev 126) @@ -17,16 +17,16 @@ self._parent = parent self.WG = parent.WG self.instanceName = instanceName + self.makeASCII = re.compile(r"[^a-zA-Z0-9_.]+") ## Defaultconfig defaultconfig = { 'path':self.WG.scriptpath +"/rrd", 'defaultstep':300, - 'defaultDS':'value', 'defaultRRA':'RRA:%s:0.5:1:2160,RRA:%s:0.5:5:2016,RRA:%s:0.5:15:2880,RRA:%s:0.5:180:8760', 'defaultARCHIV':'AVERAGE,MIN,MAX', 'defaultVALTYPE':'GAUGE', - 'defaultHEARTBEAT':900, + 'defaultHEARTBEAT':600, 'defaultMIN':'-55', 'defaultMAX':'255000' @@ -41,46 +41,53 @@ def setValue(self,dsobj,msg=False): - rrdfilename = self.config['path'] +"/"+ re.sub(r"[^\w]","_",(str(dsobj.id)))+".rrd" - if not os.path.exists(rrdfilename): - self.create(dsobj,rrdfilename) - val = "N" if len(dsobj.connected) == 0: - val += ":%.2f" % dsobj.getValue() + if dsobj.lastsource: + self._setValue(dsobj.lastsource.id) for objid in dsobj.connected: - obj = self.WG.DATASTORE.dataobjects[objid] - oval = obj.getValue() - if oval == None or type(oval) not in (int,float): - oval = "U" - else: - oval = "%.2f" % oval - val += ":%s" % oval - - print "RRD %s VAL: %r" % (rrdfilename,val) + self._setValue(objid) + + def _setValue(self,objid): + try: + dsobj = self.WG.DATASTORE.dataobjects[objid] + except KeyError: + ## if not found ignore + return + rrdfilename = self.config['path'] +"/"+ self.makeASCII.sub("_",(str(dsobj.id)))+".rrd" + if not os.path.exists(rrdfilename): + self.create(dsobj,rrdfilename) + val, utime = dsobj.getValue('lastupdate') + if val == None or type(val) not in (int,float): + val = "U" + else: + val = "%.2f" % val + val = "%d:%s" % (utime,val) + self.debug("set RRD %s VAL: %r" % (rrdfilename,val)) rrdtool.update(rrdfilename,val) + + def create(self,dsobj,rrdfilename): rrdarchiv = {} + rrdconfig = {} if 'rrd' in dsobj.config: - for cfg in ['DS','RRA','ARCHIV','VALTYPE','HEARTBEAT','MIN','MAX']: - if cfg in dsobj.config['rrd']: - rrdarchiv[cfg] = dsobj.config['rrd'][cfg] - else: - rrdarchiv[cfg] = self.config['default%s' % cfg] # FIXME: das mag nicht + rrdconfig = dsobj.config['rrd'] + for cfg in ['RRA','ARCHIV','VALTYPE','HEARTBEAT','MIN','MAX']: + if cfg in rrdconfig: + rrdarchiv[cfg] = rrdconfig[cfg] + else: + rrdarchiv[cfg] = self.config['default%s' % cfg] - #FIXME: needed if single DS per rrd? args = [] datasources = [] + dsobj.connected if len(datasources) == 0: datasources.append(dsobj.id) -# for _d in datasources: -# id = hashlib.md5(_d).hexdigest()[:19] - args.append(str("DS:%s:%s:%d:%s:%s" % (rrdarchiv.get('DS',self.config['defaultDS']),rrdarchiv.get('VALTYPE',self.config['defaultVALTYPE']),rrdarchiv.get('HEARTBEAT',self.config['defaultHEARTBEAT']),str(rrdarchiv.get('MIN',self.config['defaultMIN'])),str(rrdarchiv.get('MAX',self.config['defaultMAX']))))) - for _a in rrdarchiv.get('ARCHIV',self.config['defaultARCHIV']).split(","): - for _r in rrdarchiv.get('RRA',self.config['defaultRRA']).split(","): + args.append(str("DS:value:%s:%d:%s:%s" % (rrdarchiv['VALTYPE'],rrdarchiv['HEARTBEAT'],str(rrdarchiv['MIN']),str(rrdarchiv['MAX'])))) + for _a in rrdarchiv['ARCHIV'].split(","): + for _r in rrdarchiv['RRA'].split(","): args.append(str(_r % _a)) startdate = int(time.time()) - 5 * 86400 @@ -90,7 +97,6 @@ except: __import__('traceback').print_exc(file=__import__('sys').stdout) print "FAILED WITH %r" % args - if ret: self.debug(rrdtool.error()) @@ -98,3 +104,4 @@ while self.isrunning: self.idle(1) + \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2010-11-14 17:28:58
|
Revision: 125 http://openautomation.svn.sourceforge.net/openautomation/?rev=125&view=rev Author: makki1 Date: 2010-11-14 17:28:46 +0000 (Sun, 14 Nov 2010) Log Message: ----------- RRD creation Modified Paths: -------------- PyWireGate/trunk/rrd_connector/RRD_Connector.py Modified: PyWireGate/trunk/rrd_connector/RRD_Connector.py =================================================================== --- PyWireGate/trunk/rrd_connector/RRD_Connector.py 2010-11-14 16:41:45 UTC (rev 124) +++ PyWireGate/trunk/rrd_connector/RRD_Connector.py 2010-11-14 17:28:46 UTC (rev 125) @@ -18,14 +18,15 @@ self.WG = parent.WG self.instanceName = instanceName - ## Deafaultconfig + ## Defaultconfig defaultconfig = { 'path':self.WG.scriptpath +"/rrd", 'defaultstep':300, + 'defaultDS':'value', 'defaultRRA':'RRA:%s:0.5:1:2160,RRA:%s:0.5:5:2016,RRA:%s:0.5:15:2880,RRA:%s:0.5:180:8760', 'defaultARCHIV':'AVERAGE,MIN,MAX', 'defaultVALTYPE':'GAUGE', - 'defaultHEARTBEAT':600, + 'defaultHEARTBEAT':900, 'defaultMIN':'-55', 'defaultMAX':'255000' @@ -62,23 +63,24 @@ def create(self,dsobj,rrdfilename): rrdarchiv = {} if 'rrd' in dsobj.config: - for cfg in ['RRA','ARCHIV','VALTYPE','HEARTBEAT','MIN','MAX']: + for cfg in ['DS','RRA','ARCHIV','VALTYPE','HEARTBEAT','MIN','MAX']: if cfg in dsobj.config['rrd']: rrdarchiv[cfg] = dsobj.config['rrd'][cfg] else: - rrdarchiv[cfg] = self.config['default%s' % cfg] + rrdarchiv[cfg] = self.config['default%s' % cfg] # FIXME: das mag nicht + #FIXME: needed if single DS per rrd? args = [] datasources = [] + dsobj.connected if len(datasources) == 0: datasources.append(dsobj.id) - for _d in datasources: - id = hashlib.md5(_d).hexdigest()[:19] - args.append(str("DS:%s:%s:%d:%s:%s" % (id,rrdarchiv['VALTYPE'],rrdarchiv['HEARTBEAT'],str(rrdarchiv['MIN']),str(rrdarchiv['MAX'])))) - for _a in rrdarchiv['ARCHIV'].split(","): - for _r in rrdarchiv['RRA'].split(","): +# for _d in datasources: +# id = hashlib.md5(_d).hexdigest()[:19] + args.append(str("DS:%s:%s:%d:%s:%s" % (rrdarchiv.get('DS',self.config['defaultDS']),rrdarchiv.get('VALTYPE',self.config['defaultVALTYPE']),rrdarchiv.get('HEARTBEAT',self.config['defaultHEARTBEAT']),str(rrdarchiv.get('MIN',self.config['defaultMIN'])),str(rrdarchiv.get('MAX',self.config['defaultMAX']))))) + for _a in rrdarchiv.get('ARCHIV',self.config['defaultARCHIV']).split(","): + for _r in rrdarchiv.get('RRA',self.config['defaultRRA']).split(","): args.append(str(_r % _a)) startdate = int(time.time()) - 5 * 86400 @@ -95,4 +97,4 @@ def run(self): while self.isrunning: self.idle(1) - \ No newline at end of file + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2010-11-14 17:08:31
|
Revision: 123 http://openautomation.svn.sourceforge.net/openautomation/?rev=123&view=rev Author: mayerch Date: 2010-11-14 16:16:00 +0000 (Sun, 14 Nov 2010) Log Message: ----------- Added cross links to the footer, i.e. the normal mode links to the edit and vice versa Modified Paths: -------------- CometVisu/trunk/visu/edit_config.html CometVisu/trunk/visu/index.html Modified: CometVisu/trunk/visu/edit_config.html =================================================================== --- CometVisu/trunk/visu/edit_config.html 2010-11-14 16:10:20 UTC (rev 122) +++ CometVisu/trunk/visu/edit_config.html 2010-11-14 16:16:00 UTC (rev 123) @@ -32,6 +32,7 @@ <div class="footer"> <img src="icon/comet_64_ff8000.png" alt="CometVisu" /> by <a href="http://www.cometvisu.org/">ComeVisu.org</a> - <a href="edit_config.html">Reload</a> + - <a href=".">normal Mode</a> </div> </div> Modified: CometVisu/trunk/visu/index.html =================================================================== --- CometVisu/trunk/visu/index.html 2010-11-14 16:10:20 UTC (rev 122) +++ CometVisu/trunk/visu/index.html 2010-11-14 16:16:00 UTC (rev 123) @@ -27,6 +27,7 @@ <div class="footer"> <img src="icon/comet_64_000000.png" alt="CometVisu" /> by <a href="http://www.cometvisu.org/">CometVisu.org</a> - <a href=".">Reload</a> + - <a href="edit_config.html">Edit</a> </div> </div> </body> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2010-11-14 17:08:20
|
Revision: 122 http://openautomation.svn.sourceforge.net/openautomation/?rev=122&view=rev Author: mayerch Date: 2010-11-14 16:10:20 +0000 (Sun, 14 Nov 2010) Log Message: ----------- Add new custom widget to toggle beween designs and insert it into the demo config Modified Paths: -------------- CometVisu/trunk/visu/lib/visudesign_custom.js CometVisu/trunk/visu/visu_config.xml Modified: CometVisu/trunk/visu/lib/visudesign_custom.js =================================================================== --- CometVisu/trunk/visu/lib/visudesign_custom.js 2010-11-14 12:55:07 UTC (rev 121) +++ CometVisu/trunk/visu/lib/visudesign_custom.js 2010-11-14 16:10:20 UTC (rev 122) @@ -34,3 +34,41 @@ }); **************************************** */ + +/** + * This is a custom function that extends the available widgets. + * It's purpose is to change the design of the visu during runtime + * to demonstrate all available + */ +VisuDesign_Custom.prototype.addCreator("designtoggle", { + create: function( page, path ) { + var ret_val = $('<div class="widget" />'); + ret_val.addClass( 'switch' ); + var label = '<div class="label">' + page.textContent + '</div>'; + var actor = '<div class="actor switchUnpressed">'; + var value = $('link').attr('href').split('/')[1]; + actor += '<div class="value">' + value + '</div>'; + actor += '</div>'; + ret_val.append( label ).append( $(actor).data( { + 'mapping' : $(page).attr('mapping'), + 'style' : $(page).attr('style'), + 'value' : value, + 'type' : 'toggle' + } ).bind('click',designToggleAction) ); + return ret_val; + }, + attributes: { + }, + content: "string" +}); + +function designToggleAction() +{ + var designs = [ 'pure', 'discreet' ]; + var oldDesign = $('.value',this).text(); + var newDesign = designs[ (designs.indexOf(oldDesign) + 1) % designs.length ]; + $('.value',this).text(newDesign); + $('link').each(function(){ + this.href = this.href.replace( oldDesign, newDesign ); + }); +} Modified: CometVisu/trunk/visu/visu_config.xml =================================================================== --- CometVisu/trunk/visu/visu_config.xml 2010-11-14 12:55:07 UTC (rev 121) +++ CometVisu/trunk/visu/visu_config.xml 2010-11-14 16:10:20 UTC (rev 122) @@ -44,6 +44,7 @@ <slide address="12/4/250" datatype="9" min="-18" max="26">Slide</slide> <info address="12/4/250" datatype="9" style="BluePurpleRed">Slide Info</info> <info address="12/4/250" datatype="9" style="BluePurpleRed" mapping="Sign">Slide Info</info> + <designtoggle>Change design</designtoggle> <line /> <image src="icon/comet_128_ff8000.png" >Ein Bild</image> <image src="icon/comet_128_ff8000.png" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2010-11-14 17:08:14
|
Revision: 124 http://openautomation.svn.sourceforge.net/openautomation/?rev=124&view=rev Author: mayerch Date: 2010-11-14 16:41:45 +0000 (Sun, 14 Nov 2010) Log Message: ----------- Fixed design change to work under edit mode as well Modified Paths: -------------- CometVisu/trunk/visu/edit_config.html CometVisu/trunk/visu/lib/visudesign_custom.js Modified: CometVisu/trunk/visu/edit_config.html =================================================================== --- CometVisu/trunk/visu/edit_config.html 2010-11-14 16:16:00 UTC (rev 123) +++ CometVisu/trunk/visu/edit_config.html 2010-11-14 16:41:45 UTC (rev 124) @@ -5,7 +5,7 @@ <head> <title>Visu - Editor-Modus</title> <meta name="viewport" content="width=device-width, initial-scale=1" /> - <link rel="stylesheet" type="text/css" href="style_discreet.css" /> +<!-- <link rel="stylesheet" type="text/css" href="style_discreet.css" /> --> <link rel="stylesheet" type="text/css" href="edit/style_edit.css" /> <script src="lib/jquery.js" type="text/javascript"></script> <script src="lib/jquery-ui.js" type="text/javascript"></script> Modified: CometVisu/trunk/visu/lib/visudesign_custom.js =================================================================== --- CometVisu/trunk/visu/lib/visudesign_custom.js 2010-11-14 16:16:00 UTC (rev 123) +++ CometVisu/trunk/visu/lib/visudesign_custom.js 2010-11-14 16:41:45 UTC (rev 124) @@ -46,7 +46,7 @@ ret_val.addClass( 'switch' ); var label = '<div class="label">' + page.textContent + '</div>'; var actor = '<div class="actor switchUnpressed">'; - var value = $('link').attr('href').split('/')[1]; + var value = $('link[href*="designs"]').attr('href').split('/')[1]; actor += '<div class="value">' + value + '</div>'; actor += '</div>'; ret_val.append( label ).append( $(actor).data( { @@ -68,7 +68,7 @@ var oldDesign = $('.value',this).text(); var newDesign = designs[ (designs.indexOf(oldDesign) + 1) % designs.length ]; $('.value',this).text(newDesign); - $('link').each(function(){ + $('link[href*="designs"]').each(function(){ this.href = this.href.replace( oldDesign, newDesign ); }); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-14 12:55:18
|
Revision: 121 http://openautomation.svn.sourceforge.net/openautomation/?rev=121&view=rev Author: nilss1 Date: 2010-11-14 12:55:07 +0000 (Sun, 14 Nov 2010) Log Message: ----------- Fix KeyError when sending to unknown datastoreObject Modified Paths: -------------- PyWireGate/trunk/datastore.py Modified: PyWireGate/trunk/datastore.py =================================================================== --- PyWireGate/trunk/datastore.py 2010-11-14 09:55:23 UTC (rev 120) +++ PyWireGate/trunk/datastore.py 2010-11-14 12:55:07 UTC (rev 121) @@ -290,7 +290,7 @@ self.read_mutex.release() for attached in self.connected: try: - self.WG.DATASTORE.dataobjects[attached].setValue(val,True,source=self) + self.WG.DATASTORE.get(attached).setValue(val,True,source=self) except: self.WG.log("sendconnected failed for %s" % attached,'error') __import__('traceback').print_exc(file=__import__('sys').stdout) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-14 09:55:33
|
Revision: 120 http://openautomation.svn.sourceforge.net/openautomation/?rev=120&view=rev Author: nilss1 Date: 2010-11-14 09:55:23 +0000 (Sun, 14 Nov 2010) Log Message: ----------- Add rrd-connector Modified Paths: -------------- PyWireGate/trunk/rrd_connector/RRD_Connector.py Modified: PyWireGate/trunk/rrd_connector/RRD_Connector.py =================================================================== --- PyWireGate/trunk/rrd_connector/RRD_Connector.py 2010-11-14 09:54:53 UTC (rev 119) +++ PyWireGate/trunk/rrd_connector/RRD_Connector.py 2010-11-14 09:55:23 UTC (rev 120) @@ -1,3 +1,7 @@ +import time +import hashlib +import re +import os try: import rrdtool except ImportError: @@ -9,4 +13,86 @@ CONNECTOR_NAME = 'RRD Connector' CONNECTOR_VERSION = 0.1 CONNECTOR_LOGNAME = __name__ - pass + def __init__(self,parent,instanceName): + self._parent = parent + self.WG = parent.WG + self.instanceName = instanceName + + ## Deafaultconfig + defaultconfig = { + 'path':self.WG.scriptpath +"/rrd", + 'defaultstep':300, + 'defaultRRA':'RRA:%s:0.5:1:2160,RRA:%s:0.5:5:2016,RRA:%s:0.5:15:2880,RRA:%s:0.5:180:8760', + 'defaultARCHIV':'AVERAGE,MIN,MAX', + 'defaultVALTYPE':'GAUGE', + 'defaultHEARTBEAT':600, + 'defaultMIN':'-55', + 'defaultMAX':'255000' + + } + + ## check Defaultconfig Options in main configfile + self.WG.checkconfig(self.instanceName,defaultconfig) + + ## set local config + self.config = self.WG.config[self.instanceName] + self.start() + + + def setValue(self,dsobj,msg=False): + rrdfilename = self.config['path'] +"/"+ re.sub(r"[^\w]","_",(str(dsobj.id)))+".rrd" + if not os.path.exists(rrdfilename): + self.create(dsobj,rrdfilename) + val = "N" + if len(dsobj.connected) == 0: + val += ":%.2f" % dsobj.getValue() + + for objid in dsobj.connected: + obj = self.WG.DATASTORE.dataobjects[objid] + oval = obj.getValue() + if oval == None or type(oval) not in (int,float): + oval = "U" + else: + oval = "%.2f" % oval + val += ":%s" % oval + + print "RRD %s VAL: %r" % (rrdfilename,val) + rrdtool.update(rrdfilename,val) + + def create(self,dsobj,rrdfilename): + rrdarchiv = {} + if 'rrd' in dsobj.config: + for cfg in ['RRA','ARCHIV','VALTYPE','HEARTBEAT','MIN','MAX']: + if cfg in dsobj.config['rrd']: + rrdarchiv[cfg] = dsobj.config['rrd'][cfg] + else: + rrdarchiv[cfg] = self.config['default%s' % cfg] + + args = [] + datasources = [] + dsobj.connected + if len(datasources) == 0: + datasources.append(dsobj.id) + + + for _d in datasources: + id = hashlib.md5(_d).hexdigest()[:19] + args.append(str("DS:%s:%s:%d:%s:%s" % (id,rrdarchiv['VALTYPE'],rrdarchiv['HEARTBEAT'],str(rrdarchiv['MIN']),str(rrdarchiv['MAX'])))) + for _a in rrdarchiv['ARCHIV'].split(","): + for _r in rrdarchiv['RRA'].split(","): + args.append(str(_r % _a)) + + startdate = int(time.time()) - 5 * 86400 + ret = 0 + try: + ret = rrdtool.create(rrdfilename,'--start',str(startdate), *tuple(args)) + except: + __import__('traceback').print_exc(file=__import__('sys').stdout) + print "FAILED WITH %r" % args + + + if ret: + self.debug(rrdtool.error()) + def run(self): + while self.isrunning: + self.idle(1) + \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-14 09:55:04
|
Revision: 119 http://openautomation.svn.sourceforge.net/openautomation/?rev=119&view=rev Author: nilss1 Date: 2010-11-14 09:54:53 +0000 (Sun, 14 Nov 2010) Log Message: ----------- add defaultencoding option Modified Paths: -------------- PyWireGate/trunk/WireGate.py Modified: PyWireGate/trunk/WireGate.py =================================================================== --- PyWireGate/trunk/WireGate.py 2010-11-14 09:53:57 UTC (rev 118) +++ PyWireGate/trunk/WireGate.py 2010-11-14 09:54:53 UTC (rev 119) @@ -62,7 +62,8 @@ 'datastore' : "%s/datastore.db" % self.scriptpath, 'logfile' : "%s/wiregated.log" % self.scriptpath, 'errorlog' : "%s/wiregated-error.log" % self.scriptpath, - 'loglevel': 'info' + 'loglevel': 'info', + 'defaultencoding': 'UTF-8' } self.checkconfig("WireGate",defaultconfig) @@ -117,7 +118,6 @@ def run(self): - import time for configpart in self.config.keys(): if "connector" in self.config[configpart]: name = configpart @@ -249,7 +249,7 @@ logger.setLevel(level) if filename: ## python handle logrotating - handler = log.logging.handlers.TimedRotatingFileHandler(filename,'MIDNIGHT',encoding='utf-8',backupCount=7) + handler = log.logging.handlers.TimedRotatingFileHandler(filename,'MIDNIGHT',encoding=self.WG.config['WireGate']['defaultencoding'],backupCount=7) ## Handler if logrotate handles Logfiles #handler = logging.handlers.WatchedFileHandle(filename) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-14 09:54:08
|
Revision: 118 http://openautomation.svn.sourceforge.net/openautomation/?rev=118&view=rev Author: nilss1 Date: 2010-11-14 09:53:57 +0000 (Sun, 14 Nov 2010) Log Message: ----------- change from repr to str for getting dsobject name Modified Paths: -------------- PyWireGate/trunk/scheduler.py Modified: PyWireGate/trunk/scheduler.py =================================================================== --- PyWireGate/trunk/scheduler.py 2010-11-14 09:52:13 UTC (rev 117) +++ PyWireGate/trunk/scheduler.py 2010-11-14 09:53:57 UTC (rev 118) @@ -44,10 +44,12 @@ obj = self.WG.DATASTORE.dataobjects[shed] if 'cron' in obj.config: kwargs = {} + + ## change config from unicode to str for uoption in obj.config['cron'].keys(): kwargs[str(uoption)] = str(obj.config['cron'][uoption]) - self.debug("Adding %s - %r" % (shed,obj)) + self.debug("Adding %s - %s" % (shed,obj)) setattr(obj.sendConnected.im_func,'__name__',"%s" % shed.encode('UTF-8')) self.SCHEDULER.add_cron_job(self.WG.DATASTORE.dataobjects[shed].sendConnected,**kwargs) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-14 09:52:26
|
Revision: 117 http://openautomation.svn.sourceforge.net/openautomation/?rev=117&view=rev Author: nilss1 Date: 2010-11-14 09:52:13 +0000 (Sun, 14 Nov 2010) Log Message: ----------- Add some hooks for connectors Modified Paths: -------------- PyWireGate/trunk/datastore.py Modified: PyWireGate/trunk/datastore.py =================================================================== --- PyWireGate/trunk/datastore.py 2010-11-12 23:53:55 UTC (rev 116) +++ PyWireGate/trunk/datastore.py 2010-11-14 09:52:13 UTC (rev 117) @@ -68,7 +68,7 @@ self.debug("Updating %s (%s): %r" % (obj.name,id,val)) ## Set the value of the object - obj.setValue(val) + obj.setValue(val,source=connector) ##TODO: central subscriber function for other connectore or servers @@ -103,7 +103,7 @@ def load(self): self.debug("load DATASTORE") try: - db = codecs.open(self.WG.config['WireGate']['datastore'],"rb",encoding='utf-8') + db = codecs.open(self.WG.config['WireGate']['datastore'],"r",encoding=self.WG.config['WireGate']['defaultencoding']) loaddict = json.load(db) db.close() for name, obj in loaddict.items(): @@ -120,7 +120,7 @@ except ValueError: ## empty DB File self.DBLOADED = True - pass + raise except: self.WG.errorlog() ## error @@ -145,7 +145,7 @@ 'config' : obj.config, 'connected' : obj.connected } - dbfile = codecs.open(self.WG.config['WireGate']['datastore'],"wb",encoding='utf-8') + dbfile = codecs.open(self.WG.config['WireGate']['datastore'],"w",encoding=self.WG.config['WireGate']['defaultencoding']) utfdb = json.dumps(savedict,dbfile,ensure_ascii=False,sort_keys=True,indent=3) dbfile.write(utfdb) dbfile.close() @@ -197,16 +197,14 @@ ## set Name to function for Scheduler if type(self.name) <> unicode: - ## guess that non unicode is iso8859 - self.name = name.decode("iso-8859-15") + ## guess that non unicode is default encoded + self.name = name.decode(self.WG.config['WireGate']['defaultencoding']) ## some defaults self.value = None self.lastupdate = 0 + self.lastsource = None self.id = id - ## Fixme: dpt is only KNX specific , should be moved to self.config['KNX:dptid'] - self.dptid = -1 - ## connector specific vars self.config = {} @@ -217,7 +215,20 @@ self.connected = [] def __repr__(self): + return json.dumps({ + 'name' : self.name, + 'id' : self.id, + 'value' : self.value, + 'lastupdate' : self.lastupdate, + 'config' : self.config, + 'connected' : self.connected + }) + + + def __str__(self): return "%s - %s" % (self.id,self.name) + + def _setValue(self,refered_self): ## self override ## override with connector send function @@ -229,7 +240,7 @@ finally: self.write_mutex.release() - def setValue(self,val,send=False): + def setValue(self,val,send=False,source=None): if 'sendcycle' in self.config and self.value <> None: if not self._cyclejob: self._parent.debug("start Cycle ID: %s" % self.id) @@ -251,9 +262,9 @@ self._parent.debug("ignore Cycle ID: %s" % self.id) self.cyclestore.append(val) else: - self._real_setValue(val,send) + self._real_setValue(val,send,source=source) - def _real_setValue(self,val,send): + def _real_setValue(self,val,send,source=None): try: ## get read lock self.read_mutex.acquire() @@ -261,9 +272,10 @@ self.write_mutex.acquire() ## save the modified time self.lastupdate = time.time() + self.lastsource = source if type(val) == str: self.WG.log("Non Unicode Value received for %s" % self.id,'warning') - val = unicode(val,encoding='iso-8859-15',errors='ignore') + val = unicode(val,encoding=self.WG.config['WireGate']['defaultencoding'],errors='ignore') self.value = val if send: self._setValue(self) @@ -278,18 +290,21 @@ self.read_mutex.release() for attached in self.connected: try: - self.WG.DATASTORE.dataobjects[attached].setValue(val,True) + self.WG.DATASTORE.dataobjects[attached].setValue(val,True,source=self) except: self.WG.log("sendconnected failed for %s" % attached,'error') - #__import__('traceback').print_exc(file=__import__('sys').stdout) + __import__('traceback').print_exc(file=__import__('sys').stdout) - def getValue(self): + def getValue(self,other=''): try: ## get read lock self.read_mutex.acquire() - return self.value + ret = self.value + if other == 'lastupdate': + ret = [ret,self.lastupdate] + return ret finally: ## release lock self.read_mutex.release() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |