diff --git a/src/utils/report/doc/user_guide_module_report.odt b/src/utils/report/doc/user_guide_module_report.odt index c7616cd..b05cf1d 100644 Binary files a/src/utils/report/doc/user_guide_module_report.odt and b/src/utils/report/doc/user_guide_module_report.odt differ diff --git a/src/utils/report/status_json.py b/src/utils/report/status_json.py index d06119e..077a34a 100644 --- a/src/utils/report/status_json.py +++ b/src/utils/report/status_json.py @@ -25,7 +25,7 @@ class Status_json: Example a a very wimple Json file report contents: { - "frame_model": "1.1", + "frame_model": "1.2", "name_creator": "PLC", "version_creator": "20180909", "entities": [ @@ -34,7 +34,7 @@ Example a a very wimple Json file report contents: "origin": "Raspberry", "version_firmware": "20180924A", "site": "MyObservatory", - "date": "2018-09-25T22:24:16.387", + "date": "2018-11-29T15:07:20.999", "devices": [ { "device_name": "DHT22", @@ -44,10 +44,10 @@ Example a a very wimple Json file report contents: "device_values": [ { "name": "OutsideTemperature", - "type": "float", + "data_type": "float", "value": "22", "unit": "degC", - "monitoring_name": "temperature", + "monitoring_name": "Temperature_outside", "comment": "Temperature" } ] @@ -56,7 +56,7 @@ Example a a very wimple Json file report contents: } ] } - + A value is stored in a UFKI (Unique Four Key Identifier): UFKI = entity_name device_name serial_number name @@ -239,7 +239,7 @@ https://github.com/hjson/hjson-py #################################################################### def _status_new(self, name_creator, version_creator): - status_header = {'frame_model':'1.1', 'name_creator':name_creator, 'version_creator':version_creator, 'entities':[]} + status_header = {'frame_model':'1.2', 'name_creator':name_creator, 'version_creator':version_creator, 'entities':[]} #self._status = { 'statuses':[] } #self._status['statuses'].append(status_header) self._status = status_header @@ -483,7 +483,7 @@ https://github.com/hjson/hjson-py res.append(re) return res - def get_values(self, only_device_name="", only_serial_number="", getvalue=False): + def get_ufkis(self, only_device_name="", only_serial_number="", getvalue=False): """ Get the current values Inputs: @@ -494,6 +494,7 @@ https://github.com/hjson/hjson-py ------ >>> report = report.Status_json() >>> print("{}",format(report.get_devices())) + >>> print("{}",format(report.get_ufkis("","",True)) Related topics: --------------- @@ -521,6 +522,16 @@ https://github.com/hjson/hjson-py res.append(re) return res + def get_sensors(self, only_device_name="", only_serial_number="", getvalue=False): + """ Get the current values. Alias of get_ufkis. + """ + return self.get_ufkis(only_device_name, only_serial_number, getvalue); + + def get_values(self, only_device_name="", only_serial_number="", getvalue=False): + """ Get the current values. Alias of get_ufkis. + """ + return self.get_ufkis(only_device_name, only_serial_number, getvalue); + # ======================================================== # === debug methods @@ -604,10 +615,10 @@ if __name__ == "__main__": rep.append_device("DHT22", "meteo", "1", "0") rep.append_value( "OutsideTemperature", "float","22","degC","Temperature_outside","Temperature") # --- List the UFKIs - ufiks = rep.get_values("","",False) + ufkis = rep.get_ufkis("","",False) print(" List of all UFKIs:") - for ufik in ufiks: - print(" UFKI = {}".format(ufik)) + for ufki in ufkis: + print(" UFKI = {}".format(ufki)) # --- save the Json file rep.save_json("plc_verysimple.json") @@ -646,10 +657,10 @@ if __name__ == "__main__": rep.append_value( "SkyTemperature", "float","-15.67","degC","Temperature_sky","Temperature of the sky") rep.append_value( "CanTemperature", "float","22.47","degC","","Temperature of the TO can") # --- List the UFKIs - ufiks = rep.get_values("","",False) + ufkis = rep.get_ufkis("","",False) print(" List of all UFKIs:") - for ufik in ufiks: - print(" UFKI = {}".format(ufik)) + for ufki in ufkis: + print(" UFKI = {}".format(ufki)) # --- read the value of one UFKI # --- save the Json file @@ -667,6 +678,6 @@ if __name__ == "__main__": res = rep.get_devices() print(" devices = {}".format(res)) print(" List of all UFKIs:") - ufiks = rep.get_values("","",True) - for ufik in ufiks: - print(" UFKI = {}".format(ufik)) + ufkis = rep.get_ufkis("","",True) + for ufki in ufkis: + print(" UFKI = {}".format(ufki)) -- libgit2 0.21.2