Virtual Sensor

Hi,
I have a question concerning the simulator

In fact I was wondering if a simulation of a virtual sensor can be
possible with openremote, I’ve saw the simulator in the smart building demo, I
don’t know if I’m right, but I understood that with that one we need to type the
values ourselves.

What I hope to know is, is it possible to make simulation with a virtual
sensor that generates values automatically the same way that a real one works ?

I hope that you answer me soon

Amine.

Hi Amine,

You can create a new attribute which you fill via a Groovy rule which generates the values.

Pierre

Hi,

Hi,

I have put a gist together with a rule that will update an asset’s attribute (in this example the microphone level of a sound asset - you will need to update the asset ID as explained in the gist):

https://gist.github.com/richturner/178cd9689ceabf1bd7abcccb0e3d8d19

Rich

Hi Richard,

Thank you for your last reply, however I have some little questions and
I hope that you can answer me.

In fact when I try to execute the example that you linked, there are
few thinks that still confusing.

I didn’t understood what should be the type and the configuration of the
attribute that I should create, and how can I connect it with rule, because when
I’m using the openremote manager demo and try to add a new ruleset, I can’t,
and the interface remain greyed out.

I hope that you can answer me soon,

Thank you in advance,

Best regards,

Amine

Hi,

There was a bug in the manager rules UI which would have prevented you creating a new ruleset; I pushed a fix for this last week so please pull the latest docker images.

If you want to create a new asset and/or attribute for your virtual sensor data then the type of the attribute should be whatever the data type of the data you want to simulate (number, boolean, string/text, etc.)

Hi

Thank you very much for your reply it helped me a lot.

Hi Richard
there still something that I didn’t understood in the gist and i hope that you can help me with it.

Could you please inform me if the values that are generated by the virtual sensor rule are linked to the Openremote middleware or not? I mean, can the middleware use the values that are generated by the virtual sensors?

If yes, could you please inform me how?

thank you in advance.

Best Regards,

Amine.

Hi,

The attribute you are generating virtual data for can have the RULE_STATE and/or RULE_EVENT meta/configuration item added and then it will be available in the rules engine to reason over.

Hope this helps.

Rich

Hi,
Thank you for your reply, however it still a bit confusing, and I think that I didn’t formulate my question well.

What I meant to say is, correct me if I’m wrong please, normally, in a real smart home, the data that are generated by the connected devices, should reach the OpenRemote Middleware to be processed, stored, displayed, etc.

Are the data that are generated by the rule in the gist behaving the same way? can they reach the OR Middleware to be processed before being displayed? or are they just directly displayed on the attribute in the manager?

Forgive me if it’s a bit unclear

thank you in advance

Amine.