Mocking device script

I would want to create a mocking device script to do stability/perf test of openHab.
Would like to mock 1000’s of devices in form of script so that i would achieve my desired result.
Can anyone help me if already such device mocking scripts exists?
Also would like to know what is the input type the openHab takes in, so that I can write few device mock scripts.

The whole concept of OpenHAB is modular support of many hundreds of device types. You need to think about what kind of devices you want to simulate in the thousands.

The modular approach means that there is just not one “input type the openHab takes in”.
You could write a simulated binding that simulates the traffic that real bindings generate - but that wouldn’t be much of a test if it is not exercising the real bindings. A quick way to do that might be to use the REST interface.

To simulate end devices (and so test the complete system) you need to decide which of the hundreds of possible devices to simulate - they all work very differently, from GPIO to web based


Off topic - I was attracted to this thread by the word mocking. Oooh, I thought - a new use for OpenHAB, already imagining

sendCommand(Doorbell,  "Jeer at door-to-door sellers" )
sendCommand(Phone,  "Laugh at fake 'Windows Support' callers" )

Not sure what you’re trying to achieve. Basic tenet of load testing is you don’t use the DUT to generate its own load (unless that’s how it works in production). 1000 devices running on an operational system might have 1000 threads running to service them. If your mocks are running on the same machine, then you’d have another 1000 for the mocks, doubling the number of threads.

I’d look at setting up your mocks on another machine. Since your question asks about the kinds of inputs openHAB accepts, I’m guessing you don’t have target sensors or actuators in mind. Given that, I’d go with a TCP or UDP binding and run your mocks on another machine. You’re going to need another machine to measure end-to-end response time anyways.

It’s hard to say without a more detailed explanation of what exactly the OP is trying to test, but I’d probably do this slightly differently. I’d probably use a REST API testing tool like SoapUI etc and send HTTP POST requests to send commands to items.

1 Like

Thanks for your reply. Lets take it to be Philips hue led lights I want to simulate in 1000’s.
I found a hue emulator doing that. But every time I have to go and click on add bulb manually to reach 10,000. Instead if some script can invoke 10K hue lights that would be great. In this case i would want to test openhab’s Philips hue binding weather it is able to handle/control 10,000 lights at a time.

Yes I will setup 2 VM’s for doing this, one running openhab and other having my mock devices(script). An example would be to test philips hue binding in openhab. I would like to create 10K philips bulbs/lights-this is what i want my script should do. My doubt regarding input to openhab means the script which creates 10K bulbs should be sending data to openhab in what format. Like plain text,json, etc…If I get to know this then writing script is easier.

@danielwalters86 I tested hue binding through hue emulator creating 300 bulbs. I did get/post http req thro Jmeter. I would be more interested in creating devices(philips bulbs/lights) through my scripts. This script is what I want to create(mock device script)

You should be able to create a Hue Thing using the REST API.

@danielwalters86 Can you please explain how, sorry when you have time please can explain it.

Well, first off, I’d like to hear of any meaningful application of barely beta-level, tinkerer-grade software without any formal support for an application with 10,000 bulbs. 100 kW, really?

Secondly, have you considered that there is a finite amount of bandwidth available on the RF link of the bulbs? It likely can handle tens of devices without human-perceptible delay, but I’d be surprised if it can handle thousands, not to mention 10,000. As I recall, they use Zigbee, and even with DSSS, 10,000 units are going to be walking all over each other.

openHAB is likely to be the least of your worries, once you get 500 A, two-phase 240 V service available to run those bulbs.