You are reading a single comment by @Andrea and its replies. Click here to read the full conversation.
  • Hi, with the custom firmware everything works perfectly!

    After flashing, following these directions: https://github.com/pvvx/ATC_MiThermometer

    @Vlad's code fetches values without problems:

    var temp = null;
        var humidity = null;
        var battery = null;
        function getSensorData() {
            NRF.findDevices(function(devices) {
                    if (devices[0] && devices[0].serviceData.fe95) {
                        var data = devices[0].serviceData.fe95;
                        // console.log(data);
                        var flag = data[11];
                        // console.log(flag);
                        
                        switch (flag) {
                            case 4: {
                                // temp
                                temp = (data[14] | data[15] << 8) / 10;
                                break;
                            }
                            case 6: {
                                // humidity
                                humidity = (data[14] | data[15] << 8) / 10;
                                break;
                            }
                            case 10: {
                                // battery
                                battery = devices[0].serviceData.fe95[14];
                                break;
                            }
                            case 13: {
                                // temp and humidity
                                temp = (data[14] | data[15] << 8) / 10;
                                humidity = (data[16] | data[17] << 8) / 10;
                                break;
                            }
                            default : {
                                print("Unknown flag: " + flag);
                            }
                        }
                    }
                    for (var i = 0; i < devices.length; i++) {
                        devices[i] = null;
                    }
                    devices = null;
                }, {
                    filters: [
                        {serviceData:{"fe95":{}}}
                    ],
                    timeout: 2000
                }
            );
        }
        setInterval(function () {
            print("Temp: " + temp + " humidity: " + humidity + " battery: " + battery);
            getSensorData();
        }, 5000);
    

    THANK YOU ALL!

About

Avatar for Andrea @Andrea started