Changes between Version 10 and Version 11 of Proposal


Ignore:
Timestamp:
May 27, 2013, 3:30:34 PM (11 years ago)
Author:
Frédéric
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Proposal

    v10 v11  
    1919This 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.
    2020
    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:
     21Here 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:
    2222
    2323{{{
     
    3232    DP_02 = dict(name="humidity", dptId="9.007", flags="CRT", priority="low", initValue=0.)
    3333    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")
    3535    DP_05 = dict(name="wind_speed_limit", dptId="9.005", flags="CWTU", priority="low", initValue=15.)
    3636    DP_06 = dict(name="wind_alarm_enable", dptId="1.003", flags="CWTU", priority="low", initValue="Disable")
     
    6565    DP_02 = dict(name="humidity", dptId="9.007", flags="CRT", priority="low", initValue=0.)
    6666    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")
    6868    DP_05 = dict(name="wind_speed_limit", dptId="9.005", flags="CWTU", priority="low", initValue=15.)
    6969    DP_06 = dict(name="wind_alarm_enable", dptId="1.003", flags="CWTU", priority="low", initValue="Disable")
    7070
    71     @Device.schedule.every(minutes=5)
     71    @Device.schedule.every(minute=5)
    7272    def readWindSpeed(self):
    7373
     
    100100That'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.
    101101
    102 == Other ideas ==
     102== Simple rules ==
    103103
     104My first idea was to provide a special API to create rules, in a simple way, like this:
     105
     106{{{
     107#!python
     108from pknyx.api import trigger, group
     109
     110@trigger.schedule.every(minute=5)
     111def 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
     123but 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
     127from pknyx.api import Rule, ETS
     128
     129class 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
     143rule = BathroomHeater(name="bathroom_heater", desc="Bathroom heating management", address="1.2.3")
     144ETS.link(device=station, dp="bathroom_temp", gad="1/1/1")
     145ETS.link(device=station, dp="bathroom_temp_setup", gad="1/1/2")
     146ETS.link(device=station, dp="bathroom_heater", gad="1/1/3")
     147}}}
     148
     149This way, we use the same paradigm, which is always better ;)
     150
     151== '''linknx''' compatibility mode ==
     152
     153As 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
     155Again, 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