-
Notifications
You must be signed in to change notification settings - Fork 26
getDataBy...()
methds return None
if timeseries has no variable called value
#22
Comments
I figured out that this endpoint: https://{environmentFqdn}/eventSchema?api-version=2018-11-01-preview can be used to get an eventSchema (docs here: https://docs.microsoft.com/en-us/rest/api/time-series-insights/dataaccess(preview)/query/geteventschema). This will return the variable names, but just as a list of properties. It also not only contains the variables, but some other stuff as well, and it does not allow to link timeseries ids to variables. This is a body of a sample response:
|
@SiriOvregard your PR #24 solves this right? This issue could be closed in that case. |
@rafaelschlatter it solves the problem if and when the type JSON build up is something like meaning if the "build up" is not
As you see, at the moment an error is logged in the case of the type JSON build up being different and thats it. In our application of the client it works, but i believe the type JSON build up can vary, so I would recommend to test before closing the issue. (In any case, I believe this represents a bit of a weakness and should probably be amended at some point...) |
Lets keep it open |
Hi there - first of all thanks for the library - it as facilitated the entry to the TSI API. I run into this same error message. After digging a bit into the code I came to the conclusion, that the current architecture allows only for one variable, called Here a screenshot of the type in question for better understanding: |
Hi Anders,
All three methods
getDataById()
,getDataByName()
andgetDataByDescription()
returnNone
in case the timeseries that have been queried for do not contain a variable calledvalue
.This is can be seen in code at lines 610, 711 and 810 in
TSIClient.py
. The payload contains a hardcoded variable name that will be looked for in the TSI environment:"value": {"tsx": "$event.value"}
. I think this works fine most of the time, as by default (with the default type I belief, I am a bit rusty with the TSI jargon now) each timeseries has only one variable with the namevalue
.But the following situation is a problem:
![tsi_capture](https://user-images.githubusercontent.com/31158108/78050051-142f3b00-737c-11ea-86ee-c3d347148942.PNG)
MyPythonDevice has three variables and the current code returns
None
for all of them. To return e.g. the temperature, one has to use"value": {"tsx": "$event.temperature"}
in the payload.I try to address this in my next PR, at the moment I am not sure whether there is a way to retrieve the variable names (I just quickly checked the JSON for the time series instance and the type, and none of these contained the variable names).
Best regards,
Rafael
The text was updated successfully, but these errors were encountered: