No announcement yet.

Virtual Devices values does not update?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Virtual Devices values does not update?

    So I have a rather large number of VDs (Virtual Devices) that contains information for my HA system. It's VDs like "TOD", or "Dayname" or "VacationFrom" and so on. Now I realize that they do not always update. The number of examples I have is large, close to all VDs actually. I have tried to have them as multiswitches, and as sensors. Neither get auto refresh.

    Now the "Dayname" VD actually seems to update itself when I hit refresh symbol in the upper right corner.

    But the "VacationFrom" VD will not update the value with refresh, this one needs a rebuild from inside the imperhome plugin config page, and then a full reload (stop app in tablett, and start it up from scratch) to get the latest value. Now this case might be special since I use "&nhs.setDeviceString" to set the value on this VD (I do not set the value, just the string!) so maybe something else is needed in my code (setting the value also, not just the string).

    However, it seems I do not trigger a refresh of the value/string of my VDs - so how do I do that? What is the magic that makes updating the value in the tablet app? What am I doing wrong and missing?

  • #2
    what are the parameters you pass to "&nhs.setDeviceString" ?
    the last parameter needs to be "true" for the IH plugin to be notified of the change


    • #3
      Aha - then I know :-) Well this is the code I use, and is says False on the end:

      &nhs.SetDeviceString(592, DateTime.parse(FormatDateTime(hs.GetVar("gv_tod_vacation_from"))).ToString("yyyy-MM-dd") ,False)
      So I only need to change to "True" right? I'll test it straight away :-)

      Very large thanks!


      • #4
        I noticed when I look into a number of different parts of my vb code that I always use False when I do SetDeviceString - I wonder why that is? Strange habit I guess...


        • #5
          Okay this has solved the Vacation from challenge - still I do no know how to solve name of the day VD, or the Squeezebox Favorit VD - both are using different ways of setting information. I will have to play around a bit I guess. I'll be back!


          • #6
            Okay, so I still have not figured out why my VD for "NameOfDay" does not get updated. This VD contains 29 different status messages, like 0 = Sunday, 1 = Monday all the way to 26 = Christmas and so on. And the way this is set is by using:

            hs.setDeviceValueByRef(18, 21, True)
            In this code example 21 = Swedens National Day (6th of June). However this seems to be well it does get updated sometimes, but this morning it was not. So in a way I guess I might have to wait. That being said (written), there is no value in the String field of the VD - it is only the Value field that contains the correct value and this displays the name of the day in the HS3 WEB GUI. I might be doing something wrong here also - do I need to set the String field to something for getting the update in the tablett to work?


            • #7
              I still have problem with "Name of the Day" - it is using TRUE as the flag, still it does not update. Funny thing though is that other "multiswitches" based on Virtual Devices seems to work - just not this one. Since this is a static variable (not a switch so to speak), would it work better as a "sensor" with "string value"? or what am I doing wrong here? or missing?


              • #8
                There seem to be maybe like this: setting a VDs value thru an event without script (you code it in the GUI so to speak) works, however setting it in an vb script like above (not setting string value, just the status value?) does not trigger update of thar field on the ImperiHome app...?


                • #9
                  I have been testing this for the hole evening, new VDs, new page in Imperiohome, new sensors/multiswitches/switches - everything works.

                  Yet when my script's change name of day VD, it does not work.
                  And when my script changes Squeezebox Favorite VD, it does not work.

                  I manage to fix "ImperiHome" Media System input VD so it reflects the correct media source, by having an extra VD that calls each possibly value on the non working Media System Source, so everythings works and is correctly presented in ImperioHome. But getting the original VD does not work.

                  It feels like I am still missing something, and yes nowdays I am sure they all use "True" on the last parameter.

                  Time for some rest I guess.


                  • #10
                    So it seems to work now, I reserve my right to change my mind (again) if I am wrong.

                    So what did I do? Well nothing changed except I decided to go into each multiswitch device and edit them, I simply removed a few green checkboxes and then set them again. In reality nothing so to speak changed, I simply triggered a change marking inside HS3/ImperHome plugin. And from that moment it seems to work.