Virtual switch doesn't create events

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
platypus
Posts: 44
Joined: 28 Apr 2019 16:32

Virtual switch doesn't create events

Post by platypus »

To turn a rule on an off I created a virtual binary switch called “smoke detector network” using the app “Virtual Device (JavaScript)” but the rule did not react on turning it off to shutdown the sirens. That’s why I made a second try using the App “Dummy Device” to create the switch.

With the “Dummy Device” switch I made the following observations and encountered some problems:
  • (1) After creation the switch was off by default. Ok.
  • (2) The switch shall be be turned on automatically after an hour by the app “Automated Switch On” but it did not because there was no preceding “off event” recorded.
  • (3) I expected the “Periodical Selected Switch Polling” app to poll the switch an create the “off event” but it did not.
  • (4) Manually clicking on off created the “off event” as expected.
  • (5) The App “Automated Switch On” turned the switch on an hour after the “off event” as expected but it created no “on event”. For comparison: In the previous setup with a “Virtual Device (JavaScript)” switch it created an “on event”.
  • (6) After restarting the Raspberry the switch was still on as I expected. The previous “Virtual Device (JavaScript)” switch was initially off and created an “off event” after its configured polling interval so it could be turned on by “Automated Switch On”.
Why doesn’t the “Dummy Device” switch create the on and off events in cases 3 and 5?
After a restart a event seems to be created for every real sensor and switch which shows the last known state. Wouldn’t it be nice if virtual switches did so too?
What is better for this use case, the “Virtual Device (JavaScript)” or the “Dummy Device” app?
If “Virtual Device (JavaScript)” is to prefer, how to configure it?

Z-Way version is v4.0.3.
seattleneil
Posts: 172
Joined: 02 Mar 2020 22:41

Re: Virtual switch doesn't create events

Post by seattleneil »

You are correct, a device created using the "Dummy Device" app has very limited functionality. It will not do what you want. A binary switch created using the “Virtual Device (JavaScript)” app will do what you want.

Here's a screenshot that shows you how to create a binary switch using the “Virtual Device (JavaScript)” app that you can use in a rule and control from the “Automated Switch On” app, from the web UI or API.
Test Switch.png
Test Switch.png (30.81 KiB) Viewed 1205 times
Note that using the “Periodical Selected Switch Polling” app for this device is unnecessary.

Good luck.
Post Reply