*** WIP WIP *** woks now for live and havg

This commit is contained in:
rxf
2023-03-27 09:56:18 +02:00
parent 26e4b75a6f
commit 126acfeb7f
11 changed files with 498 additions and 99 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ const readLastDates = async (typ) => {
return await fetchFromInflux(ret, query)
}
export const getData4map = async (params) => {
export var getData4map = async (params) => {
let start = DateTime.now()
let ret = {err: null}
+7 -5
View File
@@ -104,7 +104,8 @@ export const calcRange = (opts) => {
// return:
// Returns from the special routines
// *********************************************
export const getSensorData = async (params) => {
// export const getSensorData = async (params) => {
export async function getSensorData(params) {
let ret = {err: null}
let {opts, err} = checkParams(params, { // check for sensorid
mandatory: [{name: 'sensorid', type: 'int'}],
@@ -116,7 +117,7 @@ export const getSensorData = async (params) => {
// with the sensorid get the type of this sensor
let erg = await getOneProperty({sensorid: opts.sensorid})
if (erg.err) {
return returnOnError(ret, err1, getSensorData.name)
return returnOnError(ret, erg.err, getSensorData.name)
}
// distribute to the right routine
@@ -132,7 +133,8 @@ export const getSensorData = async (params) => {
export const getActData = async (opts) => {
// export const getActData = async (opts) => {
export async function getActData(opts) {
let ret = {err: null, values: []}
let sorting = ''
if(opts.sort) {
@@ -156,7 +158,7 @@ ${sorting}
// ..../api/getavgdata?sensorid=123&span=2&avg=10&moving=true&datetime=2022-04-12T13:14:15Z
export const getAvgData = async (params) => {
export var getAvgData = async (params) => {
let ret = {data: {count: 0, values: []}, err: null}
let {opts, err} = checkParams(params,
{
@@ -200,7 +202,7 @@ export const getAvgData = async (params) => {
}
// ..../api/getlongavg?sensorid=123&span=2
export const getLongAvg = async (params) => {
export var getLongAvg = async (params) => {
let ret = {data: {count: 0, values: []}, err: null}
let {opts, err} = checkParams(params,
{