Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
naiades
naiades-platform-poc
Commits
0a6024fc
Commit
0a6024fc
authored
Sep 08, 2020
by
Federico Sismondi
Browse files
Fixes() for DCA watering and DCA weather use cases
parent
00b9412d
Changes
2
Hide whitespace changes
Inline
Side-by-side
dca-carouge-watering/app.py
View file @
0a6024fc
...
...
@@ -143,7 +143,7 @@ def _forward_to_message_broker():
entity_id
,
street_address
=
mapping_deveui_to_fiware_instance_meta
[
dev_eui
]
_log_level_of_moisture
(
sensor_reading
,
entity_id
)
app
.
logger
.
info
(
"Forwarding IoT reading
({})
to IoT platform entity
:
{}"
.
format
(
sensor_reading
,
entity_id
))
app
.
logger
.
info
(
"Forwarding IoT reading to IoT platform
(
entity {}
)
"
.
format
(
entity_id
))
url
=
"{}/v2/entities/{}/attrs?options=keyValues"
.
format
(
URL_BASE
,
entity_id
)
payload
=
{
'boxId'
:
entity_id
.
split
(
'-'
)[
-
1
],
...
...
@@ -220,9 +220,9 @@ def post_dca_carouge_watering_sensed_data_payload():
return
resp
@
app
.
route
(
'/dca-carouge-watering-sensed-data/rest/callback/nodeinfo'
,
methods
=
[
'P
OS
T'
])
def
p
os
t_dca_carouge_watering_sensed_node_info
():
print
(
request
.
json
)
@
app
.
route
(
'/dca-carouge-watering-sensed-data/rest/callback/nodeinfo'
,
methods
=
[
'P
U
T'
])
def
p
u
t_dca_carouge_watering_sensed_node_info
():
_dummy_post_handler
(
)
raise
InvalidUsage
(
message
=
'This is still not implemented'
,
payload
=
request
.
json
)
...
...
@@ -238,3 +238,4 @@ def get_dca_carouge_watering_sensed_data_callback():
if
__name__
==
"__main__"
:
app
.
run
(
host
=
"0.0.0.0"
,
debug
=
True
,
port
=
80
)
dca-carouge-weather/weather_api.py
View file @
0a6024fc
...
...
@@ -55,7 +55,7 @@ def get_data_from_weather_service():
url
=
URL_weather_service
,
timeout
=
90
,
)
except
(
requests
.
exceptions
.
ConnectTimeout
,
requests
.
exceptions
.
ConnectionError
):
except
(
requests
.
exceptions
.
ReadTimeout
,
requests
.
exceptions
.
ConnectTimeout
,
requests
.
exceptions
.
ConnectionError
):
logger
.
info
(
'Could not weather reach service'
)
return
None
try
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment