Changes between Version 6 and Version 7 of Proposal


Ignore:
Timestamp:
May 27, 2013, 12:46:01 PM (11 years ago)
Author:
Frédéric
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Proposal

    v6 v7  
    1717== Virtual Device ==
    1818
    19 This is a central feature of '''pKNyX''', allowing user to create virtual devices which mimics real KNX devices. They follow the same architecture, like having '''Datapoints''' (aka as Communication Objects), which have to be linked to '''Group Address''' to communicate.
     19This 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:
     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 Weather Underground or so:
    2222
    2323{{{
     
    2525from pknyx.api import Device, ETS
    2626
    27 class Vent(Device):
    28     DP_01 = ("temp_1", "9.001", "cwtu", "low", 0)
    29     DP_02 = {'name': "temp_2", dptId: "9.001", 'flags': "cwtu", 'priority': "low", 'initValue': 0}
    30     DP_03 = dict(name="temp_3", dptId="9.001", flags="cwtu", priority="low", initValue=0)
     27# Weather station class definition
     28class WeatherStation(Device):
    3129
    32 myVent = Vent("1.2.3")
    33 ETS.link(myVent, "temp_1", "1/1/1")
    34 ETS.link(myVent, "temp_2", "1/1/2")
    35 ETS.link(myVent, "temp_3", "1/1/3")
     30    # Datapoints (= Communication objects) definition
     31    DP_01 = dict(name="temperature", dptId="9.001", flags="crt", priority="low", initValue=0.)
     32    DP_02 = dict(name="humidity", dptId="9.007", flags="crt", priority="low", initValue=0.)
     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")
     35    DP_05 = dict(name="wind_limit", dptId="9.005", flags="cwtu", priority="low", initValue=15.)
     36    DP_06 = dict(name="wind_alarm_enable", dptId="1.003", flags="cwtu", priority="low", initValue="Disable")
     37
     38# Instanciation of the weather station device object
     39station = WeatherStation(name="weather", address="1.2.3")
     40
     41# Linking weather station Datapoints to Group Address
     42ETS.link(device=station, dp="temperature", gad="1/1/1")
     43ETS.link(device=station, dp="humidity", gad="1/1/2")
     44ETS.link(device=station, dp="wind_speed", gad="1/1/3")
     45ETS.link(device=station, dp="wind_alarm", gad="1/1/4")
     46ETS.link(device=station, dp="wind_limit", gad="1/1/5")
     47ETS.link(device=station, dp="wind_alarm_enable", gad="1/1/6")
     48
    3649}}}
    3750
    38 That's it!
     51That's it! Ok, that device does not do much things...