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 |
| 28 | class WeatherStation(Device): |
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 |
| 39 | station = WeatherStation(name="weather", address="1.2.3") |
| 40 | |
| 41 | # Linking weather station Datapoints to Group Address |
| 42 | ETS.link(device=station, dp="temperature", gad="1/1/1") |
| 43 | ETS.link(device=station, dp="humidity", gad="1/1/2") |
| 44 | ETS.link(device=station, dp="wind_speed", gad="1/1/3") |
| 45 | ETS.link(device=station, dp="wind_alarm", gad="1/1/4") |
| 46 | ETS.link(device=station, dp="wind_limit", gad="1/1/5") |
| 47 | ETS.link(device=station, dp="wind_alarm_enable", gad="1/1/6") |
| 48 | |