Is there any way to create a virtual network of a typical smarthome environment without any real physical devices and generate network traffic and interactions among them using Java code? I want to emulate a smart home environment for my research work as I don’t have any IoT devices as of now. Please point me to the resources to solve the following.
- Create a virtual network with IoT devices and hubs which use different protocols like Zigbee, Bluetooth and Zwave
- How can I generate interactions among devices using API
- How to write rules to trigger the events based on the interactions.
IMHO without any real devices there will be now networktraffic for those different protocols.
Thank you for your reply.
I understand. Is there no way to generate traffic from software components?
You would need at least “instances” (simulated devices or something like that) in order to see network traffic in these protocols.
If you need network traffic only in general that could be done between items alone . Just create rules that postUpdate items and rules that react on such changes.
I think you need to be a little more clear on what you want to achieve. Do you understand what OH provides and how that can be used?
As an example, you create a virtual temperature sensor in OH. Does it really matter what the protocol is that sends that data back to OH? I’m not sure it does, so you could create an external script in either Bash or Batch, depending on the OS your using, have that run at random times where the value either increases or decreases. What are you then going to do next with that data? Switch on the Heating or adjust the air conditioning? If the temperature is falling, do you want to check why that maybe? So check if there are any doors or windows open. Has the air conditioning been switched on manually?
Trying to model the smart home in software is possible, but very complicated and not something many people would want, where they are working with the likes of OH as it’s more of a hobby / passion.
I’ll second Garry’s post. It isn’t entirely clear what you are really trying to achieve nor is it clear you understand how OH itself works.
All of this is stuff that, in a “real” system is external to OH. There is a one-to-one relationship between bindings and technology (for the most part). So OH can talk to a Zwave network and OH can talk to a Zigbee network and OH can talk to stuff over WiFi and the like. But all of that stuff is outside of OH. OH interacts with them using an API and sometimes a physical gateway deviec (e.g. for Zwave a USB Controller device).
So OH isn’t going to simulate or create a virtual network of anything.
This basically asking “how does OH work.” It’s OH’s main job. It has add-ons that support the interaction between itself and a given technology. The devices used in that technology are presented inside OH in a unified manner (Things, Channels and Items). When an event occurs on Device A, that event gets transmitted to the binding add-on, translated to standard OH format, and passed into the rest of OH as an event on the Item. A Rule can trigger based on that event and the Rule can generate new events on other Items based on state, time, whatever.
So, as Garry indicated, you can’t really simulate Zwave. But you can simulate events (doesn’t matter where the events come from) and inject them into OH. So OH can only be used to simulate a home automation at a very high level (events), not for simulating stuff like wireless interference, specific technologies, etc.
I believe it is not a virtual network, instead a virtual environment.
As stated above, without any physical hardware to interact with, you could only use virtual ones.
For that purpose installing OH on a computer or on a virtual machine and applying the DEMO could support the evaluation if it fits your expectations.
However you may possibly install several virtual devices and connect them through the existing bindings to OH, but I suspect, those are typically emulation of hub kind of things over the network.