Sensor data processing



  • @user2684
    Now for each sensor on the tab "Processing" some manipulation of data received can be performed. Would it be possible to have a line added that provides the possibility to ad a positive or negative float value to the data of the sensor?

    In that way the line display of data from different sensors can be moved up and down relative to each other.



  • @user2684

    Another feature would be handy.

    Would it be possible to have the user insert a value to be displayed receiving a "1" and a different value receiving a "0" ?



  • Not sure I get what you want to achieve here. Let me first give some more details. Users can define any manipulation function by editing the configuration of controller/hub. All the controller modules do not have yet an editor wizard so the advanced editor will be opened. Down below there is a "processor" section. This defined the name of the function and the operating system command which is run to manipulate the value. The actual value is replaced into the %value% placeholder.
    So for example the following can be used to convert from miles to km:
    mile->km: echo 'print %value% * 1.609' | python
    I'm using python here but can be any.



  • @user2684

    If I understand you correctly the user is able to manipulate all incoming data as he likes by editing the configuration of "controller/hub".

    That is great but requires me to investigate further.

    What I mean are two things:

    To move a graph up or down on a window it would be handy to ad a positive or negative float value to incoming data.

    The second one would be to e.g. replace an incoming "1" by the text "up" and an incoming "0" by the text "down"



  • This post is deleted!


  • @eporocrail correct, I wanted to be sure users have maximum flexibility in manipulating their data. So yes, you can do something like the followin:

    BOOL_TO_UPDOWN: echo 'print "up" if "%value%"=="1" else "down"' | python

    Of course this can become a bit complex for more sophisticated requirements.



  • @user2684

    With my input I received an error message. I tried with the built-in possibility "1-ON"

    Received error message:

    [controller/hub] [mesh-in/onshuis/opsinterval] Unable to normalize OFF: Traceback (most recent call last):| File "controller/hub.py", line 163, in save_value| message.set("value", sdk.python.utils.numbers.normalize(message.get("value"), sensor["format"]))| File "sdk/python/utils/numbers.py", line 24, in normalize| elif format == "int": return int(float(value))|ValueError: could not convert string to float: OFF|
    

    Your advice please



  • 1-ON does the opposite I think.
    Try with a custom ON-1 defined as:

    ON_to_1: echo 'print 1 if %value%=="ON" else 0' | python
    


  • @user2684

    What I am aiming for is e.g. "1" is displayed as "ops" and "0" is displayed as "test".

    When I tried it, I received the error message.

    Than I used the built-in "1-to-ON" function.
    same error message.

    In my environment the processing of data seems to be not working.

    What is required to have it working?



  • What I am aiming for is e.g. "1" is displayed as "ops" and "0" is displayed as "test".

    Ok let me just distinguish two situations for future reference of other users as well. Values stored by a sensor can be transformed before being saved. In this way the value will be the one transformed. Good if ok to have a value which is already manipulated in rules. Other approach is to store the original value and having a display-time transform. This is not available right now.
    If option 1 is ok for you, ensure you are using the ON_to_1 provided, this takes a string (ON/OFF) and converts it to 1 or 0 if this is what you want. Ensure also the format of the sensor is the one of the transformed value



  • @user2684

    I understand the difference. The data I am displaying are feedback info's from the sensors. For that reason it is fine for me to transform the data and than display the result.

    But I need a transformation from "1-to-ON" and not he other way around.

    The real point is, that the transformation action as built in and the ones I created myself do NOT WORK.

    What are the external requirements for eGeoffrey to carry out the transformation?



  • The real point is, that the transformation action as built in and the ones I created myself do NOT WORK.

    Are you saying also the ON_to_1 I posted above is not working? With which error message?

    What are the external requirements for eGeoffrey to carry out the transformation?

    None since this is entirely run from within the runtime container so no other dependencies are needed



  • @user2684 said in Sensor data processing:

    ON_to_1: echo 'print 1 if %value%=="ON" else 0' | python

    @user2684

    "ON-to-1" does not make sense to me because the data is not "ON" or "OFF" but "1" or "0".

    At the moment I can not do any test, because I am bussy with general overhaul. I want to make my sensor module software more general. Related to that I have to update eGeoffrey also.

    As soon as I am ready and my system is working again, I will report on the changes.



  • so if understood correctly you receive 1 or 0 on the sensor and want to transform into ON or OFF. I'd then say the out of the box 1_to_ON should work provided the sensor is configured with a format of string since this is what it will eventually store



  • @user2684

    Your remark triggered the right thought on my side.

    I think I had a format problem.

    I'l report back when I am that far with my new installation.



  • @user2684

    It is working correctly. I did not have the format "String" selected.


Log in to reply