Announcement

Collapse
No announcement yet.

Creating virtual device to hold the date of the next full moon

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Creating virtual device to hold the date of the next full moon

    Greetings from the land of confusion. Title says what I'm trying to do. I could do this in HS3, but am unable to get this created in HS4. I don't beleive I fully understand the structure of devices now. Would appreicate some tutoring or being pointed to documentation,

    Here is the event -
    Execute the command:
    &hs.SetDeviceString(1308, "The next full moon is on " & " " & FMoon.ToShortDateString, True)
    Where 1308 is the "Control" device that was created along with the virtual device.
    I want to dispaly the date via HSTouch.
    Thanks,
    Barry

    #2
    @lhfarm, give this a try...

    &hs.SetDeviceString(1308, "The next full moon is on " & FMoon.ToShortDateString, True)

    Also, what does the script look like that dimensions the FMoon variable?


    Thanks,

    Roger

    Comment


      #3
      Just in case, give this a try.

      Code:
      Sub Main(parm as object)
      Dim dtStart as Date = Now
      Dim NMoon as Date
      Dim FMoon as Date
      Dim CurCycle as Integer
      Dim sDesc as String = ""
      hs.Moon(dtStart, NMoon, FMoon, CurCycle, sDesc)
      hs.SetDeviceString(1308, "The next full moon is on " & FMoon.ToShortDateString, True)
      End Sub
      Roger

      Comment


        #4
        Have you checked your error log?

        Click image for larger version  Name:	Script Error log.PNG Views:	0 Size:	131.2 KB ID:	1446906
        For me, I have to use &nhs but I think that might just be a Linux thing...

        Click image for larger version  Name:	SetDeviceString.PNG Views:	0 Size:	31.7 KB ID:	1446907
        I can set both the Feature device (747) and the Root device (746)...

        Click image for larger version  Name:	Device 746 Status String.PNG Views:	0 Size:	20.8 KB ID:	1446908

        Try testing without the string concatenation. If you get that working but the concatenated string doesn't then the issue is something with the concatenation syntax...
        HS4 Pro Edition 4.2.5.0 running on Lenovo ThinkCenter & Debian Linux
        Plugins: Z-Wave (via Nortek USB stick

        Home Assistant 2021.10.6 running on HA "Blue" ODROID-N2
        Add-ons: Android Debug Bridge, Duck DNS, ESPHome, File Editor, Glances, HA Google Drive Backup, InfluxDB, Log Viewer, MariaDB, Mosquitto broker, NGINX SSL Proxy, Node-RED, Portainer, SSH & Web Terminal, Samba, TasmoAdmin, UniFi Controller, Visual Studio Code, WireGuard, Zigbee2mqtt, Z-Wave JS to MQTT
        Integrations: AccuWeather, Alexa Media Player, Glances, Google Nest, HACS, HomeSeer, Insteon, IPP, Life360, Local IP, Logitech Harmony Hub, Mobile App, MQTT, My Garage, OpenWeather, Spotify, Tuya Local. Ubiquiti UniFi, Z-Wave JS
        Insteon: 2413S Dual Band PLM
        Zigbee: zzh! CC2652R Rev A
        Z-Wave: RaZberry daughtercard on RPi 1B via ser2net

        Comment


          #5
          Note too that you can delete the Feature (control) device and just use the root for status if that's all you need.
          HS4 Pro Edition 4.2.5.0 running on Lenovo ThinkCenter & Debian Linux
          Plugins: Z-Wave (via Nortek USB stick

          Home Assistant 2021.10.6 running on HA "Blue" ODROID-N2
          Add-ons: Android Debug Bridge, Duck DNS, ESPHome, File Editor, Glances, HA Google Drive Backup, InfluxDB, Log Viewer, MariaDB, Mosquitto broker, NGINX SSL Proxy, Node-RED, Portainer, SSH & Web Terminal, Samba, TasmoAdmin, UniFi Controller, Visual Studio Code, WireGuard, Zigbee2mqtt, Z-Wave JS to MQTT
          Integrations: AccuWeather, Alexa Media Player, Glances, Google Nest, HACS, HomeSeer, Insteon, IPP, Life360, Local IP, Logitech Harmony Hub, Mobile App, MQTT, My Garage, OpenWeather, Spotify, Tuya Local. Ubiquiti UniFi, Z-Wave JS
          Insteon: 2413S Dual Band PLM
          Zigbee: zzh! CC2652R Rev A
          Z-Wave: RaZberry daughtercard on RPi 1B via ser2net

          Comment


            #6
            The command runs (and always did) without any errors in the log, but nothing appears for the device. Perhaps the problem is how I set up the device. I had deleted the "control" prior to running the script. What should I do, beyond naming a virtual device?

            And thanks for the help.

            Comment


              #7
              Originally posted by lhfarm View Post
              The command runs (and always did) without any errors in the log, but nothing appears for the device. Perhaps the problem is how I set up the device. I had deleted the "control" prior to running the script. What should I do, beyond naming a virtual device?

              And thanks for the help.
              I created an HS4 virtual device, deleted the control device and I can set the root device status to a string...

              Code:
              &nhs.SetDeviceString(746,"The next sunrise is: ",True)
              Click image for larger version

Name:	Next Sunrise.PNG
Views:	174
Size:	25.3 KB
ID:	1447001
              HS4 Pro Edition 4.2.5.0 running on Lenovo ThinkCenter & Debian Linux
              Plugins: Z-Wave (via Nortek USB stick

              Home Assistant 2021.10.6 running on HA "Blue" ODROID-N2
              Add-ons: Android Debug Bridge, Duck DNS, ESPHome, File Editor, Glances, HA Google Drive Backup, InfluxDB, Log Viewer, MariaDB, Mosquitto broker, NGINX SSL Proxy, Node-RED, Portainer, SSH & Web Terminal, Samba, TasmoAdmin, UniFi Controller, Visual Studio Code, WireGuard, Zigbee2mqtt, Z-Wave JS to MQTT
              Integrations: AccuWeather, Alexa Media Player, Glances, Google Nest, HACS, HomeSeer, Insteon, IPP, Life360, Local IP, Logitech Harmony Hub, Mobile App, MQTT, My Garage, OpenWeather, Spotify, Tuya Local. Ubiquiti UniFi, Z-Wave JS
              Insteon: 2413S Dual Band PLM
              Zigbee: zzh! CC2652R Rev A
              Z-Wave: RaZberry daughtercard on RPi 1B via ser2net

              Comment


                #8
                Roger's script worked. Still not sure why the command failed, but I'm just happy to have it working!
                Barry

                Comment

                Working...
                X