Added verification when the ARVE credentials are or not defined

This commit is contained in:
Luis Aleixo 2022-09-22 10:06:52 +02:00
parent 2730a50d0f
commit b487f5272f
2 changed files with 5 additions and 0 deletions

View file

@ -256,6 +256,10 @@ class ArveData(BaseRequestHandler):
client_secret = self.settings['arve_client_secret']
arve_api_key = self.settings['arve_api_key']
if (client_id == '<undefined>' or client_secret == '<undefined>' or arve_api_key == '<undefined>'):
# If the credentials are not defined, we skip the ARVE API connection
return self.finish('ARVE API credentials not defined.')
http_client = AsyncHTTPClient()
URL = 'https://arveapi.auth.eu-central-1.amazoncognito.com/oauth2/token'

View file

@ -312,6 +312,7 @@ function show_sensors_data(url) {
url: `${$('#url_prefix').data().calculator_prefix}/api/arve/v1/${HOTEL_ID}/${FLOOR_ID}`,
type: 'GET',
success: function (result) {
if (result.length == 0) return; // If the ARVE credentials were not defined, we don't have a valid result.
DATA_FROM_SENSORS = result;
result.map(room => {
$("#sensors").append(`<option id=${room.RoomId} value=${room.RoomId}>Sensor ${room.RoomId}</option>`);