Avatar for Jean-Philippe_Rey

Jean-Philippe_Rey

Member since Apr 2015 • Last active Nov 2019
  • 32 conversations
  • 247 comments

Developping IoT @ http://www.novaccess.ch , Switzerland

80% Hardware
15% Firmware
5%Software

Linkedin: linkedin.com/in/jprey
Twitter: https://twitter.com/yerpj

Most recent activity

  • in Projects
    Avatar for Jean-Philippe_Rey

    It seems that HTTP2HTTPS does not work. I couldn't figure out exactly why. However, many people in Arduino world is using the HTTPSRedirect library to call a Google Apps Script ( https://github.com/electronicsguy/ESP826­6/tree/master/HTTPSRedirect)

    Unfortunately this mechanisms is running on the embedded side and is not compatible with Espruino. I searched for similar mechanism in Espruino but did not find anything. Just to be sure, I am asking here: Does anyone ever implemented such a redirection mechanism?

    Thanks for any help :-)

  • in Projects
    Avatar for Jean-Philippe_Rey

    Thanks @Ollie and @DamianMontero for your answers, I appreciate!

    Do you think I could use a Google Apps Script function to get the daily calendar (as shown here https://www.youtube.com/watch?v=sm1-l5-z­3ag

    ) and then call the script from Espruino?

    I tried this:

    var WIFI_NAME = "WIFI_NAME";
    var WIFI_OPTIONS = { password : "WIFI_PASSWORD" };
    var GsToken='YOUR GOOGLE APPS SCRIPT TOKEN HERE';
    
    var wifi;
    
    function getCalendar()
    {
      var options = {
        host: 'https://script.google.com',
        port: '443',
        path:'/macros/s/'+GsToken+'/exec',
        protocol: "https:",
        method:'GET',
        headers: {
          "Content-Type":"application/x-www-form-u­rlencoded"
        }
      };
    
      console.log("Connecting to Google");
      require("http").request(options, function(res)  {
        console.log("Connected to Google");
        var nRecv = 0;
        res.on('data', function(data) { nRecv += data.length; });
        res.on('close', function(data) {
          console.log("Google connection closed, "+nRecv+" bytes received");
          setTimeout(getCalendar, 10000); // once every 10 seconds
        });
      }).end();
    }
    
    function onConnected(err) {
      if (err) throw err;
      wifi.getIP(function(e,ip) {
        console.log(ip);
        getCalendar();
      });
    }
    
    var Inited=false;
    function Init()
    {
      if(!Inited)
      {
        Inited=true;
        wifi = require("Wifi");
        wifi.connect(WIFI_NAME, WIFI_OPTIONS, onConnected);
      }
    }
    function onInit() {
      setTimeout("Init();",1000);
    }
    
    Init();
    

    The console output is

     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v04 (c) 2019 G.Williams
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    http://espruino.com/Donate
    Flash map 512KB:256/256, manuf 0xef chip 0x4015
    >
    {
      "ip": "192.168.43.173",
      "netmask": "255.255.255.0",
      "gw": "192.168.43.1",
      "mac": "18:fe:34:f5:6a:a9"
     }
    Connecting to Google
    >
    

    Then nothing happens. I think I am pretty close to have a solution not based on a third party service, but, well, it doesn't work as is... I don't know if ESP8266 can do https requests directly or if I need to use some kind of HTTPSRedirect library, used on the Arduino world...
    If anyone has any hints to help me go a step further, that would be awesome :-)

  • in Projects
    Avatar for Jean-Philippe_Rey

    Dear all,

    I just realized that I would love to make an Espruino project aimed at printing on a display my daily agenda. I have not yet thought about how I would implement it, but my first question is related to how to get the calendar content from Google. Does anyone ever tried to implement an integration with the Google Calendar API?

    Thanks for your feedback.
    Have a nice day.

  • in JavaScript
    Avatar for Jean-Philippe_Rey

    Thanks for the details.
    As a first try you can use the setWatch function. When the given callback is called, the parameters lastTime and time are passed to it. by doing 1/(time-lastTime) you get the frequency value.
    The limitation could be the processing time of the callback, but you can go up to 1kHz easily as far as I remember. Then you can maybe adjust the RC constant of your 555 circuit in order to decrease the maximal output frequency.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Jean-Philippe_Rey

    OK, thanks for your feedback.
    I didn't realize that a BLE mesh relay had to be always on. I tried to look for the Bluetooth SIG roadmap of the mesh feature but it seems not to be published. I hope they will improve the mesh mechanisms in order to support routing packet in low power mode (bluetooth seems to have good capabilities in term of node synchronization , however..)
    I'll try to use advertising instead. Again, thanks for your feedback.

  • in JavaScript
    Avatar for Jean-Philippe_Rey

    Are you sure that the humidity sensor outputs some values in [Hz] ? This seems very unlikely. Unless you talk about the frequency of sampling? In that case, you won't find easily any humidity sensor able to output new sample at more than a few [Hz]. Humidity is something that does not vary quickly.
    Could you explain in details what you want to do? Could you also share the documentation of your humidity sensor?

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Jean-Philippe_Rey

    Hi!
    This topic seems rather old now, and Bluetooth stack has somehow evolved. BLE mesh is being used more and more. It seems that the mesh is offered by Nordic within the softdevices. Is it planned to support BLE mesh within Espruino (NRF based platforms) in a near future or still no interest in going in that direction?

  • in JavaScript
    Avatar for Jean-Philippe_Rey

    Correct, it is not a big problem. I didn't know JS was so permissive.
    Thanks for quick reply, @Gordon!

Actions