(Last Updated: June 1, 2020)

Help with luup.chdev.sync



  • I'm struggling to fix the code attached here

    Under certain circumstances (thanks @DesT!) I see that it's causing a luup reload infinite cycle, because child devices are being created, then deleted. Specifically, I see this in the logs:

    2020-06-01 19:35:30.482   luup.chdev.sync:: [102] Open Sprinkler Test, syncing children
    2020-06-01 19:35:30.482   openLuup.chdev:: deleting [413] Daily Garden
    2020-06-01 19:35:30.482   openLuup.chdev:: deleting [414] Water Level
    2020-06-01 19:35:30.482   openLuup.chdev:: deleting [411] Daily Cedars
    2020-06-01 19:35:30.482   openLuup.chdev:: deleting [412] St-Eustache Rules AM
    2020-06-01 19:35:30.482   openLuup.luup:: device 102 'Open Sprinkler Test' requesting reload
    

    The devices are created (look at line 357/410), but when I call luup.chdev.sync, they got deleted. Any hints? Thanks



  • oh boy, I had an epiphany! I was calling append only on new devices, instead of every device! If omitted, the existing devices are removed!



  • Yes, indeed. It's a curious construct, but we have learned to live with it.

    My particular frustration is that some of the other parameters, which are standard in the call to create new devices, are not available here. I think that the whole chdev module is only there to avoid Vera's standard reload for every new device created.


Log in to reply