Setting states after reboot

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
timb
Posts: 99
Joined: 03 Jan 2015 00:10

Setting states after reboot

Post by timb »

I wonder if anyone can help me...

I have been using Zway for a few years now. I use the Dummy Device frequently to represent a state, e.g. dd_DarkOutside, dd_SomeoneIntheHouse.
But I have also found them useful to represent virtual devices that mirror physical devices. So for example I have one for each of the various swicthes that control my heating system. I use the Rules logic to control the dd_device and the Association app to connect the virtual and physical devices. The reason for doing this is that if a physical device fails (and they do from time to time), then the physcical device can be replaced and I only have to change the Association to the new device. I don't have to look for all the places it might have been in Rules and Scenes.

There is another reason too. Sometimes I find that a Rule has triggered a change of swicth state, but for whatever reason the switch has not responded (frustrating!). This can be really bad - I could leave my heating on all day when the rule was supposed to turn it off. My solutoin is to use the AOn_Clock and Automated Swicth Off app to toggle a dd_device that I call dd_clock. Basically my dd_clock toggles every minute. Now I can create a rule that says:
if dd_device <> physical_device & ddclock then set physical device appropriately. Essentially this is a retry mechanism, which tries every minute to align the physcial and dummy devices. It works well.

By the way, add dd_clock to a Rule that is sensing a variable, like Temperature and it will try the rule everytime the clock changes.

Anyway, the question is this.... is there a way for me to run a start up script to set the state of the dummy devices when ever the Pi is restarted?

Many thanks for any help.
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: Setting states after reboot

Post by PoltoS »

Hi!

There is a Custom JS Code, but it can run before your Dummies are created, so put a setTimeout inside to let the code finally boot. Or trap the core.start (fired from main.js) event to execute your code.
bogr
Posts: 190
Joined: 16 Nov 2015 22:46

Re: Setting states after reboot

Post by bogr »

The reason for doing this is that if a physical device fails (and they do from time to time), then the physcical device can be replaced and I only have to change the Association to the new device.
I've been thinking about the same thing, but realized one flaw in this strategy. E.g. if dd_switch_room_1 is associated with a z-way switch ("if dd_ then switch"), and I turn on/off the physical switch, the dd_XXX will not be updated. Have you solved this? I guess that a "bidirectional" association, i.e. "if z-way-switch then dd_switch_room_1" might create a circular dependency and maybe not work as expected? Or do you mean you have the periodical cron that triggers a sync between all associations switch->dd_XXX?
Post Reply