@@ -39,8 +39,10 @@ Thin-edge devices support sending simple measurements with units
3939
4040Thin-edge devices support sending complex measurements with units
4141 # Using a test-specific measurement is required to not interfer with other tests
42- Execute Command tedge mqtt pub -r te/device/main///m/t2/meta '{ "Climate": { "Temperature": { "unit": "°C" }, "Pressure": { "unit": "bar" }}}'
43- Execute Command tedge mqtt pub te/device/main///m/t2 '{ "Climate": { "Temperature": 19.42, "Pressure": 1.013 }, "Engine": { "Temperature": 350.42, "Pressure": 321.0 }}'
42+ Execute Command
43+ ... tedge mqtt pub -r te/device/main///m/t2/meta '{ "Climate.Temperature": { "unit": "°C" }, "Climate.Pressure": { "unit": "bar" }}'
44+ Execute Command
45+ ... tedge mqtt pub te/device/main///m/t2 '{ "Climate": { "Temperature": 19.42, "Pressure": 1.013 }, "Engine": { "Temperature": 350.42, "Pressure": 321.0 }}'
4446 ${measurements } = Device Should Have Measurements
4547 ... minimum=1
4648 ... maximum=1
@@ -58,6 +60,73 @@ Thin-edge devices support sending complex measurements with units
5860 Should Be Equal As Numbers ${measurements[0]["Engine"]["Pressure"]["value"] } 321.0
5961 Should Not Contain ${measurements[0]["Engine"]["Pressure"] } unit
6062
63+ Measurement units are specific to each measurement type
64+ # Using a test-specific measurement is required to not interfer with other tests
65+ Execute Command tedge mqtt pub -r te/device/main///m/t3/meta '{ "temperature": { "unit": "°C" } }'
66+ Execute Command tedge mqtt pub -r te/device/main///m/t4/meta '{ "temperature": { "unit": "°F" } }'
67+ Execute Command tedge mqtt pub te/device/main///m/t3 '{ "temperature": 25 }'
68+ Execute Command tedge mqtt pub te/device/main///m/t4 '{ "temperature": 25 }'
69+ ${measurements } = Device Should Have Measurements
70+ ... minimum=1
71+ ... maximum=1
72+ ... type=t3
73+ ... value=temperature
74+ ... series=temperature
75+ Log ${measurements }
76+ Should Be Equal ${measurements[0]["temperature"]["temperature"]["unit"] } °C
77+ ${measurements } = Device Should Have Measurements
78+ ... minimum=1
79+ ... maximum=1
80+ ... type=t4
81+ ... value=temperature
82+ ... series=temperature
83+ Log ${measurements }
84+ Should Be Equal ${measurements[0]["temperature"]["temperature"]["unit"] } °F
85+
86+ Measurement units can be updated
87+ # Using a test-specific measurement is required to not interfer with other tests
88+ Execute Command tedge mqtt pub -r te/device/main///m/t5/meta '{ "temperature": { "unit": "°C" } }'
89+ Execute Command tedge mqtt pub te/device/main///m/t5 '{ "temperature": 25 }'
90+ Execute Command tedge mqtt pub -r te/device/main///m/t5/meta '{ "temperature": { "unit": "°F" } }'
91+ Execute Command tedge mqtt pub te/device/main///m/t5 '{ "temperature": 298.15 }'
92+ ${measurements } = Device Should Have Measurements
93+ ... minimum=2
94+ ... maximum=2
95+ ... type=t5
96+ ... value=temperature
97+ ... series=temperature
98+ Log ${measurements }
99+ Should Be Equal ${measurements[0]["temperature"]["temperature"]["unit"] } °C
100+ Should Be Equal ${measurements[1]["temperature"]["temperature"]["unit"] } °F
101+
102+ Measurement units can be cleared
103+ # Using a test-specific measurement is required to not interfer with other tests
104+ Execute Command tedge mqtt pub -r te/device/main///m/t6/meta '{ "temperature": { "unit": "°C" } }'
105+ Execute Command tedge mqtt pub te/device/main///m/t6 '{ "temperature": 25 }'
106+ ${measurements } = Device Should Have Measurements
107+ ... minimum=1
108+ ... maximum=1
109+ ... type=t6
110+ ... value=temperature
111+ ... series=temperature
112+ ... reverse=${True }
113+ ... after=1970-01-01
114+ Should Be Equal ${measurements[0]["temperature"]["temperature"]["unit"] } °C
115+ # Execute Command sleep 1
116+ Execute Command tedge mqtt pub -r te/device/main///m/t6/meta ''
117+ Execute Command sleep 1
118+ Execute Command tedge mqtt pub te/device/main///m/t6 '{ "temperature": 298.15 }'
119+ ${measurements } = Device Should Have Measurements
120+ ... minimum=2
121+ ... maximum=2
122+ ... type=t6
123+ ... value=temperature
124+ ... series=temperature
125+ ... after=1970-01-01
126+ ... reverse=${True }
127+ Log ${measurements }
128+ Should Not Contain ${measurements[0]["temperature"]["temperature"] } unit
129+
61130Thin-edge devices support sending simple measurements with custom type
62131 Execute Command tedge mqtt pub te/device/main///m/ '{ "type":"CustomType", "temperature": 25 }'
63132 ${measurements } = Device Should Have Measurements
0 commit comments