Changes between Version 10 and Version 11 of Proposal
- Timestamp:
- May 27, 2013, 3:30:34 PM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Proposal
v10 v11 19 19 This will be the central feature of '''pKNyX''', allowing user to create virtual devices which mimics real KNX devices. They will follow the same architecture, like having '''Datapoints''' (aka as Communication Objects), which have to be linked to '''Group Address''' to communicate. 20 20 21 Here is a very simple example of what I have in mind: creating a virtual weather station, which uses informations from a non-KNX real weather-station, or even from a web site, like Weather Underground or so:21 Here is a very simple example of what I have in mind: creating a virtual weather station, which uses informations from a non-KNX real weather-station, or even from a web site, like xxx: 22 22 23 23 {{{ … … 32 32 DP_02 = dict(name="humidity", dptId="9.007", flags="CRT", priority="low", initValue=0.) 33 33 DP_03 = dict(name="wind_speed", dptId="9.005", flags="CRT", priority="low", initValue=0.) 34 DP_04 = dict(name="wind_alarm", dptId="1.005", flags="CRT", priority="high", initValue=" "No alarm")34 DP_04 = dict(name="wind_alarm", dptId="1.005", flags="CRT", priority="high", initValue="No alarm") 35 35 DP_05 = dict(name="wind_speed_limit", dptId="9.005", flags="CWTU", priority="low", initValue=15.) 36 36 DP_06 = dict(name="wind_alarm_enable", dptId="1.003", flags="CWTU", priority="low", initValue="Disable") … … 65 65 DP_02 = dict(name="humidity", dptId="9.007", flags="CRT", priority="low", initValue=0.) 66 66 DP_03 = dict(name="wind_speed", dptId="9.005", flags="CRT", priority="low", initValue=0.) 67 DP_04 = dict(name="wind_alarm", dptId="1.005", flags="CRT", priority="high", initValue=" "No alarm")67 DP_04 = dict(name="wind_alarm", dptId="1.005", flags="CRT", priority="high", initValue="No alarm") 68 68 DP_05 = dict(name="wind_speed_limit", dptId="9.005", flags="CWTU", priority="low", initValue=15.) 69 69 DP_06 = dict(name="wind_alarm_enable", dptId="1.003", flags="CWTU", priority="low", initValue="Disable") 70 70 71 @Device.schedule.every(minute s=5)71 @Device.schedule.every(minute=5) 72 72 def readWindSpeed(self): 73 73 … … 100 100 That's it for now. This is only a draft version; final implementation may change, according to feedback/suggestions I will get. But the core is all there. Again, the goal of the framework is to provide very high level tools to build complete and powerfull applications and KNX extensions. 101 101 102 == Other ideas ==102 == Simple rules == 103 103 104 My first idea was to provide a special API to create rules, in a simple way, like this: 105 106 {{{ 107 #!python 108 from pknyx.api import trigger, group 109 110 @trigger.schedule.every(minute=5) 111 def heatingBathroomManagement(event): 112 113 tempObj = group.findById("bathroom_temp") 114 tempSetupObj = group.findById("bathroom_temp_setup") 115 heaterObj = group.findById("bathroom_heater") 116 117 if temp.value < tempSetup.value - 0.25: 118 heaterObj.value = 1 119 elif temp.value > tempSetup.value + 0.25: 120 heaterObj.value = 0 121 }}} 122 123 but it implies to define the group objects mapping, which is exactly what we did in the [[#Virtual device|Virtual Device]] example! So, let's see rules as virtual devices... All we have to do is to define the needed Datapoints: 124 125 {{{ 126 #!python 127 from pknyx.api import Rule, ETS 128 129 class BathroomHeater(Rule): 130 131 DP_01 = dict(name="bathroom_temp", dptId="9.001", flags="CWTU", priority="low") 132 DP_02 = dict(name="bathroom_temp_setup", dptId="9.001", flags="CWTU", priority="low") 133 DP_04 = dict(name="bathroom_heater", dptId="1.001", flags="CWTU", priority="high") 134 135 @Rule.schedule.every(minute=5) 136 def readTemperature(self): 137 138 if self.dp["bathroom_temp"].value < self.dp["bathroom_temp_setup"].value - 0.25: 139 self.dp["bathroom_heater"].value = "On" 140 elif self.dp["bathroom_temp"].value > self.dp["bathroom_temp_setup"].value + 0.25: 141 self.dp["bathroom_heater"].value = "Off" 142 143 rule = BathroomHeater(name="bathroom_heater", desc="Bathroom heating management", address="1.2.3") 144 ETS.link(device=station, dp="bathroom_temp", gad="1/1/1") 145 ETS.link(device=station, dp="bathroom_temp_setup", gad="1/1/2") 146 ETS.link(device=station, dp="bathroom_heater", gad="1/1/3") 147 }}} 148 149 This way, we use the same paradigm, which is always better ;) 150 151 == '''linknx''' compatibility mode == 152 153 As I still want to use knxweb, I also plan to develop a special device-like object to mimic '''linknx''' behaviour. All it has to do is to provide the basic xml services used by clients, to display bus status and send orders. Other features, like advanced configuration, rules and so, will be omitted. 154 155 Again, we can use the same paradigm as for virtual devices and rules. The framework will provide another custom class for that purpose, but it will be used the same way. It will just add specific features, and the internal structure to act as a '''linknx'''-like server. 156 157 == Specific server mode == 158 159 == Unsorted ideas == 160 161 * xxx