• Categories
    • Recent
    • Tags
    • Popular
    • Register
    • Login
    1. Home
    2. loic13
    L
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 7
    • Groups 0

    loic13

    @loic13

    3
    Reputation
    516
    Profile views
    7
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    loic13 Unfollow Follow

    Best posts made by loic13

    • RE: 0.0.3.Final pre-release - volunteers required to test

      backup, install 0.0.3.Final, restore: everything is ok for me also. thanks

      posted in Announcements
      L
      loic13
    • RE: Sunrize sunset forward

      @adulovic
      Hi,
      As jkandasa said, you should probably download the last SNAPSHOT version again. Your error message seems to be because you don't have the SNAPSHOT with his modification.
      As for the step-by-step i can try to explain the way i did it:

      • First, i'm using a Raspberry Pi Zero for the controller with an up-to-date Raspbian distro.
      • I have the last 0.0.3.Final-SNAPSHOT of MyController.org(at least the one from 24 days ago with jkandasa's modification).
      • I'm using the 2.0.0 version of MySensors (soon to be updated to the last version).
      • On MyControler.org i created 2 UID tags (sunrize and sunset) which point to 2 dummy sensors (child of a MySensors node).
      • Then i have the java script which send the sunrize and sunset value to this UID tags:
      var myImports = new JavaImporter(java.io, java.lang, java.util);
      
      with(myImports) {
        //Get Sunrise/Sunset details
        var locSettings = mcApi.utils().getServerLocationSettings();
      
        //Get sensor variables for sunrise and sunset
        var sensorSunRise = mcApi.uidTag().getByUid("sunrize").getSensorVariable();
        var sensorSunSet = mcApi.uidTag().getByUid("sunset").getSensorVariable();
      
        //Update timezone offset values (by default gives GMT timestamp values)
        //sensorSunRise.value = locSettings.sunriseTime + locSettings.timezoneOffset;
        //sensorSunSet.value = locSettings.sunsetTime + locSettings.timezoneOffset;
      
        var dtr = new Date(locSettings.sunriseTime);
        sensorSunRise.value = dtr.getHours() + ':' + dtr.getMinutes();
      
        var dts = new Date(locSettings.sunsetTime);
        sensorSunSet.value = dts.getHours() + ':' + dts.getMinutes();
      
        //Send/Update thise sensorvariable with updated value
        mcApi.sensor().sendPayload(sensorSunRise);
        mcApi.sensor().sendPayload(sensorSunSet);
      }
      
      • On MyControler.org i created an Operation to execute the java script
      • and a Timer to start the Operation before Sunrize every day.

      For your java script you just need to add an if statement comparing the sunrize and sunset values with the current time, and you should be good.

      posted in Scripts
      L
      loic13
    • RE: Sunrize sunset forward

      @jkandasa Thank you very much.
      Everything is working.
      1_1481983136361_IMG_20161217_084224-s.jpg 0_1481983136323_IMG_20161217_084055-s.jpg

      posted in Scripts
      L
      loic13

    Latest posts made by loic13

    • RE: Sunrize sunset forward

      @adulovic
      Hi,
      As jkandasa said, you should probably download the last SNAPSHOT version again. Your error message seems to be because you don't have the SNAPSHOT with his modification.
      As for the step-by-step i can try to explain the way i did it:

      • First, i'm using a Raspberry Pi Zero for the controller with an up-to-date Raspbian distro.
      • I have the last 0.0.3.Final-SNAPSHOT of MyController.org(at least the one from 24 days ago with jkandasa's modification).
      • I'm using the 2.0.0 version of MySensors (soon to be updated to the last version).
      • On MyControler.org i created 2 UID tags (sunrize and sunset) which point to 2 dummy sensors (child of a MySensors node).
      • Then i have the java script which send the sunrize and sunset value to this UID tags:
      var myImports = new JavaImporter(java.io, java.lang, java.util);
      
      with(myImports) {
        //Get Sunrise/Sunset details
        var locSettings = mcApi.utils().getServerLocationSettings();
      
        //Get sensor variables for sunrise and sunset
        var sensorSunRise = mcApi.uidTag().getByUid("sunrize").getSensorVariable();
        var sensorSunSet = mcApi.uidTag().getByUid("sunset").getSensorVariable();
      
        //Update timezone offset values (by default gives GMT timestamp values)
        //sensorSunRise.value = locSettings.sunriseTime + locSettings.timezoneOffset;
        //sensorSunSet.value = locSettings.sunsetTime + locSettings.timezoneOffset;
      
        var dtr = new Date(locSettings.sunriseTime);
        sensorSunRise.value = dtr.getHours() + ':' + dtr.getMinutes();
      
        var dts = new Date(locSettings.sunsetTime);
        sensorSunSet.value = dts.getHours() + ':' + dts.getMinutes();
      
        //Send/Update thise sensorvariable with updated value
        mcApi.sensor().sendPayload(sensorSunRise);
        mcApi.sensor().sendPayload(sensorSunSet);
      }
      
      • On MyControler.org i created an Operation to execute the java script
      • and a Timer to start the Operation before Sunrize every day.

      For your java script you just need to add an if statement comparing the sunrize and sunset values with the current time, and you should be good.

      posted in Scripts
      L
      loic13
    • RE: Sunrize sunset forward

      @jkandasa Thank you very much.
      Everything is working.
      1_1481983136361_IMG_20161217_084224-s.jpg 0_1481983136323_IMG_20161217_084055-s.jpg

      posted in Scripts
      L
      loic13
    • RE: Sunrize sunset forward

      I, Thank you very much, that's perfect.
      I'm sorry to ask again, i don't know javascript. How can i access the sunrizeTime and sunsetTime value on my script ?
      I manage to send a string using the sendPayload() function but what is the correct way to access sunrizeTime value?:
      mcApi.sensor().sendPayload(???????);
      Thank you.

      posted in Scripts
      L
      loic13
    • RE: 0.0.3.Final pre-release - volunteers required to test

      backup, install 0.0.3.Final, restore: everything is ok for me also. thanks

      posted in Announcements
      L
      loic13
    • RE: Sunrize sunset forward

      Thank you jkandasa.

      posted in Scripts
      L
      loic13
    • RE: Sunrize sunset forward

      @loic13
      I found this:
      static String SKEY_SUNRISE_TIME
      static String SKEY_SUNSET_TIME
      How can i retrieve the values and forward it (forward payload?) ?
      Thanks

      posted in Scripts
      L
      loic13
    • Sunrize sunset forward

      Hi,
      First, thank you for mycontroler.org. It is a great controler for mySensors.
      I'd like to send the sunrize and sunset time to one of my node which display some data on a LED matrix chain i have. The sending and receiving data is working great via forward payload rules. I already receive data from my other sensors. So this part is ok.
      I just don't know how to get the sunrize and sunset information which are already on the dashboard. I assume that it can be done with a script, but i have no idea how to get the data.
      Could anyone point me to a direction for my research ?
      Thanks

      posted in Scripts
      L
      loic13