diff --git a/src/main/java/Data/09a91c61-6572-4476-8bf1-310a2fb2eb02.json b/src/main/java/Data/09a91c61-6572-4476-8bf1-310a2fb2eb02.json index 0856e98..d3d2316 100644 --- a/src/main/java/Data/09a91c61-6572-4476-8bf1-310a2fb2eb02.json +++ b/src/main/java/Data/09a91c61-6572-4476-8bf1-310a2fb2eb02.json @@ -1 +1 @@ -[{"sensorId":"09a91c61-6572-4476-8bf1-310a2fb2eb02","datetimeMeasure":"2021-11-25T10:10:29.156Z","value":3.06,"groupId":null,"metadata":null}]externalTemperature,f9bb4a5c-f783-4bcf-8c34-0a7c3dd5a632 \ No newline at end of file +[{"sensorId":"09a91c61-6572-4476-8bf1-310a2fb2eb02","datetimeMeasure":"2021-12-10T15:31:31.804Z","value":3.68,"groupId":null,"metadata":null}]externalTemperature,f9bb4a5c-f783-4bcf-8c34-0a7c3dd5a632 \ No newline at end of file diff --git a/src/main/java/Data/1f49de66-0921-4583-ae68-ff0fcc070bd1.json b/src/main/java/Data/1f49de66-0921-4583-ae68-ff0fcc070bd1.json index f6fd92d..7c8e14c 100644 --- a/src/main/java/Data/1f49de66-0921-4583-ae68-ff0fcc070bd1.json +++ b/src/main/java/Data/1f49de66-0921-4583-ae68-ff0fcc070bd1.json @@ -1 +1 @@ -[{"sensorId":"1f49de66-0921-4583-ae68-ff0fcc070bd1","datetimeMeasure":"2021-11-25T10:13:23.813Z","value":21.64,"groupId":null,"metadata":null}]dielectricPermittivity,fd694041-581e-4c2c-9810-505e62b762e6 \ No newline at end of file +[{"sensorId":"1f49de66-0921-4583-ae68-ff0fcc070bd1","datetimeMeasure":"2021-12-10T15:34:04.506Z","value":20.92,"groupId":null,"metadata":null}]dielectricPermittivity,fd694041-581e-4c2c-9810-505e62b762e6 \ No newline at end of file diff --git a/src/main/java/Data/22e5b1b0-b28c-4aa1-97c7-94ff12c51384.json b/src/main/java/Data/22e5b1b0-b28c-4aa1-97c7-94ff12c51384.json index a1035f6..fddecd8 100644 --- a/src/main/java/Data/22e5b1b0-b28c-4aa1-97c7-94ff12c51384.json +++ b/src/main/java/Data/22e5b1b0-b28c-4aa1-97c7-94ff12c51384.json @@ -1 +1 @@ -[{"sensorId":"22e5b1b0-b28c-4aa1-97c7-94ff12c51384","datetimeMeasure":"2021-11-25T10:13:23.813Z","value":2.1,"groupId":null,"metadata":null}]soilTemperature,fd694041-581e-4c2c-9810-505e62b762e6 \ No newline at end of file +[{"sensorId":"22e5b1b0-b28c-4aa1-97c7-94ff12c51384","datetimeMeasure":"2021-12-10T15:34:04.506Z","value":4.1,"groupId":null,"metadata":null}]soilTemperature,fd694041-581e-4c2c-9810-505e62b762e6 \ No newline at end of file diff --git a/src/main/java/Data/3b6a8c15-5cea-4994-954d-5b25c22e2c32.json b/src/main/java/Data/3b6a8c15-5cea-4994-954d-5b25c22e2c32.json index a581e35..8bcad75 100644 --- a/src/main/java/Data/3b6a8c15-5cea-4994-954d-5b25c22e2c32.json +++ b/src/main/java/Data/3b6a8c15-5cea-4994-954d-5b25c22e2c32.json @@ -1 +1 @@ -[{"sensorId":"3b6a8c15-5cea-4994-954d-5b25c22e2c32","datetimeMeasure":"2021-11-25T10:13:23.813Z","value":36.5,"groupId":null,"metadata":null}]soilMoisture,fd694041-581e-4c2c-9810-505e62b762e6 \ No newline at end of file +[{"sensorId":"3b6a8c15-5cea-4994-954d-5b25c22e2c32","datetimeMeasure":"2021-12-10T15:34:04.506Z","value":35.7,"groupId":null,"metadata":null}]soilMoisture,fd694041-581e-4c2c-9810-505e62b762e6 \ No newline at end of file diff --git a/src/main/java/Data/5209815d-974f-4729-ae1a-06bd1000db67.json b/src/main/java/Data/5209815d-974f-4729-ae1a-06bd1000db67.json index e49097d..694c10e 100644 --- a/src/main/java/Data/5209815d-974f-4729-ae1a-06bd1000db67.json +++ b/src/main/java/Data/5209815d-974f-4729-ae1a-06bd1000db67.json @@ -1 +1 @@ -[{"sensorId":"5209815d-974f-4729-ae1a-06bd1000db67","datetimeMeasure":"2021-11-25T10:13:23.813Z","value":0.15,"groupId":null,"metadata":null}]soilConductivity,fd694041-581e-4c2c-9810-505e62b762e6 \ No newline at end of file +[{"sensorId":"5209815d-974f-4729-ae1a-06bd1000db67","datetimeMeasure":"2021-12-10T15:34:04.506Z","value":0.07,"groupId":null,"metadata":null}]soilConductivity,fd694041-581e-4c2c-9810-505e62b762e6 \ No newline at end of file diff --git a/src/main/java/Data/65e95c11-ec15-4039-840a-e9be3d77ca63.json b/src/main/java/Data/65e95c11-ec15-4039-840a-e9be3d77ca63.json index b95e553..af82349 100644 --- a/src/main/java/Data/65e95c11-ec15-4039-840a-e9be3d77ca63.json +++ b/src/main/java/Data/65e95c11-ec15-4039-840a-e9be3d77ca63.json @@ -1 +1 @@ -[{"sensorId":"65e95c11-ec15-4039-840a-e9be3d77ca63","datetimeMeasure":"2021-11-25T10:04:44.298Z","value":705.4,"groupId":null,"metadata":null}]precipitation,e8c3fca3-c5cd-48e7-9224-0f8c294fa3c0 \ No newline at end of file +[{"sensorId":"65e95c11-ec15-4039-840a-e9be3d77ca63","datetimeMeasure":"2021-12-10T15:29:08.613Z","value":748.8,"groupId":null,"metadata":null}]precipitation,e8c3fca3-c5cd-48e7-9224-0f8c294fa3c0 \ No newline at end of file diff --git a/src/main/java/Data/69bcaae0-9ccd-4342-8a71-c72dca37cfe9.json b/src/main/java/Data/69bcaae0-9ccd-4342-8a71-c72dca37cfe9.json index e82312a..9848591 100644 --- a/src/main/java/Data/69bcaae0-9ccd-4342-8a71-c72dca37cfe9.json +++ b/src/main/java/Data/69bcaae0-9ccd-4342-8a71-c72dca37cfe9.json @@ -1 +1 @@ -[{"sensorId":"69bcaae0-9ccd-4342-8a71-c72dca37cfe9","datetimeMeasure":"2021-11-25T10:13:22.838Z","value":5.064,"groupId":null,"metadata":null}]battery,6c9efd4a-db04-453d-8ab8-d480ec97dd26 \ No newline at end of file +[{"sensorId":"69bcaae0-9ccd-4342-8a71-c72dca37cfe9","datetimeMeasure":"2021-12-10T15:34:09.418Z","value":4.721,"groupId":null,"metadata":null}]battery,6c9efd4a-db04-453d-8ab8-d480ec97dd26 \ No newline at end of file diff --git a/src/main/java/Data/812c6e62-e855-424b-8ec1-78fb424a94b5.json b/src/main/java/Data/812c6e62-e855-424b-8ec1-78fb424a94b5.json index c3a3250..b89c49f 100644 --- a/src/main/java/Data/812c6e62-e855-424b-8ec1-78fb424a94b5.json +++ b/src/main/java/Data/812c6e62-e855-424b-8ec1-78fb424a94b5.json @@ -1 +1 @@ -[{"sensorId":"812c6e62-e855-424b-8ec1-78fb424a94b5","datetimeMeasure":"2021-11-25T10:04:44.298Z","value":33.4,"groupId":null,"metadata":null}]soilMoisture,e8c3fca3-c5cd-48e7-9224-0f8c294fa3c0 \ No newline at end of file +[{"sensorId":"812c6e62-e855-424b-8ec1-78fb424a94b5","datetimeMeasure":"2021-12-10T15:29:08.613Z","value":35.5,"groupId":null,"metadata":null}]soilMoisture,e8c3fca3-c5cd-48e7-9224-0f8c294fa3c0 \ No newline at end of file diff --git a/src/main/java/Data/88c8442f-62b9-4952-b28c-73790a555060.json b/src/main/java/Data/88c8442f-62b9-4952-b28c-73790a555060.json index 4197297..c260f36 100644 --- a/src/main/java/Data/88c8442f-62b9-4952-b28c-73790a555060.json +++ b/src/main/java/Data/88c8442f-62b9-4952-b28c-73790a555060.json @@ -1 +1 @@ -[{"sensorId":"88c8442f-62b9-4952-b28c-73790a555060","datetimeMeasure":"2021-11-25T10:10:29.156Z","value":5.157,"groupId":null,"metadata":null}]battery,f9bb4a5c-f783-4bcf-8c34-0a7c3dd5a632 \ No newline at end of file +[{"sensorId":"88c8442f-62b9-4952-b28c-73790a555060","datetimeMeasure":"2021-12-10T15:31:31.804Z","value":5.132,"groupId":null,"metadata":null}]battery,f9bb4a5c-f783-4bcf-8c34-0a7c3dd5a632 \ No newline at end of file diff --git a/src/main/java/Data/adba09f9-ab84-4252-bf1a-ac49b1b6bdd3.json b/src/main/java/Data/adba09f9-ab84-4252-bf1a-ac49b1b6bdd3.json index 54e67a7..7002334 100644 --- a/src/main/java/Data/adba09f9-ab84-4252-bf1a-ac49b1b6bdd3.json +++ b/src/main/java/Data/adba09f9-ab84-4252-bf1a-ac49b1b6bdd3.json @@ -1 +1 @@ -[{"sensorId":"adba09f9-ab84-4252-bf1a-ac49b1b6bdd3","datetimeMeasure":"2021-11-25T10:13:23.813Z","value":5.826,"groupId":null,"metadata":null}]battery,fd694041-581e-4c2c-9810-505e62b762e6 \ No newline at end of file +[{"sensorId":"adba09f9-ab84-4252-bf1a-ac49b1b6bdd3","datetimeMeasure":"2021-12-10T15:34:04.506Z","value":5.796,"groupId":null,"metadata":null}]battery,fd694041-581e-4c2c-9810-505e62b762e6 \ No newline at end of file diff --git a/src/main/java/Data/bc08edce-d214-40db-ba51-a0802243c235.json b/src/main/java/Data/bc08edce-d214-40db-ba51-a0802243c235.json index 4eea227..69e44d9 100644 --- a/src/main/java/Data/bc08edce-d214-40db-ba51-a0802243c235.json +++ b/src/main/java/Data/bc08edce-d214-40db-ba51-a0802243c235.json @@ -1 +1 @@ -[{"sensorId":"bc08edce-d214-40db-ba51-a0802243c235","datetimeMeasure":"2021-11-25T10:10:29.156Z","value":41.8,"groupId":null,"metadata":null}]soilMoisture,f9bb4a5c-f783-4bcf-8c34-0a7c3dd5a632 \ No newline at end of file +[{"sensorId":"bc08edce-d214-40db-ba51-a0802243c235","datetimeMeasure":"2021-12-10T15:31:31.804Z","value":38.3,"groupId":null,"metadata":null}]soilMoisture,f9bb4a5c-f783-4bcf-8c34-0a7c3dd5a632 \ No newline at end of file diff --git a/src/main/java/Data/devicesOutput.json b/src/main/java/Data/devicesOutput.json index bce0e9f..dff623e 100644 --- a/src/main/java/Data/devicesOutput.json +++ b/src/main/java/Data/devicesOutput.json @@ -1 +1 @@ -[{"id":"087c830b-1173-4b5b-bdbc-c139856cf6aa","externalDomain":["kpn-lora","modelapi"],"externalId":"70B3D57050004C5A","name":"70B3D57050004C5A","description":"6kg sensor","additionalInfo":{"location":{"latitude":51.289406,"longitude":6.042}},"deviceTemplateId":"7be8a213-65e9-4084-b73b-9d5cfcc46cc0","organizationId":"46224b7f-bf6e-4a14-8844-c8d9258a58bf"},{"id":"09d69136-7bdb-420e-83eb-8185d39b06c3","externalDomain":["kpn-lora","modelapi"],"externalId":"70B3D570500046AA","name":"70B3D570500046AA","description":"6kg sensor","additionalInfo":{},"deviceTemplateId":"7be8a213-65e9-4084-b73b-9d5cfcc46cc0","organizationId":"46224b7f-bf6e-4a14-8844-c8d9258a58bf"},{"id":"142ad259-c570-49cc-bf58-99105231c051","externalDomain":["kpn-lora","modelapi"],"externalId":"70B3D57050004657","name":"70B3D57050004657","description":"6kg sensor","additionalInfo":{},"deviceTemplateId":"7be8a213-65e9-4084-b73b-9d5cfcc46cc0","organizationId":"46224b7f-bf6e-4a14-8844-c8d9258a58bf"},{"id":"1f6184e2-3cfb-43e7-83a4-ea175c8590f4","externalDomain":["kpn-lora","modelapi"],"externalId":"70B3D5705000473D","name":"70B3D5705000473D","description":"","additionalInfo":{},"deviceTemplateId":"7be8a213-65e9-4084-b73b-9d5cfcc46cc0","organizationId":"46224b7f-bf6e-4a14-8844-c8d9258a58bf"},{"id":"21c94566-202d-4c12-af0d-035b8db19d32","externalDomain":["kpn-lora","modelapi"],"externalId":"70B3D57050004A7B","name":"70B3D57050004A7B","description":"","additionalInfo":{},"deviceTemplateId":"7be8a213-65e9-4084-b73b-9d5cfcc46cc0","organizationId":"46224b7f-bf6e-4a14-8844-c8d9258a58bf"},{"id":"388e035d-1c04-433e-bd87-de8cbf582dd3","externalDomain":"default","externalId":"8bdbe6ae-eafb-4e99-bb01-db8784dd9633","name":"Greenhouse 1","description":"","additionalInfo":{},"deviceTemplateId":"cb64266d-77d2-44a6-8626-1fc7f3dd5818","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"6285c35e-9495-4017-809e-7e91a83e3bb1","externalDomain":"default","externalId":"be4a38d7-34cf-497e-9565-1396a8020293","name":"Aris - Plant Surface Area - 1","description":"","additionalInfo":{},"deviceTemplateId":"7b806473-417c-467b-a4c8-5caa5615704f","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"6c9efd4a-db04-453d-8ab8-d480ec97dd26","externalDomain":"ttn","externalId":"70B3D5705000623C","name":"70B3D5705000623C","description":"","additionalInfo":{"location":{}},"deviceTemplateId":"e9cdbf8c-17f7-4546-a555-61bacea9ef44","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"744bdb18-8387-4b6a-9e46-05e5a823b713","externalDomain":"default","externalId":"bb0a993f-1c2d-43fa-8f5c-60c948a77fa3","name":"Aris - Plant Surface Area - 3","description":"","additionalInfo":{},"deviceTemplateId":"7b806473-417c-467b-a4c8-5caa5615704f","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"88ca2728-7a4b-4f90-a28c-1f5ba387e890","externalDomain":"default","externalId":"e5ec9f15-f214-455d-9f02-3c134c770dc1","name":"Greenhouse 2","description":"","additionalInfo":{},"deviceTemplateId":"cb64266d-77d2-44a6-8626-1fc7f3dd5818","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"98e242b8-e49d-4eb5-a56e-a5665c05b3a3","externalDomain":["kpn-lora","modelapi"],"externalId":"70B3D57050004619","name":"70B3D57050004619","description":"","additionalInfo":{},"deviceTemplateId":"7be8a213-65e9-4084-b73b-9d5cfcc46cc0","organizationId":"46224b7f-bf6e-4a14-8844-c8d9258a58bf"},{"id":"9aeac8c4-998b-4175-8908-946da0d6e76b","externalDomain":"default","externalId":"f438e5fe-e819-4c4f-a662-9df0bd632af4","name":"Aris - Plant Surface Area - 2","description":"","additionalInfo":{},"deviceTemplateId":"7b806473-417c-467b-a4c8-5caa5615704f","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"b1334e25-22db-40be-8b17-61e6037e9d8e","externalDomain":"darksky","externalId":"51.43222,6.76111-edcd704b","name":"Duisburg, Noordrijn-Westfalen, Duitsland","description":"","additionalInfo":{},"deviceTemplateId":"a9c12700-3394-4cee-80ad-696173ceb250","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"b4f3ca19-1648-4df1-a83d-089c8064a6ff","externalDomain":["kpn-lora","modelapi"],"externalId":"70B3D57050004636","name":"70B3D57050004636","description":"6kg sensor","additionalInfo":{},"deviceTemplateId":"7be8a213-65e9-4084-b73b-9d5cfcc46cc0","organizationId":"46224b7f-bf6e-4a14-8844-c8d9258a58bf"},{"id":"b61c30d1-9281-4fc7-ab70-a43861fe0264","externalDomain":["kpn-lora","modelapi"],"externalId":"70B3D5705000471F","name":"70B3D5705000471F","description":"","additionalInfo":{},"deviceTemplateId":"7be8a213-65e9-4084-b73b-9d5cfcc46cc0","organizationId":"46224b7f-bf6e-4a14-8844-c8d9258a58bf"},{"id":"c97e36da-8274-43aa-a226-7e1bf8b943b0","externalDomain":["kpn-lora","modelapi"],"externalId":"70B3D5705000473C","name":"70B3D5705000473C","description":"","additionalInfo":{},"deviceTemplateId":"7be8a213-65e9-4084-b73b-9d5cfcc46cc0","organizationId":"46224b7f-bf6e-4a14-8844-c8d9258a58bf"},{"id":"e359048e-8877-478c-bcb7-a9908a750301","externalDomain":"default","externalId":"afc6ece6-20fb-493d-8220-ade23d29c3b9","name":"Aris - Plant Surface Area - 4","description":"","additionalInfo":{},"deviceTemplateId":"7b806473-417c-467b-a4c8-5caa5615704f","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"e5728985-f4f5-4b9a-ae32-9d6ae40f9f53","externalDomain":["kpn-lora","modelapi"],"externalId":"70B3D5705000461C","name":"70B3D5705000461C","description":"6kg sensor","additionalInfo":{"location":{"latitude":51.28905,"longitude":6.042781}},"deviceTemplateId":"7be8a213-65e9-4084-b73b-9d5cfcc46cc0","organizationId":"46224b7f-bf6e-4a14-8844-c8d9258a58bf"},{"id":"e8c3fca3-c5cd-48e7-9224-0f8c294fa3c0","externalDomain":"ttn","externalId":"70B3D57050004EF4","name":"70B3D57050004EF4 (replaces 70B3D57050004EEF)","description":"","additionalInfo":{"location":{}},"deviceTemplateId":"84435db4-2eeb-4141-b09e-302e67e94a60","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"f9bb4a5c-f783-4bcf-8c34-0a7c3dd5a632","externalDomain":"ttn","externalId":"70B3D57050006223","name":"70B3D57050006223","description":"","additionalInfo":{"location":{}},"deviceTemplateId":"3c6fa253-4eb5-4345-812f-180b349d935b","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"fd694041-581e-4c2c-9810-505e62b762e6","externalDomain":"ttn","externalId":"70B3D570500042D7","name":"042D7 - EC, bodemvocht en bodemtemperatuur","description":"","additionalInfo":{"location":{}},"deviceTemplateId":"ddafe2db-404f-487f-bfd9-b060254daa15","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"}] \ No newline at end of file +[{"id":"087c830b-1173-4b5b-bdbc-c139856cf6aa","externalDomain":["kpn-lora","modelapi"],"externalId":"70B3D57050004C5A","name":"70B3D57050004C5A","description":"6kg sensor","additionalInfo":{"location":{"latitude":51.289406,"longitude":6.042}},"deviceTemplateId":"7be8a213-65e9-4084-b73b-9d5cfcc46cc0","organizationId":"46224b7f-bf6e-4a14-8844-c8d9258a58bf"},{"id":"09d69136-7bdb-420e-83eb-8185d39b06c3","externalDomain":["kpn-lora","modelapi"],"externalId":"70B3D570500046AA","name":"70B3D570500046AA","description":"6kg sensor","additionalInfo":{},"deviceTemplateId":"7be8a213-65e9-4084-b73b-9d5cfcc46cc0","organizationId":"46224b7f-bf6e-4a14-8844-c8d9258a58bf"},{"id":"142ad259-c570-49cc-bf58-99105231c051","externalDomain":["kpn-lora","modelapi"],"externalId":"70B3D57050004657","name":"70B3D57050004657","description":"6kg sensor","additionalInfo":{},"deviceTemplateId":"7be8a213-65e9-4084-b73b-9d5cfcc46cc0","organizationId":"46224b7f-bf6e-4a14-8844-c8d9258a58bf"},{"id":"1f6184e2-3cfb-43e7-83a4-ea175c8590f4","externalDomain":["kpn-lora","modelapi"],"externalId":"70B3D5705000473D","name":"70B3D5705000473D","description":"","additionalInfo":{},"deviceTemplateId":"7be8a213-65e9-4084-b73b-9d5cfcc46cc0","organizationId":"46224b7f-bf6e-4a14-8844-c8d9258a58bf"},{"id":"21c94566-202d-4c12-af0d-035b8db19d32","externalDomain":["kpn-lora","modelapi"],"externalId":"70B3D57050004A7B","name":"70B3D57050004A7B","description":"","additionalInfo":{},"deviceTemplateId":"7be8a213-65e9-4084-b73b-9d5cfcc46cc0","organizationId":"46224b7f-bf6e-4a14-8844-c8d9258a58bf"},{"id":"388e035d-1c04-433e-bd87-de8cbf582dd3","externalDomain":"default","externalId":"8bdbe6ae-eafb-4e99-bb01-db8784dd9633","name":"Greenhouse 1","description":"","additionalInfo":{},"deviceTemplateId":"cb64266d-77d2-44a6-8626-1fc7f3dd5818","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"4d86fbf3-5343-4856-9bc1-07c164fa0021","externalDomain":"default","externalId":"germes-greenhouse-status","name":"Greenhouse Status","description":"","additionalInfo":{},"deviceTemplateId":"cb64266d-77d2-44a6-8626-1fc7f3dd5818","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"5449f7d1-938c-4731-893e-40e3ddc67329","externalDomain":"default","externalId":"70B3D5705000623C-status","name":"Device 4","description":"","additionalInfo":{},"deviceTemplateId":"cb64266d-77d2-44a6-8626-1fc7f3dd5818","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"6285c35e-9495-4017-809e-7e91a83e3bb1","externalDomain":"default","externalId":"be4a38d7-34cf-497e-9565-1396a8020293","name":"Aris - Plant Surface Area - 1","description":"","additionalInfo":{},"deviceTemplateId":"7b806473-417c-467b-a4c8-5caa5615704f","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"6c9efd4a-db04-453d-8ab8-d480ec97dd26","externalDomain":"ttn","externalId":"70B3D5705000623C","name":"70B3D5705000623C","description":"","additionalInfo":{"location":{}},"deviceTemplateId":"e9cdbf8c-17f7-4546-a555-61bacea9ef44","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"744bdb18-8387-4b6a-9e46-05e5a823b713","externalDomain":"default","externalId":"bb0a993f-1c2d-43fa-8f5c-60c948a77fa3","name":"Aris - Plant Surface Area - 3","description":"","additionalInfo":{},"deviceTemplateId":"7b806473-417c-467b-a4c8-5caa5615704f","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"7ef4761c-53eb-4f6b-85e5-8c5c8fac3ca9","externalDomain":"default","externalId":"70B3D570500042D7-status","name":"Device 1","description":"","additionalInfo":{"location":{}},"deviceTemplateId":"cb64266d-77d2-44a6-8626-1fc7f3dd5818","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"88ca2728-7a4b-4f90-a28c-1f5ba387e890","externalDomain":"default","externalId":"e5ec9f15-f214-455d-9f02-3c134c770dc1","name":"Greenhouse 2","description":"","additionalInfo":{},"deviceTemplateId":"cb64266d-77d2-44a6-8626-1fc7f3dd5818","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"98e242b8-e49d-4eb5-a56e-a5665c05b3a3","externalDomain":["kpn-lora","modelapi"],"externalId":"70B3D57050004619","name":"70B3D57050004619","description":"","additionalInfo":{},"deviceTemplateId":"7be8a213-65e9-4084-b73b-9d5cfcc46cc0","organizationId":"46224b7f-bf6e-4a14-8844-c8d9258a58bf"},{"id":"9aeac8c4-998b-4175-8908-946da0d6e76b","externalDomain":"default","externalId":"f438e5fe-e819-4c4f-a662-9df0bd632af4","name":"Aris - Plant Surface Area - 2","description":"","additionalInfo":{},"deviceTemplateId":"7b806473-417c-467b-a4c8-5caa5615704f","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"abc0ed83-cc2d-4aec-b86c-84b22d8556be","externalDomain":"default","externalId":"70B3D57050006223-status","name":"Device 3","description":"","additionalInfo":{},"deviceTemplateId":"cb64266d-77d2-44a6-8626-1fc7f3dd5818","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"b1334e25-22db-40be-8b17-61e6037e9d8e","externalDomain":"darksky","externalId":"51.43222,6.76111-edcd704b","name":"Duisburg, Noordrijn-Westfalen, Duitsland","description":"","additionalInfo":{},"deviceTemplateId":"a9c12700-3394-4cee-80ad-696173ceb250","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"b4f3ca19-1648-4df1-a83d-089c8064a6ff","externalDomain":["kpn-lora","modelapi"],"externalId":"70B3D57050004636","name":"70B3D57050004636","description":"6kg sensor","additionalInfo":{},"deviceTemplateId":"7be8a213-65e9-4084-b73b-9d5cfcc46cc0","organizationId":"46224b7f-bf6e-4a14-8844-c8d9258a58bf"},{"id":"b61c30d1-9281-4fc7-ab70-a43861fe0264","externalDomain":["kpn-lora","modelapi"],"externalId":"70B3D5705000471F","name":"70B3D5705000471F","description":"","additionalInfo":{},"deviceTemplateId":"7be8a213-65e9-4084-b73b-9d5cfcc46cc0","organizationId":"46224b7f-bf6e-4a14-8844-c8d9258a58bf"},{"id":"c97e36da-8274-43aa-a226-7e1bf8b943b0","externalDomain":["kpn-lora","modelapi"],"externalId":"70B3D5705000473C","name":"70B3D5705000473C","description":"","additionalInfo":{},"deviceTemplateId":"7be8a213-65e9-4084-b73b-9d5cfcc46cc0","organizationId":"46224b7f-bf6e-4a14-8844-c8d9258a58bf"},{"id":"e359048e-8877-478c-bcb7-a9908a750301","externalDomain":"default","externalId":"afc6ece6-20fb-493d-8220-ade23d29c3b9","name":"Aris - Plant Surface Area - 4","description":"","additionalInfo":{},"deviceTemplateId":"7b806473-417c-467b-a4c8-5caa5615704f","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"e5728985-f4f5-4b9a-ae32-9d6ae40f9f53","externalDomain":["kpn-lora","modelapi"],"externalId":"70B3D5705000461C","name":"70B3D5705000461C","description":"6kg sensor","additionalInfo":{"location":{"latitude":51.28905,"longitude":6.042781}},"deviceTemplateId":"7be8a213-65e9-4084-b73b-9d5cfcc46cc0","organizationId":"46224b7f-bf6e-4a14-8844-c8d9258a58bf"},{"id":"e5951137-6b18-472c-944b-fc45a2b58b0f","externalDomain":"default","externalId":"70B3D57050004EF4-status","name":"Device 2","description":"","additionalInfo":{},"deviceTemplateId":"cb64266d-77d2-44a6-8626-1fc7f3dd5818","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"e8c3fca3-c5cd-48e7-9224-0f8c294fa3c0","externalDomain":"ttn","externalId":"70B3D57050004EF4","name":"70B3D57050004EF4 (replaces 70B3D57050004EEF)","description":"","additionalInfo":{"location":{}},"deviceTemplateId":"84435db4-2eeb-4141-b09e-302e67e94a60","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"f9bb4a5c-f783-4bcf-8c34-0a7c3dd5a632","externalDomain":"ttn","externalId":"70B3D57050006223","name":"70B3D57050006223","description":"","additionalInfo":{"location":{}},"deviceTemplateId":"3c6fa253-4eb5-4345-812f-180b349d935b","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"},{"id":"fd694041-581e-4c2c-9810-505e62b762e6","externalDomain":"ttn","externalId":"70B3D570500042D7","name":"042D7 - EC, bodemvocht en bodemtemperatuur","description":"","additionalInfo":{"location":{}},"deviceTemplateId":"ddafe2db-404f-487f-bfd9-b060254daa15","organizationId":"fca1ed1a-ce91-4e83-b438-7dd09530d5a2"}] \ No newline at end of file diff --git a/src/main/java/Data/f75934dc-af98-4206-a5bd-22d23dd5f268.json b/src/main/java/Data/f75934dc-af98-4206-a5bd-22d23dd5f268.json index 4123ecc..bbe5813 100644 --- a/src/main/java/Data/f75934dc-af98-4206-a5bd-22d23dd5f268.json +++ b/src/main/java/Data/f75934dc-af98-4206-a5bd-22d23dd5f268.json @@ -1 +1 @@ -[{"sensorId":"f75934dc-af98-4206-a5bd-22d23dd5f268","datetimeMeasure":"2021-11-25T10:13:22.838Z","value":3,"groupId":null,"metadata":null}]temperature,6c9efd4a-db04-453d-8ab8-d480ec97dd26 \ No newline at end of file +[{"sensorId":"f75934dc-af98-4206-a5bd-22d23dd5f268","datetimeMeasure":"2021-12-10T15:34:09.418Z","value":3.68,"groupId":null,"metadata":null}]temperature,6c9efd4a-db04-453d-8ab8-d480ec97dd26 \ No newline at end of file diff --git a/src/main/java/Data/ff6f11e0-c969-4cbb-829c-f44a13683918.json b/src/main/java/Data/ff6f11e0-c969-4cbb-829c-f44a13683918.json index 351cb3b..dfac83d 100644 --- a/src/main/java/Data/ff6f11e0-c969-4cbb-829c-f44a13683918.json +++ b/src/main/java/Data/ff6f11e0-c969-4cbb-829c-f44a13683918.json @@ -1 +1 @@ -[{"sensorId":"ff6f11e0-c969-4cbb-829c-f44a13683918","datetimeMeasure":"2021-11-25T10:13:22.838Z","value":17.75,"groupId":null,"metadata":null}]precipitation,6c9efd4a-db04-453d-8ab8-d480ec97dd26 \ No newline at end of file +[{"sensorId":"ff6f11e0-c969-4cbb-829c-f44a13683918","datetimeMeasure":"2021-12-10T15:34:09.418Z","value":72.5,"groupId":null,"metadata":null}]precipitation,6c9efd4a-db04-453d-8ab8-d480ec97dd26 \ No newline at end of file diff --git a/src/main/java/Data/ffca826c-d1b5-4ac8-869a-ec0da15d9076.json b/src/main/java/Data/ffca826c-d1b5-4ac8-869a-ec0da15d9076.json index 4398d68..8c8f88c 100644 --- a/src/main/java/Data/ffca826c-d1b5-4ac8-869a-ec0da15d9076.json +++ b/src/main/java/Data/ffca826c-d1b5-4ac8-869a-ec0da15d9076.json @@ -1 +1 @@ -[{"sensorId":"ffca826c-d1b5-4ac8-869a-ec0da15d9076","datetimeMeasure":"2021-11-25T10:04:44.298Z","value":5.135,"groupId":null,"metadata":null}]battery,e8c3fca3-c5cd-48e7-9224-0f8c294fa3c0 \ No newline at end of file +[{"sensorId":"ffca826c-d1b5-4ac8-869a-ec0da15d9076","datetimeMeasure":"2021-12-10T15:29:08.613Z","value":5.106,"groupId":null,"metadata":null}]battery,e8c3fca3-c5cd-48e7-9224-0f8c294fa3c0 \ No newline at end of file diff --git a/src/main/java/Data/securityToken.txt b/src/main/java/Data/securityToken.txt index b8bf4d5..eda6481 100644 --- a/src/main/java/Data/securityToken.txt +++ b/src/main/java/Data/securityToken.txt @@ -1 +1 @@ -nRsSvFEYoGTEqSmnmtE0R0btgMW8J6C6VpKEefCfPerViKxV4usqGREOioUQ268G \ No newline at end of file +VSiZpQv9EEyXdVzTcudeG2GRo5hM5YGaDaMcdS3qY8hXKb34q0KypT9qLfr0BkOg \ No newline at end of file diff --git a/src/main/java/eu/hsrw/ias/ggd/ApiCall.java b/src/main/java/eu/hsrw/ias/ggd/ApiCall.java index f6a1994..596ca24 100644 --- a/src/main/java/eu/hsrw/ias/ggd/ApiCall.java +++ b/src/main/java/eu/hsrw/ias/ggd/ApiCall.java @@ -22,7 +22,7 @@ public class ApiCall { UserCredentials userCredentials = new UserCredentials(); final String username = userCredentials.getUsername(); final String password = userCredentials.getPassword(); - final String homeRoot = userCredentials.getHomeRoot(); + final String homeRoot = UserCredentials.getHomeRoot(); String outputToken; WriteFile writingIntoFile = new WriteFile(); Date now; // to display current time @@ -46,15 +46,28 @@ public class ApiCall { ReadSensors4Partner readSensors4Partner = new ReadSensors4Partner(); ArrayList outputValue = (readSensors4Partner.FetchSensor4Box("Germes", token)); for(int i=0;i data; + + public Device(String identifier) { + this.id = identifier; + this.data = new LinkedList(); + } + + public void addSensorData(SensorData d) { + this.data.add(d); + } + + public List getSensorData() { + return data; + } + + public String getId() { + return id; + } + + public Boolean hasTag(String tag) { + for (SensorData sensorData : data) { + if (sensorData.getTag() == tag) return true; + } + return false; + } + + public SensorData getSensorDataByTag(String tag) { + for (SensorData sd : data) { + if (sd.getTag() == tag) return sd; + } + return null; + } + + public SensorData getSensorDataById(String id) { + for (SensorData sd : data) { + if (sd.getSensorId() == id) return sd; + } + return null; + } + + public String toString() { + String str = "Device: '"+ id +"', data: ["; + + for(SensorData sd: data) { + str += "SensorData(id: '"+ sd.getSensorId() +"',"; + str += " tag: '"+ sd.getTag() +"',"; + str += " value: "+ sd.getValue() +")"; + } + + return str + "]"; + } +} diff --git a/src/main/java/eu/hsrw/ias/ggd/Isis.java b/src/main/java/eu/hsrw/ias/ggd/Isis.java index 70b254a..c305a80 100644 --- a/src/main/java/eu/hsrw/ias/ggd/Isis.java +++ b/src/main/java/eu/hsrw/ias/ggd/Isis.java @@ -13,7 +13,7 @@ public class Isis { return httpMethodPost.HttpCallPost(baseURL, body); } - public static void main(String args[]){ + public static void main(String[] args){ try { String output = OnCallMethod("Greenhouse 1", "status"); System.out.println(output); diff --git a/src/main/java/eu/hsrw/ias/ggd/Notification.java b/src/main/java/eu/hsrw/ias/ggd/Notification.java new file mode 100644 index 0000000..3d989ca --- /dev/null +++ b/src/main/java/eu/hsrw/ias/ggd/Notification.java @@ -0,0 +1,37 @@ +package eu.hsrw.ias.ggd; + +public class Notification { + private Severity severity = Severity.None; + private String type; + private SensorData cause; + + public Notification(String t, SensorData d, Severity s) { + this.type = t; + this.cause = d; + this.severity = s; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public SensorData getCause() { + return cause; + } + + public void setCause(SensorData cause) { + this.cause = cause; + } + + public Severity getSeverity() { + return this.severity; + } + + public void setSeverity(Severity severity) { + this.severity = severity; + } +} diff --git a/src/main/java/eu/hsrw/ias/ggd/ScheduledTask.java b/src/main/java/eu/hsrw/ias/ggd/ScheduledTask.java index b08cf82..4585344 100644 --- a/src/main/java/eu/hsrw/ias/ggd/ScheduledTask.java +++ b/src/main/java/eu/hsrw/ias/ggd/ScheduledTask.java @@ -34,7 +34,7 @@ public class ScheduledTask extends TimerTask { FactHandle fact1; fact1 = kSession.insert(outputDevices); // System.out.println(fact1); - kSession.insert(fact1); +// kSession.insert(fact1); kSession.fireAllRules(); diff --git a/src/main/java/eu/hsrw/ias/ggd/Severity.java b/src/main/java/eu/hsrw/ias/ggd/Severity.java new file mode 100644 index 0000000..e3b963c --- /dev/null +++ b/src/main/java/eu/hsrw/ias/ggd/Severity.java @@ -0,0 +1,9 @@ +package eu.hsrw.ias.ggd; + +public enum Severity { + None, + Info, + Warning, + Error, + Critical +} \ No newline at end of file diff --git a/src/main/resources/rules/Battery.drl b/src/main/resources/rules/Battery.drl deleted file mode 100644 index 222c2e9..0000000 --- a/src/main/resources/rules/Battery.drl +++ /dev/null @@ -1,41 +0,0 @@ -import java.util.List; -import java.util.HashMap; -import java.util.Map; -import java.util.Iterator; -import eu.hsrw.ias.ggd.ScheduledTask -import eu.hsrw.ias.ggd.SensorData -import javax.swing.JOptionPane -import HttpCall.HttpPost -import Files.ReadFile -import Credentials.UserCredentials; - -rule "Low Battery Level" - -when -// This is like declaring a variable tMap where is Map and contains a key with name battery - $tMap: HashMap( containsKey("battery") == true ) -//In this part we are iterating through the entire map - e: Map.Entry(k:key, v:value) from $tMap.entrySet() - // for(e <- $tMap) { - SensorData(level: value ) from v - SensorData(tag: sensorTag) from v - SensorData(id: deviceId) from v - then - HttpPost httpPost = new HttpPost(); - String fixedIdG1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - if (level < 7.2 && k.equals("battery") ) { - JOptionPane.showMessageDialog(null,"Low Battery : "+level+"! Please swap the battery soon of the following sensor:"+tag,"Low Battery Level",JOptionPane.INFORMATION_MESSAGE); - final String data = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Low Battery %s in the following sensor: %s \", \"battery\": %s}]}}", fixedIdG1,level, tag,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",data); - System.out.println("Low Battery"+level+"in the following sensor"+tag); - } -// else { -// JOptionPane.showMessageDialog(null,"Battery OK : "+level+"! in the following sensor :"+tag,"Battery OK",JOptionPane.INFORMATION_MESSAGE); -// final String data1 = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Battery OK %s in the following sensor: %s \", \"battery\": %s}]}}", fixedIdG1,level, tag,level); -//// httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",data1); -// System.out.println(data1); -// } -// System.out.println($tMap); -// System.out.println(e.getKey() + " " + String.valueOf(level)+" " + tag+" "+id); - -end \ No newline at end of file diff --git a/src/main/resources/rules/Critical.drl b/src/main/resources/rules/Critical.drl new file mode 100644 index 0000000..cf89927 --- /dev/null +++ b/src/main/resources/rules/Critical.drl @@ -0,0 +1,91 @@ +import java.util.HashMap; +import java.util.Map; +import eu.hsrw.ias.ggd.SensorData +import javax.swing.JOptionPane +import HttpCall.HttpPost +import eu.hsrw.ias.ggd.Notification +import eu.hsrw.ias.ggd.Severity; +import eu.hsrw.ias.ggd.Device; + + +rule "Critical Battery" + when + device: Device(sensorDatas: sensorData) + sensorData: SensorData(tag == "battery", value < 5.0) from sensorDatas + then + insert(new Notification("batte2ry", sensorData, Severity.Warning)); + System.out.println(sensorData.getTag()+" "+sensorData.getValue()); + + + /*String fixedIdG1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; + HttpPost httpPost = new HttpPost(); +// System.out.println("Tag: '"+tag+"' has low battery with value: '"+level+"'"); + final String battery = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical! Low Battery %s \", \"battery\": %s}]}}", fixedIdG1,level,level); + httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",battery); + System.out.println("Low Battery"+level+"in the following sensor"+tag); + */ + /*HttpPost httpPost = new HttpPost(); + + final String finalOutput; + boolean critical = false; + HashMap test = new HashMap<>(); + if (tag.equals("fd694041-581e-4c2c-9810-505e62b762e6")){ // This matches 70B3D570500042D7 + if (level < 7.2 && k.equals("battery") ) { + JOptionPane.showMessageDialog(null,"Low Battery : "+level+"! Please swap the battery soon of the following sensor:"+tag,"Low Battery Level",JOptionPane.INFORMATION_MESSAGE); + final String battery = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical! Low Battery %s \", \"battery\": %s}]}}", fixedIdG1,level,level); + httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",battery); + System.out.println("Low Battery"+level+"in the following sensor"+tag); + critical = true; + test.put("battery",level); + } + if (level > 80 && k.equals("temperature") ) { + JOptionPane.showMessageDialog(null,"High Temperature : "+level+" in the following sensor: "+tag+"in the following device id: "+id,"Temperature",JOptionPane.INFORMATION_MESSAGE); + final String temperature = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical!High Temperature %s \", \"temperature\": %s}]}}", fixedIdG1,level,level); + httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",temperature); + System.out.println("High Temp"); + critical = true; + } + if (level > 14.5 && k.equals("precipitation") ) { + JOptionPane.showMessageDialog(null,"High water level : "+level+" in the following sensor"+tag,"Precipitation",JOptionPane.INFORMATION_MESSAGE); + final String precipitation = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"High water level %s\", \"precipitation\": %s}]}}", fixedIdG1, level,level); + httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",precipitation); + System.out.println("High water level"+level +" in the following sensor:"+tag); + critical = true; + } + if (level < 22 && k.equals("soilTemperature") ) { + JOptionPane.showMessageDialog(null,"Low soil temperature : "+level+" in the following sensor: "+tag+"in the following device id: "+id,"soil Temperature",JOptionPane.INFORMATION_MESSAGE); + final String soilTemperature = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Low soil temperature %s in the following sensor: %s \", \"soilTemperature\": %s}]}}", fixedIdG1,level, tag,level); + httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",soilTemperature); + System.out.println("Low soil Temperature"+level+" in the following sensor "+tag); + critical = true; + test.put("soilTemperature",level); + } + if (level <= 30 && k.equals("soilMoisture") ) { + JOptionPane.showMessageDialog(null,"Be Careful the soil is dry : "+level+" in the following sensor :"+tag +"in the device:"+id,"Soil Moisture",JOptionPane.INFORMATION_MESSAGE); + final String soilMoisture = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Be Careful the soil sensor %s is dry: %s \", \"soilMoisture\": %s}]}}", fixedIdG1,tag,level,level); + httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",soilMoisture); + System.out.println("Soil is dry"+level+" in the following sensor"+tag); + critical = true; + } + if (level <= 0.57 && level >= 0.11 && k.equals("soilConductivity") ) { + JOptionPane.showMessageDialog(null,"Optimal EC levels in the soil : "+level+" in the following sensor"+tag,"Soil Conductivity",JOptionPane.INFORMATION_MESSAGE); + final String soilConductivity = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Optimal EC levels in the soil %s\", \"soilConductivity\": %s}]}}", fixedIdG1, level,level); + httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",soilConductivity); + System.out.println("Optimal EC levels in the soil"+level +" in the following sensor:"+tag); + critical = true; + } + if (level > 20 && k.equals("dielectricPermittivity") ) { + JOptionPane.showMessageDialog(null,"High dielectricPermittivity : "+level+" in the following sensor"+tag,"dielectricPermittivity",JOptionPane.INFORMATION_MESSAGE); + final String dielectricPermittivity = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"High dielectricPermittivity %s\", \"dielectricPermittivity\": %s}]}}", fixedIdG1, level,level); + httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",dielectricPermittivity); + System.out.println("High dielectricPermittivity"+level +" in the following sensor:"+tag); + critical = true; + } +// if(critical == true){ +// finalOutput +// } + finalOutput = String.format("{\"id\":\"70B3D570500042D7-status\",\"data\":{\"measured\":[{ \"status\": \"The status of the device 1 is critical\",}]}}"); + System.out.println(finalOutput); + }*/ + +end \ No newline at end of file diff --git a/src/main/resources/rules/DielectricPermittivity.drl b/src/main/resources/rules/DielectricPermittivity.drl deleted file mode 100644 index e1955aa..0000000 --- a/src/main/resources/rules/DielectricPermittivity.drl +++ /dev/null @@ -1,33 +0,0 @@ -import java.util.List; -import java.util.HashMap; -import java.util.Map; -import java.util.Iterator; -import eu.hsrw.ias.ggd.ScheduledTask; -import javax.swing.JOptionPane -import HttpCall.HttpPost; -import eu.hsrw.ias.ggd.SensorData - -rule "DielectricPermittivity" - when - $tMap: HashMap( containsKey("dielectricPermittivity") == true ) - //In this part we are iterating through the entire map - e: Map.Entry(k:key, v:value) from $tMap.entrySet() - // for(e <- $tMap) { - SensorData(level: value ) from v - SensorData(tag: sensorTag) from v - SensorData(id: deviceId) from v - then - String fixedIdG1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - HttpPost httpPost = new HttpPost(); - if (level > 20 && k.equals("dielectricPermittivity") ) { - JOptionPane.showMessageDialog(null,"High dielectricPermittivity : "+level+" in the following sensor"+tag,"dielectricPermittivity",JOptionPane.INFORMATION_MESSAGE); - final String data = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"High dielectricPermittivity %s\", \"dielectricPermittivity\": %s}]}}", fixedIdG1, level,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",data); - System.out.println("High dielectricPermittivity"+level +" in the following sensor:"+tag); - - } - System.out.println(k); - System.out.println(level); - System.out.println(tag); - System.out.println(id); -end diff --git a/src/main/resources/rules/ExternalTemperature.drl b/src/main/resources/rules/ExternalTemperature.drl deleted file mode 100644 index c2bfa6d..0000000 --- a/src/main/resources/rules/ExternalTemperature.drl +++ /dev/null @@ -1,7 +0,0 @@ -package rules; - - -rule "ExternalTemperature" - when - then -end diff --git a/src/main/resources/rules/Precipitation.drl b/src/main/resources/rules/Precipitation.drl deleted file mode 100644 index edff4c0..0000000 --- a/src/main/resources/rules/Precipitation.drl +++ /dev/null @@ -1,33 +0,0 @@ -import java.util.List; -import java.util.HashMap; -import java.util.Map; -import java.util.Iterator; -import eu.hsrw.ias.ggd.ScheduledTask; -import javax.swing.JOptionPane -import HttpCall.HttpPost; -import eu.hsrw.ias.ggd.SensorData - -rule "Precipitation" - when - $tMap: HashMap( containsKey("precipitation") == true ) - //In this part we are iterating through the entire map - e: Map.Entry(k:key, v:value) from $tMap.entrySet() - // for(e <- $tMap) { - SensorData(level: value ) from v - SensorData(tag: sensorTag) from v - SensorData(id: deviceId) from v - then - String fixedIdG1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - HttpPost httpPost = new HttpPost(); - if (level > 14.5 && k.equals("precipitation") ) { - JOptionPane.showMessageDialog(null,"High water level : "+level+" in the following sensor"+tag,"Precipitation",JOptionPane.INFORMATION_MESSAGE); - final String data = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"High water level %s\", \"precipitation\": %s}]}}", fixedIdG1, level,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",data); - System.out.println("High water level"+level +" in the following sensor:"+tag); - - } -// System.out.println(k); -// System.out.println(level); -// System.out.println(tag); -// System.out.println(id); -end diff --git a/src/main/resources/rules/SoilConductivity.drl b/src/main/resources/rules/SoilConductivity.drl deleted file mode 100644 index 4c68bb8..0000000 --- a/src/main/resources/rules/SoilConductivity.drl +++ /dev/null @@ -1,39 +0,0 @@ -import java.util.List; -import java.util.HashMap; -import java.util.Map; -import java.util.Iterator; -import eu.hsrw.ias.ggd.ScheduledTask; -import javax.swing.JOptionPane -import HttpCall.HttpPost; -import eu.hsrw.ias.ggd.SensorData - -rule "Optimal EC levels in the soil" - -when - $tMap: HashMap( containsKey("soilConductivity") == true ) - //In this part we are iterating through the entire map - e: Map.Entry(k:key, v:value) from $tMap.entrySet() - // for(e <- $tMap) { - SensorData(level: value ) from v - SensorData(tag: sensorTag) from v - SensorData(id: deviceId) from v - then - String fixedIdG1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - HttpPost httpPost = new HttpPost(); - if (level <= 0.57 && level >= 0.11 && k.equals("soilConductivity") ) { - JOptionPane.showMessageDialog(null,"Optimal EC levels in the soil : "+level+" in the following sensor"+tag,"Soil Conductivity",JOptionPane.INFORMATION_MESSAGE); - final String data = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Optimal EC levels in the soil %s\", \"soilConductivity\": %s}]}}", fixedIdG1, level,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",data); - System.out.println("Optimal EC levels in the soil"+level +" in the following sensor:"+tag); - } -// else { -// JOptionPane.showMessageDialog(null,"Non Optimal EC levels in the soil : "+level+" in the following sensor:"+tag,"Soil Conductivity",JOptionPane.INFORMATION_MESSAGE); -// final String data1 = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Non Optimal EC levels in the soil %s\", \"soil Conductivity\": %s}]}}", fixedIdG1, level,level); -//// httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",data1); -// System.out.println(data1); -// } -end - - - - diff --git a/src/main/resources/rules/SoilMoisture.drl b/src/main/resources/rules/SoilMoisture.drl deleted file mode 100644 index 5f1fb26..0000000 --- a/src/main/resources/rules/SoilMoisture.drl +++ /dev/null @@ -1,40 +0,0 @@ -import java.util.List; -import java.util.HashMap; -import java.util.Map; -import java.util.Iterator; -import eu.hsrw.ias.ggd.ScheduledTask; -import javax.swing.JOptionPane; -import HttpCall.HttpPost; -import eu.hsrw.ias.ggd.SensorData - - -rule "Soil Moisture" - -when - $tMap: HashMap( containsKey("soilMoisture") == true ) - //In this part we are iterating through the entire map - e: Map.Entry(k:key, v:value) from $tMap.entrySet() - // for(e <- $tMap) { - SensorData(level: value ) from v - SensorData(tag: sensorTag) from v - SensorData(id : deviceId) from v - - then - HttpPost httpPost = new HttpPost(); - String fixedIdG1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - - if (level <= 30 && k.equals("soilMoisture") ) { - JOptionPane.showMessageDialog(null,"Be Careful the soil is dry : "+level+" in the following sensor :"+tag +"in the device:"+id,"Soil Moisture",JOptionPane.INFORMATION_MESSAGE); - final String dataInfo = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Be Careful the soil sensor %s is dry: %s \", \"soilMoisture\": %s}]}}", fixedIdG1,tag,level,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",dataInfo); - System.out.println("Soil is dry"+level+" in the following sensor"+tag); - } - else if (level <= 80 && k.equals("soilMoisture") ) { - JOptionPane.showMessageDialog(null,"Optimal moisture in the soil : "+level+" in the following sensor"+tag,"Soil Moisture",JOptionPane.INFORMATION_MESSAGE); - final String data = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Be Careful the soil sensor %s is wet: %s\", \"soilMoisture\": %s}]}}", fixedIdG1,tag,level,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",data); - System.out.println("Optimal moisture in the soil"+level+" in the following sensor"+tag); - } -end - - diff --git a/src/main/resources/rules/SoilTemperature.drl b/src/main/resources/rules/SoilTemperature.drl deleted file mode 100644 index 952ebae..0000000 --- a/src/main/resources/rules/SoilTemperature.drl +++ /dev/null @@ -1,29 +0,0 @@ -import java.util.List; -import java.util.HashMap; -import java.util.Map; -import java.util.Iterator; -import eu.hsrw.ias.ggd.ScheduledTask; -import javax.swing.JOptionPane; -import HttpCall.HttpPost; -import eu.hsrw.ias.ggd.SensorData - - -rule "SoilTemperature" - - when - $tMap: HashMap( containsKey("soilTemperature") == true ) - e: Map.Entry(k:key, v:value) from $tMap.entrySet() - SensorData(level: value ) from v - SensorData(tag: sensorTag) from v - SensorData(id : deviceId) from v - then - - String fixedIdG1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - HttpPost httpPost = new HttpPost(); - if (level < 22 && k.equals("soilTemperature") ) { - JOptionPane.showMessageDialog(null,"Low soil temperature : "+level+" in the following sensor: "+tag+"in the following device id: "+id,"soil Temperature",JOptionPane.INFORMATION_MESSAGE); - final String data = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Low soil temperature %s in the following sensor: %s \", \"soilTemperature\": %s}]}}", fixedIdG1,level, tag,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",data); - System.out.println("Low soil Temperature"+level+" in the following sensor "+tag); - } -end diff --git a/src/main/resources/rules/Temperature.drl b/src/main/resources/rules/Temperature.drl deleted file mode 100644 index 375e1b3..0000000 --- a/src/main/resources/rules/Temperature.drl +++ /dev/null @@ -1,40 +0,0 @@ -import java.util.List; -import java.util.HashMap; -import java.util.Map; -import java.util.Iterator; -import eu.hsrw.ias.ggd.ScheduledTask -import eu.hsrw.ias.ggd.SensorData -import javax.swing.JOptionPane -import HttpCall.HttpPost -import Files.ReadFile -import Credentials.UserCredentials; - -rule "Temperature Check" - -when -// This is like declaring a variable tMap where is Map and contains a key with name battery - $tMap: HashMap( containsKey("temperature") == true ) -//In this part we are iterating through the entire map - e: Map.Entry(k:key, v:value) from $tMap.entrySet() - // for(e <- $tMap) { - SensorData(level: value ) from v - SensorData(tag: sensorTag) from v - SensorData(id: deviceId) from v - then - String fixedIdG1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; - HttpPost httpPost = new HttpPost(); - if (level > 80 && k.equals("temperature") ) { - JOptionPane.showMessageDialog(null,"High Temperature : "+level+" in the following sensor: "+tag+"in the following device id: "+id,"Temperature",JOptionPane.INFORMATION_MESSAGE); - final String data = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"High Temperature %s in the following sensor: %s \", \"temperature\": %s}]}}", fixedIdG1,level, tag,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",data); - System.out.println("High Temp"); - } - else if(level < 20 && k.equals("temperature")){ - JOptionPane.showMessageDialog(null,"Low Temperature : "+level+" in the following sensor: "+tag+"in the following device id: "+id,"Temperature",JOptionPane.INFORMATION_MESSAGE); - final String data1 = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Low Temperature %s in the following sensor: %s \", \"temperature\": %s}]}}",fixedIdG1,level, tag,level); - httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",data1); - System.out.println("Low Temp "+tag); - } - - -end \ No newline at end of file diff --git a/src/main/resources/rules/warnings.drl b/src/main/resources/rules/warnings.drl new file mode 100644 index 0000000..d10e582 --- /dev/null +++ b/src/main/resources/rules/warnings.drl @@ -0,0 +1,9 @@ +import eu.hsrw.ias.ggd.Notification; +import eu.hsrw.ias.ggd.Severity; + +rule "Green House Critical" +when + warning: Notification(severity > Severity.Info) +then + System.out.println("Green House critical, because of: '"+warning.getType()+"'"); +end \ No newline at end of file diff --git a/target/classes/rules/Critical.drl b/target/classes/rules/Critical.drl new file mode 100644 index 0000000..9ad3df0 --- /dev/null +++ b/target/classes/rules/Critical.drl @@ -0,0 +1,97 @@ +import java.util.HashMap; +import java.util.Map; +import eu.hsrw.ias.ggd.SensorData +import javax.swing.JOptionPane +import HttpCall.HttpPost +import eu.hsrw.ias.ggd.Notification +import eu.hsrw.ias.ggd.Severity; +import eu.hsrw.ias.ggd.Device; + + +rule "Critical Battery" + when + //$t: HashMap( contains(Device(sensorData.contains(SensorData(tag == "battery")) ))) + //device: Device() + device: Device(sensorDatas: sensorData) + + sensorData: SensorData(tag == "battery", value < 5.0) from sensorDatas + //device: Device(hasTag("battery") == true) from $tMap + // e: Map.Entry(k:key == "battery", v:value) from $tMap.entrySet() + //s: SensorData(tag == "battery") from device.getSensorData() + then + //insertLogical(new Notification("battery", s, Severity.Warning)); + System.out.println(sensorData.getTag()+" "+sensorData.getValue()); + + + /*String fixedIdG1="8bdbe6ae-eafb-4e99-bb01-db8784dd9633"; + HttpPost httpPost = new HttpPost(); +// System.out.println("Tag: '"+tag+"' has low battery with value: '"+level+"'"); + final String battery = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical! Low Battery %s \", \"battery\": %s}]}}", fixedIdG1,level,level); + httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",battery); + System.out.println("Low Battery"+level+"in the following sensor"+tag); + */ + /*HttpPost httpPost = new HttpPost(); + + final String finalOutput; + boolean critical = false; + HashMap test = new HashMap<>(); + if (tag.equals("fd694041-581e-4c2c-9810-505e62b762e6")){ // This matches 70B3D570500042D7 + if (level < 7.2 && k.equals("battery") ) { + JOptionPane.showMessageDialog(null,"Low Battery : "+level+"! Please swap the battery soon of the following sensor:"+tag,"Low Battery Level",JOptionPane.INFORMATION_MESSAGE); + final String battery = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical! Low Battery %s \", \"battery\": %s}]}}", fixedIdG1,level,level); + httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",battery); + System.out.println("Low Battery"+level+"in the following sensor"+tag); + critical = true; + test.put("battery",level); + } + if (level > 80 && k.equals("temperature") ) { + JOptionPane.showMessageDialog(null,"High Temperature : "+level+" in the following sensor: "+tag+"in the following device id: "+id,"Temperature",JOptionPane.INFORMATION_MESSAGE); + final String temperature = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Critical!High Temperature %s \", \"temperature\": %s}]}}", fixedIdG1,level,level); + httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",temperature); + System.out.println("High Temp"); + critical = true; + } + if (level > 14.5 && k.equals("precipitation") ) { + JOptionPane.showMessageDialog(null,"High water level : "+level+" in the following sensor"+tag,"Precipitation",JOptionPane.INFORMATION_MESSAGE); + final String precipitation = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"High water level %s\", \"precipitation\": %s}]}}", fixedIdG1, level,level); + httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",precipitation); + System.out.println("High water level"+level +" in the following sensor:"+tag); + critical = true; + } + if (level < 22 && k.equals("soilTemperature") ) { + JOptionPane.showMessageDialog(null,"Low soil temperature : "+level+" in the following sensor: "+tag+"in the following device id: "+id,"soil Temperature",JOptionPane.INFORMATION_MESSAGE); + final String soilTemperature = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Low soil temperature %s in the following sensor: %s \", \"soilTemperature\": %s}]}}", fixedIdG1,level, tag,level); + httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",soilTemperature); + System.out.println("Low soil Temperature"+level+" in the following sensor "+tag); + critical = true; + test.put("soilTemperature",level); + } + if (level <= 30 && k.equals("soilMoisture") ) { + JOptionPane.showMessageDialog(null,"Be Careful the soil is dry : "+level+" in the following sensor :"+tag +"in the device:"+id,"Soil Moisture",JOptionPane.INFORMATION_MESSAGE); + final String soilMoisture = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Be Careful the soil sensor %s is dry: %s \", \"soilMoisture\": %s}]}}", fixedIdG1,tag,level,level); + httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",soilMoisture); + System.out.println("Soil is dry"+level+" in the following sensor"+tag); + critical = true; + } + if (level <= 0.57 && level >= 0.11 && k.equals("soilConductivity") ) { + JOptionPane.showMessageDialog(null,"Optimal EC levels in the soil : "+level+" in the following sensor"+tag,"Soil Conductivity",JOptionPane.INFORMATION_MESSAGE); + final String soilConductivity = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"Optimal EC levels in the soil %s\", \"soilConductivity\": %s}]}}", fixedIdG1, level,level); + httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",soilConductivity); + System.out.println("Optimal EC levels in the soil"+level +" in the following sensor:"+tag); + critical = true; + } + if (level > 20 && k.equals("dielectricPermittivity") ) { + JOptionPane.showMessageDialog(null,"High dielectricPermittivity : "+level+" in the following sensor"+tag,"dielectricPermittivity",JOptionPane.INFORMATION_MESSAGE); + final String dielectricPermittivity = String.format("{\"id\":\"%s\",\"data\":{\"measured\":[{ \"status\": \"High dielectricPermittivity %s\", \"dielectricPermittivity\": %s}]}}", fixedIdG1, level,level); + httpPost.HttpCallPost("http://connector.dev.whysor.com/default/insert?access_token=3hosOhAeh4k0XmcuAMQGfYldvTuQDvtAj2PJJ4irKPBefD5Ijij6gnUkLtVLd4fW",dielectricPermittivity); + System.out.println("High dielectricPermittivity"+level +" in the following sensor:"+tag); + critical = true; + } +// if(critical == true){ +// finalOutput +// } + finalOutput = String.format("{\"id\":\"70B3D570500042D7-status\",\"data\":{\"measured\":[{ \"status\": \"The status of the device 1 is critical\",}]}}"); + System.out.println(finalOutput); + }*/ + +end \ No newline at end of file diff --git a/target/classes/rules/warnings.drl b/target/classes/rules/warnings.drl new file mode 100644 index 0000000..d10e582 --- /dev/null +++ b/target/classes/rules/warnings.drl @@ -0,0 +1,9 @@ +import eu.hsrw.ias.ggd.Notification; +import eu.hsrw.ias.ggd.Severity; + +rule "Green House Critical" +when + warning: Notification(severity > Severity.Info) +then + System.out.println("Green House critical, because of: '"+warning.getType()+"'"); +end \ No newline at end of file