new code for temperature/humidity with DHT11

Hi,
I looked at the code for DHT12 (I2C) that you recommend
but I'm using DHT11 and I had to modify it.
one of the disadvantages of DHT11 is that the SW is reading the data from the a pin and the sensor is very slow.
I converted the code from DHT12, but experience problems with reading the DHT11 sensor when combined with the rest of the ESPHAP code. I would presume it is because of interrupts that interfere with the reading of the sensor. Do you think there could be something  done about that?
the other issue is that on the I phone I get only  temperature accessory  but actually reports temperature and humidity (BTW it shows 0.0 even if I put in constants rather than variables-see the rem in my code)   but i'm defining 2 services, temperature and humidity
is my code doing it correct?
here is the entire code:
`
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
//#include <FS.h>
//#include <SPIFFS.h>
#define STATIC_IP_ADDR
///
#include "DHT.h"
#ifdef STATIC_IP_ADDR
IPAddress staticIP(192,168,0,91);
IPAddress gateway(192,168,0,1);
IPAddress subnet(255,255,255,0);
#endif
#include "coredecls.h"
#define DHTTYPE DHT11
#define DHTPIN  2
DHT dht(DHTPIN, DHTTYPE, 12); // 11 works fine for ESP8266
const char* ssid = "SHAW-62CD10";
const char* password = "251169025293";
float hum;
float temp;
unsigned long previousMillis = 0;        // will store last temp was read
const long interval = 4000;
extern "C"{
#include "homeintegration.h"
}
#include "homekitintegrationcpp.h"
String pair_file_name="/pair.dat";
//**********************
void init_hap_storage(){
Serial.print("init_hap_storage");
File fsDAT=SPIFFS.open(pair_file_name, "r");
if(!fsDAT){
Serial.println("Failed to read pair.dat");
return;
}
int size=hap_get_storage_size_ex();
char* buf=new char[size];
memset(buf,0xff,size);
int readed=fsDAT.readBytes(buf,size);
Serial.print("Readed bytes ->");
Serial.println(readed);
hap_init_storage_ex(buf,size);
fsDAT.close();
delete []buf;
}
//*****************
//****************
void storage_changed(char * szstorage,int bufsize){
SPIFFS.remove(pair_file_name);
File fsDAT=SPIFFS.open(pair_file_name, "w+");
if(!fsDAT){
Serial.println("Failed to open pair.dat");
return;
}
fsDAT.write((uint8_t*)szstorage, bufsize);
fsDAT.close();
}
//********************
homekit_service_t* hapservice={0};
homekit_service_t* temperature;
homekit_service_t* humidity;
//////////////////////////////////
void setup() {
disable_extra4k_at_link_time();
Serial.begin(115200);
delay(3000);
Format();
 if (!SPIFFS.begin()) {
  Serial.print("SPIFFS Mount failed");
 }

Serial.print("Attempting connection to: ");
Serial.println(ssid);

WiFi.mode(WIFI_STA);
WiFi.begin((char*)ssid, (char*)password);

#ifdef STATIC_IP_ADDR
WiFi.config(staticIP, gateway, subnet);
#endif
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
WiFi.begin(ssid, password);
}
Serial.println("");
Serial.println("WiFi connected!");
#ifdef STATIC_IP_ADDR
Serial.print("Static IP address: ");
#else
Serial.print("Dinamic IP address: ");
#endif
Serial.println(WiFi.localIP());

/// now will setup homekit device
//this is for custom storaage usage
// In given example we are using \pair.dat   file in our spiffs system
//see implementation below
Serial.print("Free heap: ");
Serial.println(system_get_free_heap_size());

init_hap_storage();

set_callback_storage_change(storage_changed);

/// We will use for this example only one accessory (possible to use a several on the same esp)
//Our accessory type is light bulb , apple interface will proper show that
hap_setbase_accessorytype(homekit_accessory_category_thermostat);
/// init base properties
hap_initbase_accessory_service("Environment Sensor","SeaMaster","258521521","DHT11_ESP8266","1.0");

//we will add only one light bulb service and keep pointer for nest using
temperature = hap_add_temperature_service("Temperature");
humidity =   hap_add_humidity_service("Humidity");

//and finally init HAP
hap_init_homekit_server();

}
////////////////////////////////
void loop() {
hap_homekit_loop();
delay(10);
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
// save the last time you read the sensor
previousMillis = currentMillis;
// Reading temperature for humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (it's a very slow sensor)
hum = dht.readHumidity();          // Read humidity (percent)
temp = dht.readTemperature(false);     // Read temperature as Fahrenheit

Serial.println(temp); // Check if any reads failed and exit early (to try again).
if (isnan(hum) || isnan(temp)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
}
homekit_characteristic_t * ch= homekit_service_characteristic_by_type(temperature,  HOMEKIT_CHARACTERISTIC_CURRENT_TEMPERATURE);
ch->value.float_value=temp;
homekit_characteristic_notify(ch,ch->value);
delay(10);
homekit_characteristic_t * ch2= homekit_service_characteristic_by_type(humidity, HOMEKIT_CHARACTERISTIC_CURRENT_RELATIVE_HUMIDITY);
ch2->value.float_value=hum;
homekit_characteristic_notify(ch2,ch2->value);
delay(10);
}
void Format(){
// Next lines have to be done ONLY ONCE!!!!!When SPIFFS is formatted ONCE you can comment these lines out!!
Serial.println("Please wait 30 secs for SPIFFS to be formatted");
SPIFFS.format();
Serial.println("Spiffs formatted");
}`

Hi , I can check but could you please describe exact of the problem

Pairing OK ?
Device is visible on Apple ?
Data is available on Apple ?

Give me a hint please
On Thu, Apr 2, 2020 at 2:42 PM seamaster101<EMAIL_ADDRESS>wrote:

Hi,
I looked at the code for DHT12 (I2C) that you recommend
but I'm using DHT11 and I had to modify it.
one of the disadvantages of DHT11 is that the SW ie reading from the
detain and the sensor is very slow.
I converted the code but experience problems with reading the sensor when
combined with the rest of the code. I would presume it is because of
interrupts that interfere with the reading of the sensor. Do you think
there could be something done about that?
the other issue is that I get only temperature but im defining 2 services,
temperature and humidity
is my code doing it correct?
here is the entire code:
`
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
//#include <FS.h>
//#include <SPIFFS.h>
#define STATIC_IP_ADDR
///
#include "DHT.h"
#ifdef STATIC_IP_ADDR
IPAddress staticIP(192,168,0,91);
IPAddress gateway(192,168,0,1);
IPAddress subnet(255,255,255,0);
#endif
#include "coredecls.h"
#define DHTTYPE DHT11
#define DHTPIN 2
DHT dht(DHTPIN, DHTTYPE, 12); // 11 works fine for ESP8266
const char* ssid = "SHAW-62CD10";
const char* password = "251169025293";
float hum;
float temp;
unsigned long previousMillis = 0; // will store last temp was read
const long interval = 4000;
extern "C"{
#include "homeintegration.h"
}
#include "homekitintegrationcpp.h"
String pair_file_name="/pair.dat";
//**********************
void init_hap_storage(){
Serial.print("init_hap_storage");
File fsDAT=SPIFFS.open(pair_file_name, "r");
if(!fsDAT){
Serial.println("Failed to read pair.dat");
return;
}
int size=hap_get_storage_size_ex();
char* buf=new char[size];
memset(buf,0xff,size);
int readed=fsDAT.readBytes(buf,size);
Serial.print("Readed bytes ->");
Serial.println(readed);
hap_init_storage_ex(buf,size);
fsDAT.close();
delete []buf;
}
//*****************
//****************
void storage_changed(char * szstorage,int bufsize){
SPIFFS.remove(pair_file_name);
File fsDAT=SPIFFS.open(pair_file_name, "w+");
if(!fsDAT){
Serial.println("Failed to open pair.dat");
return;
}
fsDAT.write((uint8_t*)szstorage, bufsize);
fsDAT.close();
}
//********************
homekit_service_t* hapservice={0};
homekit_service_t* temperature;
homekit_service_t* humidity;
//////////////////////////////////
void setup() {
disable_extra4k_at_link_time();
Serial.begin(115200);
delay(3000);
Format();
if (!SPIFFS.begin()) {
Serial.print("SPIFFS Mount failed");
}
Serial.print("Attempting connection to: ");
Serial.println(ssid);
WiFi.mode(WIFI_STA);
WiFi.begin((char*)ssid, (char*)password);
#ifdef STATIC_IP_ADDR
WiFi.config(staticIP, gateway, subnet);
#endif
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
WiFi.begin(ssid, password);
}
Serial.println("");
Serial.println("WiFi connected!");
#ifdef STATIC_IP_ADDR
Serial.print("Static IP address: ");
#else
Serial.print("Dinamic IP address: ");
#endif
Serial.println(WiFi.localIP());
/// now will setup homekit device
//this is for custom storaage usage
// In given example we are using \pair.dat   file in our spiffs system
//see implementation below
Serial.print("Free heap: ");
Serial.println(system_get_free_heap_size());
init_hap_storage();
set_callback_storage_change(storage_changed);
/// We will use for this example only one accessory (possible to use a several on the same esp)
//Our accessory type is light bulb , apple interface will proper show that
hap_setbase_accessorytype(homekit_accessory_category_thermostat);
/// init base properties
hap_initbase_accessory_service("Environment Sensor","SeaMaster","258521521","DHT11_ESP8266","1.0");
//we will add only one light bulb service and keep pointer for nest using
temperature = hap_add_temperature_service("Temperature");
humidity =   hap_add_humidity_service("Humidity");
//and finally init HAP
hap_init_homekit_server();
}
////////////////////////////////
void loop() {
hap_homekit_loop();
delay(10);
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
// save the last time you read the sensor
previousMillis = currentMillis;
// Reading temperature for humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (it's a very slow sensor)
hum = dht.readHumidity();          // Read humidity (percent)
temp = dht.readTemperature(false);     // Read temperature as Fahrenheit
Serial.println(temp); // Check if any reads failed and exit early (to try
again).
if (isnan(hum) || isnan(temp)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
}
homekit_characteristic_t * ch=
homekit_service_characteristic_by_type(temperature,
HOMEKIT_CHARACTERISTIC_CURRENT_TEMPERATURE);
ch->value.float_value=temp;
homekit_characteristic_notify(ch,ch->value);
delay(10);
homekit_characteristic_t * ch2=
homekit_service_characteristic_by_type(humidity,
HOMEKIT_CHARACTERISTIC_CURRENT_RELATIVE_HUMIDITY);
ch2->value.float_value=hum;
homekit_characteristic_notify(ch2,ch2->value);
delay(10);
}
void Format(){
// Next lines have to be done ONLY ONCE!!!!!When SPIFFS is formatted ONCE
you can comment these lines out!!
Serial.println("Please wait 30 secs for SPIFFS to be formatted");
SPIFFS.format();
Serial.println("Spiffs formatted");
}`
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/Yurik72/ESPHap/issues/2, or unsubscribe
https://github.com/notifications/unsubscribe-auth/AKDREXMBOMREWUL2ERTBWFLRKR22NANCNFSM4L2KDNZQ
.

Hi,

paring is OK most of the times
device is visible on iPhone
device shows only temperature on the main icon. Once I manage to do it so it was showing temporary and humidity as it should be, but then I lost it. Maybe I changed something in the code but I don’t know exactly what caused it.
when you open the device on the I phone it indicates that has temperature and humidity
the temperature is always 0. The humidity is stuck on “updating ...”

It is kind of hard to explain. I can send you some screenshots, but don’t know how to reach you with pictures
Cheers!

On Apr 2, 2020, at 23:59, Yurik72<EMAIL_ADDRESS>wrote:

Hi , I can check but could you please describe exact of the problem

Pairing OK ?
Device is visible on Apple ?
Data is available on Apple ?

Give me a hint please
On Thu, Apr 2, 2020 at 2:42 PM seamaster101<EMAIL_ADDRESS>wrote:

Hi,
I looked at the code for DHT12 (I2C) that you recommend
but I'm using DHT11 and I had to modify it.
one of the disadvantages of DHT11 is that the SW ie reading from the
detain and the sensor is very slow.
I converted the code but experience problems with reading the sensor when
combined with the rest of the code. I would presume it is because of
interrupts that interfere with the reading of the sensor. Do you think
there could be something done about that?
the other issue is that I get only temperature but im defining 2 services,
temperature and humidity
is my code doing it correct?
here is the entire code:
`
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
//#include <FS.h>
//#include <SPIFFS.h>
#define STATIC_IP_ADDR
///
#include "DHT.h"
#ifdef STATIC_IP_ADDR
IPAddress staticIP(192,168,0,91);
IPAddress gateway(192,168,0,1);
IPAddress subnet(255,255,255,0);
#endif
#include "coredecls.h"
#define DHTTYPE DHT11
#define DHTPIN 2
DHT dht(DHTPIN, DHTTYPE, 12); // 11 works fine for ESP8266
const char* ssid = "SHAW-62CD10";
const char* password = "251169025293";
float hum;
float temp;
unsigned long previousMillis = 0; // will store last temp was read
const long interval = 4000;
extern "C"{
#include "homeintegration.h"
}
#include "homekitintegrationcpp.h"
String pair_file_name="/pair.dat";
//**********************
void init_hap_storage(){
Serial.print("init_hap_storage");
File fsDAT=SPIFFS.open(pair_file_name, "r");
if(!fsDAT){
Serial.println("Failed to read pair.dat");
return;
}
int size=hap_get_storage_size_ex();
char* buf=new char[size];
memset(buf,0xff,size);
int readed=fsDAT.readBytes(buf,size);
Serial.print("Readed bytes ->");
Serial.println(readed);
hap_init_storage_ex(buf,size);
fsDAT.close();
delete []buf;
}
//*****************
//****************
void storage_changed(char * szstorage,int bufsize){
SPIFFS.remove(pair_file_name);
File fsDAT=SPIFFS.open(pair_file_name, "w+");
if(!fsDAT){
Serial.println("Failed to open pair.dat");
return;
}
fsDAT.write((uint8_t*)szstorage, bufsize);
fsDAT.close();
}
//********************
homekit_service_t* hapservice={0};
homekit_service_t* temperature;
homekit_service_t* humidity;
//////////////////////////////////
void setup() {
disable_extra4k_at_link_time();
Serial.begin(115200);
delay(3000);
Format();
if (!SPIFFS.begin()) {
Serial.print("SPIFFS Mount failed");
}
Serial.print("Attempting connection to: ");
Serial.println(ssid);
WiFi.mode(WIFI_STA);
WiFi.begin((char*)ssid, (char*)password);
#ifdef STATIC_IP_ADDR
WiFi.config(staticIP, gateway, subnet);
#endif
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
WiFi.begin(ssid, password);
}
Serial.println("");
Serial.println("WiFi connected!");
#ifdef STATIC_IP_ADDR
Serial.print("Static IP address: ");
#else
Serial.print("Dinamic IP address: ");
#endif
Serial.println(WiFi.localIP());
/// now will setup homekit device
//this is for custom storaage usage
// In given example we are using \pair.dat file in our spiffs system
//see implementation below
Serial.print("Free heap: ");
Serial.println(system_get_free_heap_size());
init_hap_storage();
set_callback_storage_change(storage_changed);
/// We will use for this example only one accessory (possible to use a several on the same esp)
//Our accessory type is light bulb , apple interface will proper show that
hap_setbase_accessorytype(homekit_accessory_category_thermostat);
/// init base properties
hap_initbase_accessory_service("Environment Sensor","SeaMaster","258521521","DHT11_ESP8266","1.0");
//we will add only one light bulb service and keep pointer for nest using
temperature = hap_add_temperature_service("Temperature");
humidity = hap_add_humidity_service("Humidity");
//and finally init HAP
hap_init_homekit_server();
}
////////////////////////////////
void loop() {
hap_homekit_loop();
delay(10);
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
// save the last time you read the sensor
previousMillis = currentMillis;
// Reading temperature for humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (it's a very slow sensor)
hum = dht.readHumidity(); // Read humidity (percent)
temp = dht.readTemperature(false); // Read temperature as Fahrenheit
Serial.println(temp); // Check if any reads failed and exit early (to try
again).
if (isnan(hum) || isnan(temp)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
}
homekit_characteristic_t * ch=
homekit_service_characteristic_by_type(temperature,
HOMEKIT_CHARACTERISTIC_CURRENT_TEMPERATURE);
ch->value.float_value=temp;
homekit_characteristic_notify(ch,ch->value);
delay(10);
homekit_characteristic_t * ch2=
homekit_service_characteristic_by_type(humidity,
HOMEKIT_CHARACTERISTIC_CURRENT_RELATIVE_HUMIDITY);
ch2->value.float_value=hum;
homekit_characteristic_notify(ch2,ch2->value);
delay(10);
}
void Format(){
// Next lines have to be done ONLY ONCE!!!!!When SPIFFS is formatted ONCE
you can comment these lines out!!
Serial.println("Please wait 30 secs for SPIFFS to be formatted");
SPIFFS.format();
Serial.println("Spiffs formatted");
}`
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/Yurik72/ESPHap/issues/2, or unsubscribe
https://github.com/notifications/unsubscribe-auth/AKDREXMBOMREWUL2ERTBWFLRKR22NANCNFSM4L2KDNZQ
.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Ok, seems I will be able to help,
Could you please check first if

homekit_service_t* temperature;

homekit_service_t* humidity;

Variables are not NULL, when you sending data to Apple, then I will give you a hint how to create two devices/ icons on Apple
Sent from my iPhone

On 3 Apr 2020, at 12:29, seamaster101<EMAIL_ADDRESS>wrote:

Hi,

paring is OK most of the times
device is visible on iPhone
device shows only temperature on the main icon. Once I manage to do it so it was showing temporary and humidity as it should be, but then I lost it. Maybe I changed something in the code but I don’t know exactly what caused it.
when you open the device on the I phone it indicates that has temperature and humidity
the temperature is always 0. The humidity is stuck on “updating ...”

It is kind of hard to explain. I can send you some screenshots, but don’t know how to reach you with pictures
Cheers!

On Apr 2, 2020, at 23:59, Yurik72<EMAIL_ADDRESS>wrote:

Hi , I can check but could you please describe exact of the problem

Pairing OK ?
Device is visible on Apple ?
Data is available on Apple ?

Give me a hint please
On Thu, Apr 2, 2020 at 2:42 PM seamaster101<EMAIL_ADDRESS>wrote:

Hi,
I looked at the code for DHT12 (I2C) that you recommend
but I'm using DHT11 and I had to modify it.
one of the disadvantages of DHT11 is that the SW ie reading from the
detain and the sensor is very slow.
I converted the code but experience problems with reading the sensor when
combined with the rest of the code. I would presume it is because of
interrupts that interfere with the reading of the sensor. Do you think
there could be something done about that?
the other issue is that I get only temperature but im defining 2 services,
temperature and humidity
is my code doing it correct?
here is the entire code:
`
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
//#include <FS.h>
//#include <SPIFFS.h>
#define STATIC_IP_ADDR
///
#include "DHT.h"
#ifdef STATIC_IP_ADDR
IPAddress staticIP(192,168,0,91);
IPAddress gateway(192,168,0,1);
IPAddress subnet(255,255,255,0);
#endif
#include "coredecls.h"
#define DHTTYPE DHT11
#define DHTPIN 2
DHT dht(DHTPIN, DHTTYPE, 12); // 11 works fine for ESP8266
const char* ssid = "SHAW-62CD10";
const char* password = "251169025293";
float hum;
float temp;
unsigned long previousMillis = 0; // will store last temp was read
const long interval = 4000;
extern "C"{
#include "homeintegration.h"
}
#include "homekitintegrationcpp.h"
String pair_file_name="/pair.dat";
//**********************
void init_hap_storage(){
Serial.print("init_hap_storage");
File fsDAT=SPIFFS.open(pair_file_name, "r");
if(!fsDAT){
Serial.println("Failed to read pair.dat");
return;
}
int size=hap_get_storage_size_ex();
char* buf=new char[size];
memset(buf,0xff,size);
int readed=fsDAT.readBytes(buf,size);
Serial.print("Readed bytes ->");
Serial.println(readed);
hap_init_storage_ex(buf,size);
fsDAT.close();
delete []buf;
}
//*****************
//****************
void storage_changed(char * szstorage,int bufsize){
SPIFFS.remove(pair_file_name);
File fsDAT=SPIFFS.open(pair_file_name, "w+");
if(!fsDAT){
Serial.println("Failed to open pair.dat");
return;
}
fsDAT.write((uint8_t*)szstorage, bufsize);
fsDAT.close();
}
//********************
homekit_service_t* hapservice={0};
homekit_service_t* temperature;
homekit_service_t* humidity;
//////////////////////////////////
void setup() {
disable_extra4k_at_link_time();
Serial.begin(115200);
delay(3000);
Format();
if (!SPIFFS.begin()) {
Serial.print("SPIFFS Mount failed");
}
Serial.print("Attempting connection to: ");
Serial.println(ssid);
WiFi.mode(WIFI_STA);
WiFi.begin((char*)ssid, (char*)password);
#ifdef STATIC_IP_ADDR
WiFi.config(staticIP, gateway, subnet);
#endif
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
WiFi.begin(ssid, password);
}
Serial.println("");
Serial.println("WiFi connected!");
#ifdef STATIC_IP_ADDR
Serial.print("Static IP address: ");
#else
Serial.print("Dinamic IP address: ");
#endif
Serial.println(WiFi.localIP());
/// now will setup homekit device
//this is for custom storaage usage
// In given example we are using \pair.dat file in our spiffs system
//see implementation below
Serial.print("Free heap: ");
Serial.println(system_get_free_heap_size());
init_hap_storage();
set_callback_storage_change(storage_changed);
/// We will use for this example only one accessory (possible to use a several on the same esp)
//Our accessory type is light bulb , apple interface will proper show that
hap_setbase_accessorytype(homekit_accessory_category_thermostat);
/// init base properties
hap_initbase_accessory_service("Environment Sensor","SeaMaster","258521521","DHT11_ESP8266","1.0");
//we will add only one light bulb service and keep pointer for nest using
temperature = hap_add_temperature_service("Temperature");
humidity = hap_add_humidity_service("Humidity");
//and finally init HAP
hap_init_homekit_server();
}
////////////////////////////////
void loop() {
hap_homekit_loop();
delay(10);
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
// save the last time you read the sensor
previousMillis = currentMillis;
// Reading temperature for humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (it's a very slow sensor)
hum = dht.readHumidity(); // Read humidity (percent)
temp = dht.readTemperature(false); // Read temperature as Fahrenheit
Serial.println(temp); // Check if any reads failed and exit early (to try
again).
if (isnan(hum) || isnan(temp)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
}
homekit_characteristic_t * ch=
homekit_service_characteristic_by_type(temperature,
HOMEKIT_CHARACTERISTIC_CURRENT_TEMPERATURE);
ch->value.float_value=temp;
homekit_characteristic_notify(ch,ch->value);
delay(10);
homekit_characteristic_t * ch2=
homekit_service_characteristic_by_type(humidity,
HOMEKIT_CHARACTERISTIC_CURRENT_RELATIVE_HUMIDITY);
ch2->value.float_value=hum;
homekit_characteristic_notify(ch2,ch2->value);
delay(10);
}
void Format(){
// Next lines have to be done ONLY ONCE!!!!!When SPIFFS is formatted ONCE
you can comment these lines out!!
Serial.println("Please wait 30 secs for SPIFFS to be formatted");
SPIFFS.format();
Serial.println("Spiffs formatted");
}`
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/Yurik72/ESPHap/issues/2, or unsubscribe
https://github.com/notifications/unsubscribe-auth/AKDREXMBOMREWUL2ERTBWFLRKR22NANCNFSM4L2KDNZQ
.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.

Step by step,
Zero values to Apple:
In your sketch at the begin please define
#define HOMEKIT_SHORT_APPLE_UUIDS
EspHap library for ESP8266 uses short UUIDs, but sketch still used long, therefore code
HOMEKIT_CHARACTERISTIC_CURRENT_TEMPERATURE);
ch->value.float_value=temp;
homekit_characteristic_notify(ch,ch->value);
is not works and characteristic not found

Second , how to create two icons
first device/icons is a temperature, code
hap_setbase_accessorytype(homekit_accessory_category_thermostat);
hap_initbase_accessory_service("Environment Sensor","SeaMaster","258521521","DHT11_ESP8266","1.0");
temperature = hap_add_temperature_service("Temperature");
Than you need add second device/icons and code
humidity=hap_add_hum_as_accessory(homekit_accessory_category_thermostat,"Humidity");
//This will add second device/icons only with humidity
The rest code is OK.
P.S. You should use the latest version of ESP hap

@Yurik72
Thank for responding.
First:
I think I was using the latest version of ESP hap. D0 you see an indication in my code that I’m not?
Second:
Code

hap_setbase_accessorytype(homekit_accessory_category_thermostat);
hap_initbase_accessory_service("Environment Sensor","SeaMaster","258521521","DHT11_ESP8266","1.0");
temperature = hap_add_temperature_service("Temperature");
humidity =   hap_add_humidity_service("Humidity");

// I just added the following line as per your email
humidity=hap_add_hum_as_accessory(homekit_accessory_category_thermostat,"Humidity");

And I get the following error:
EspHapENV8266:142:86: error: 'hap_add_hum_as_accessory' was not declared in this scope
humidity=hap_add_hum_as_accessory(homekit_accessory_category_thermostat,"Humidity");
I tried with or without the line
humidity =   hap_add_humidity_service("Humidity");
And still got the same error. Im not sure what I’m missing here
Third and maybe the most important one:
If I set the temp and humidity to numbers like that:
temp = 22.2;     // Read temperature as Fahrenheit
hum = 77.7;        // Read humidity (percent)
I can read on my phone the value
If I set it like that:
hum = dht.readHumidity();          // Read humidity (percent)
temp = dht.readTemperature(false);     // Read temperature as Fahrenheit
It reads it correct only for few seconds and then start to return nan or unreal values.
In a separate sketch, without the ESP hap, this works just fine.
As the DHT11 is a slow sensor it appears that the reading gets interrupted when using ESP hap in conjunction with it.
Is the a way to pause ESP hap interrupts or processes while reading the sensor?

On Apr 6, 2020, at 1:55 AM, Yurik72<EMAIL_ADDRESS>wrote:
Second , how to create two icons
first device/icons is a temperature, code
hap_setbase_accessorytype(homekit_accessory_category_thermostat);
hap_initbase_accessory_service("Environment Sensor","SeaMaster","258521521","DHT11_ESP8266","1.0");
temperature = hap_add_temperature_service("Temperature");
Than you need add second device/icons and code
humidity=hap_add_hum_as_accessory(homekit_accessory_category_thermostat,"Humidity");
//This will add second device/icons only with humidity
The rest code is OK.
P.S. You should use the latest version of ESP hap
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/Yurik72/ESPHap/issues/2#issuecomment-609663952, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4H7P3TYMXPARG3LV2QZHTRLGKGZANCNFSM4L2KDNZQ.

Please ignore "Third and maybe... "
this one was resolved by using library with interrupt for DHT11. Now reeds the temperature and humidity OK, but only have the setup screen for humidity, and does not show humidity Icon. this is back too the second issue.
please provide example if you could for one service with 2 accessories.
there is also another thing that I don't understand:
if I enable
format();
it logs ok on the network, but I need to reconnect to apple HomeKit on every restart as it looses the configuration data.
if I I disable the
//format();
my esp8266 will not connect to the network and it is serial is  outputing only "................."  every time I restart. I'm not sure how I suppose to use the format(); function

Two icons: I have provided example yesterday
There is a new function in the library
humidity=hap_add_hum_as_accessory(homekit_accessory_category_thermostat,"Humidity");
Therefore you need to get latest version to resolve compilation error
About format, in My original example there is no function format. If you formatting SPIFFS every start , you are loosing pairing data. In my instruction i mentioned about format only when pairing not sucess.

Better but still not properly displayed:
1st image above is I get Humidity, but just the setup screen for it.
2nd image I got the temperature properly but by itself - no humidity icon and symbol
3rd image is accessory from another sketch that used HomeBridge and it is displaying temperature and humidity on one accessory and that is what I was hoping to accomplish but without the need of Homebridge. it appears we are close, but not quite there yet...
4th image is from mu "Home" screen. note that the "Humidity" icon shows always "updating".
Serial Monitor has constant stream rushing the that says something like:
`

HomeKit: [Client<PHONE_NUMBER>] Got characteristic 1.10 change event
HomeKit: [Client<PHONE_NUMBER>] Got characteristic 1.10 change event
HomeKit: [Client<PHONE_NUMBER>] Got characteristic 2.10 change event
HomeKit: [Client<PHONE_NUMBER>] Got characteristic 2.10 change event
HomeKit: [Client<PHONE_NUMBER>] Got characteristic 1.10 change event
HomeKit: [Client<PHONE_NUMBER>] Got characteristic 1.10 change event
HomeKit: [Client<PHONE_NUMBER>] Got characteristic 2.10 change event
etc, etc. that continues for a while and then I get this repeating:!!! HomeKit: [Client<PHONE_NUMBER>] error_in_write_data is true, abort write data
!!! HomeKit: [Client<PHONE_NUMBER>] error_in_write_data is true, abort write data
!!! HomeKit: [Client<PHONE_NUMBER>] error_in_write_data is true, abort write data
HomeKit: [Client<PHONE_NUMBER>] Got characteristic 1.10 change event
HomeKit: [Client<PHONE_NUMBER>] Got characteristic 1.10 change event
HomeKit: [Client<PHONE_NUMBER>] Got characteristic 2.10 change event
HomeKit: [Client<PHONE_NUMBER>] Got characteristic 2.10 change event
`

On the picture below notice that Default Room Humidity always show "Updating..."
maybe that has something to do with this write data error?

the serial monitor stream was so fast that overloaded the application and I had to forcibly quit it and reload it.

About icon
It depends from the accessory type,
I have suggested - homekit_accessory_category_thermostat
humidity=hap_add_hum_as_accessory(homekit_accessory_category_thermostat,"Humidity");
Probably you need
humidity=hap_add_hum_as_accessory(homekit_accessory_category_humidifier ,"Humidity");
As well you can edit icon on Apple to define category
Full enumerable is
typedef enum {
homekit_accessory_category_other = 1,
homekit_accessory_category_bridge = 2,
homekit_accessory_category_fan = 3,
homekit_accessory_category_garage = 4,
homekit_accessory_category_lightbulb = 5,
homekit_accessory_category_door_lock = 6,
homekit_accessory_category_outlet = 7,
homekit_accessory_category_switch = 8,
homekit_accessory_category_thermostat = 9,
homekit_accessory_category_sensor = 10,
homekit_accessory_category_security_system = 11,
homekit_accessory_category_door = 12,
homekit_accessory_category_window = 13,
homekit_accessory_category_window_covering = 14,
homekit_accessory_category_programmable_switch = 15,
homekit_accessory_category_range_extender = 16,
homekit_accessory_category_ip_camera = 17,
homekit_accessory_category_video_door_bell = 18,
homekit_accessory_category_air_purifier = 19,
homekit_accessory_category_heater = 20,
homekit_accessory_category_air_conditioner = 21,
homekit_accessory_category_humidifier = 22,
homekit_accessory_category_dehumidifier = 23,
homekit_accessory_category_apple_tv = 24,
homekit_accessory_category_speaker = 26,
homekit_accessory_category_airport = 27,
homekit_accessory_category_sprinkler = 28,
homekit_accessory_category_faucet = 29,
homekit_accessory_category_shower_head = 30,
homekit_accessory_category_television = 31,
homekit_accessory_category_target_controller = 32,
} homekit_accessory_category_t;
"Updating.." means apple did  not receive characheristic, i need a full logs to help
In my case i have tested Apple within a few devices without problem. Not Temperthure + Humidity combination, but definetelly question is not about combination, something else If you will fall again, probably to help i need your full sketch ,

Thank you for following up!
here is my code:
`
//ESP8266 with DHT11
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
//#include <FS.h>
//#include <SPIFFS.h>
#define STATIC_IP_ADDR
///---DHT11-----///
#include "PietteTech_DHT.h"  // Uncommend if building using CLI
#define DHTTYPE  DHT11       // Sensor type DHT11/21/22/AM2301/AM2302
#define DHTPIN   2           // Digital pin for communications
#define PIN   0           // Digital pin for re-format
//declaration
void dht_wrapper(); // must be declared before the lib initialization
///---DHT11 stop-----///
#ifdef STATIC_IP_ADDR
IPAddress staticIP(192,168,0,91);
IPAddress gateway(192,168,0,1);
IPAddress subnet(255,255,255,0);
#endif
#define HOMEKIT_SHORT_APPLE_UUIDS
#include "coredecls.h"
const char* ssid = "XXXXXXXX";
const char* password = "XXXXXXXX";
float hum;
float temp;
const long userdelay = 3000;            //delay for user input when tarting to format the SPIFFS
unsigned long previousMillis = 0;
unsigned long prevMillis = 0;
const long interval = 15000;
unsigned long currentMillis = 0;
unsigned long currMillis = 0;
extern "C"{
#include "homeintegration.h"
}
#include "homekitintegrationcpp.h"
String pair_file_name="/pair.dat";
///---DHT11-----///
// Lib instantiate
PietteTech_DHT DHT(DHTPIN, DHTTYPE, dht_wrapper);
int n;      // counter
///---DHT11 stop-----///
//**********************
void init_hap_storage(){
Serial.print("init_hap_storage");
File fsDAT=SPIFFS.open(pair_file_name, "r");
if(!fsDAT){
Serial.println("Failed to read pair.dat");
return;
}
int size=hap_get_storage_size_ex();
char* buf=new char[size];
memset(buf,0xff,size);
int readed=fsDAT.readBytes(buf,size);
Serial.print("Readed bytes ->");
Serial.println(readed);
hap_init_storage_ex(buf,size);
fsDAT.close();
delete []buf;
}
//*****************
//****************
void storage_changed(char * szstorage,int bufsize){
SPIFFS.remove(pair_file_name);
File fsDAT=SPIFFS.open(pair_file_name, "w+");
if(!fsDAT){
Serial.println("Failed to open pair.dat");
return;
}
fsDAT.write((uint8_t*)szstorage, bufsize);
fsDAT.close();
}
//********************
//homekit_service_t* hapservice={0};
homekit_service_t* temperature;
homekit_service_t* humidity;
//********************
//////////////////////////////////
void setup() {
disable_extra4k_at_link_time();
Serial.begin(74880);
delay(100);
//Enble format only when pairing fails
prevMillis=millis();
currMillis = prevMillis + userdelay;
//ask for user input
Serial.println("Should I format the SPIFFS? ");  //it should wait for userdelay/1000 seconds for user input
while (currMillis >= prevMillis && (digitalRead(PIN) == HIGH) ){
prevMillis = millis();
delay(1000);
Serial.println(round((userdelay-prevMillis)/1000));
if (currMillis <= prevMillis) {
Serial.println("5 seconds are over");
delay (100);
break;
}
else{ if (digitalRead(PIN) == LOW){
Serial.println("Formating...");
Format();
delay (100);
break;
}
}
}
//
if (!SPIFFS.begin()) {
Serial.print("SPIFFS Mount failed");
} else  {
Serial.println("SPIFFS Mount OK");
}
Serial.print("Attempting connection to: ");
Serial.println(ssid);
delay(10);
WiFi.mode(WIFI_STA);
delay(10);

/// Working every time ESP8266 WIFI initialization

if (WiFi.waitForConnectResult() != WL_CONNECTED) {
Serial.println("Not connected");
WiFi.begin((char*)ssid, (char*)password);
} else {
Serial.println("Connected");
}
#ifdef STATIC_IP_ADDR
WiFi.config(staticIP, gateway, subnet);
#endif
Serial.println("");
Serial.println("WiFi connected!");
#ifdef STATIC_IP_ADDR
Serial.print("Static IP address: ");
#else
Serial.print("Dinamic IP address: ");
#endif
Serial.println(WiFi.localIP());
Serial.print("WiFi Status: ");
Serial.println(WiFi.status());
///---Setup homekit device---///
//this is for custom storage usage
// In given example we are using \pair.dat   file in our spiffs system
//see implementation below
Serial.print("Free heap: ");
Serial.println(system_get_free_heap_size());
init_hap_storage();
set_callback_storage_change(storage_changed);
///---Adding Accessory---///
/// We will use for this example only one accessory (possible to use a several on the same esp)
//Our accessory type is thermostat, ???apple interface will proper show that???
// hap_setbase_accessorytype(homekit_accessory_category_thermostat); //old definition replaced by the line below
hap_setbase_accessorytype(homekit_accessory_category_humidifier);
///--- init base properties---///
hap_initbase_accessory_service("Environment Sensor","SeaMaster","258521521","DHT11_ESP8266","1.0");
// we will add ??temprature service and humifity accessory?? and keep pointer for nest using
temperature = hap_add_temperature_service("Temperature");
//humidity = hap_add_humidity_service("Humidity"); //old definition replaced by the line below
humidity=hap_add_hum_as_accessory(homekit_accessory_category_humidifier ,"Humidity");
///---Setup homekit device stop---///
///---initialize HAP---///
hap_init_homekit_server();
///---initialize HAP stop---///
///---End of setup()---///
}
///---DHT11 interrupt callback---///
void ICACHE_RAM_ATTR dht_wrapper() {
DHT.isrCallback();
}
///---DHT11 interrupt callback stop---///
///////////////////////////////
void loop() {
///---Reading the DHT11 sensor---///
// Reading temperature for humidity takes about 250 milliseconds!
// this sensor should not be polled more often then 2 sec apart
unsigned long currentMillis = millis();
int result = DHT.acquireAndWait(0);

if (currentMillis - previousMillis >= interval) {
// save the last time you read the sensor
previousMillis = currentMillis;
temp = DHT.getCelsius();     // Read temperature as Celsius
hum = DHT.getHumidity();        // Read humidity (percent)
Serial.print("Temperature: ");
Serial.println(temp); // Check if any reads failed and exit early (to try again).
Serial.print("Humidity: ");
Serial.println(hum); // Check if any reads failed and exit early (to try again).
if (isnan(hum) || isnan(temp)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
}
hap_homekit_loop(); //what does this exactly do?????
delay(10);
homekit_characteristic_t * ch1= homekit_service_characteristic_by_type(temperature, HOMEKIT_CHARACTERISTIC_CURRENT_TEMPERATURE);
ch1->value.float_value=temp;
homekit_characteristic_notify(ch1,ch1->value);
delay(10);
homekit_characteristic_t * ch2= homekit_service_characteristic_by_type(humidity, HOMEKIT_CHARACTERISTIC_CURRENT_RELATIVE_HUMIDITY);
ch2->value.float_value=hum;
homekit_characteristic_notify(ch2,ch2->value);
delay(10);
///--- end of the main loop ---///
}
///--- Formating function ---///
void Format(){
// Next lines have to be done ONLY ONCE!!!!!When SPIFFS is formatted ONCE you can comment these lines out!!
Serial.println("Please wait 30 secs for SPIFFS to be formatted");
SPIFFS.format();
Serial.println("Spiffs formatted");
}
`

//ESP8266 with DHT11
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
//#include <FS.h>
//#include <SPIFFS.h>
#define STATIC_IP_ADDR
///---DHT11-----///
#include "PietteTech_DHT.h"  // Uncommend if building using CLI
#define DHTTYPE  DHT11       // Sensor type DHT11/21/22/AM2301/AM2302
#define DHTPIN   2           // Digital pin for communications
#define PIN   0           // Digital pin for re-format
//declaration
void dht_wrapper(); // must be declared before the lib initialization
///---DHT11 stop-----///
#ifdef STATIC_IP_ADDR
IPAddress staticIP(192,168,0,91);
IPAddress gateway(192,168,0,1);
IPAddress subnet(255,255,255,0);
#endif
#define HOMEKIT_SHORT_APPLE_UUIDS
#include "coredecls.h"
const char* ssid = "XXXXXXXX";
const char* password = "XXXXXXXX";
float hum;
float temp;
const long userdelay = 3000;            //delay for user input when tarting to format the SPIFFS
unsigned long previousMillis = 0;
unsigned long prevMillis = 0;
const long interval = 15000;
unsigned long currentMillis = 0;
unsigned long currMillis = 0;
extern "C"{
#include "homeintegration.h"
}
#include "homekitintegrationcpp.h"
String pair_file_name="/pair.dat";
///---DHT11-----///
// Lib instantiate
PietteTech_DHT DHT(DHTPIN, DHTTYPE, dht_wrapper);
int n;      // counter
///---DHT11 stop-----///
//**********************
void init_hap_storage(){
Serial.print("init_hap_storage");
File fsDAT=SPIFFS.open(pair_file_name, "r");
if(!fsDAT){
Serial.println("Failed to read pair.dat");
return;
}
int size=hap_get_storage_size_ex();
char* buf=new char[size];
memset(buf,0xff,size);
int readed=fsDAT.readBytes(buf,size);
Serial.print("Readed bytes ->");
Serial.println(readed);
hap_init_storage_ex(buf,size);
fsDAT.close();
delete []buf;
}
//*****************
//****************
void storage_changed(char * szstorage,int bufsize){
SPIFFS.remove(pair_file_name);
File fsDAT=SPIFFS.open(pair_file_name, "w+");
if(!fsDAT){
Serial.println("Failed to open pair.dat");
return;
}
fsDAT.write((uint8_t*)szstorage, bufsize);
fsDAT.close();
}
//********************
//homekit_service_t* hapservice={0};
homekit_service_t* temperature;
homekit_service_t* humidity;
//********************
//////////////////////////////////
void setup() {
disable_extra4k_at_link_time();
Serial.begin(74880);
delay(100);
//Enble format only when pairing fails
prevMillis=millis();
currMillis = prevMillis + userdelay;
//ask for user input
Serial.println("Should I format the SPIFFS? ");  //it should wait for userdelay/1000 seconds for user input
while (currMillis >= prevMillis && (digitalRead(PIN) == HIGH) ){
prevMillis = millis();
delay(1000);
Serial.println(round((userdelay-prevMillis)/1000));
if (currMillis <= prevMillis) {
Serial.println("5 seconds are over");
delay (100);
break;
}
else{ if (digitalRead(PIN) == LOW){
Serial.println("Formating...");
Format();
delay (100);
break;
}
}
}
//
if (!SPIFFS.begin()) {
Serial.print("SPIFFS Mount failed");
} else  {
Serial.println("SPIFFS Mount OK");
}
Serial.print("Attempting connection to: ");
Serial.println(ssid);
delay(10);
WiFi.mode(WIFI_STA);
delay(10);

/// Working every time ESP8266 WIFI initialization

if (WiFi.waitForConnectResult() != WL_CONNECTED) {
Serial.println("Not connected");
WiFi.begin((char*)ssid, (char*)password);
} else {
Serial.println("Connected");
}
#ifdef STATIC_IP_ADDR
WiFi.config(staticIP, gateway, subnet);
#endif
Serial.println("");
Serial.println("WiFi connected!");
#ifdef STATIC_IP_ADDR
Serial.print("Static IP address: ");
#else
Serial.print("Dinamic IP address: ");
#endif
Serial.println(WiFi.localIP());
Serial.print("WiFi Status: ");
Serial.println(WiFi.status());
///---Setup homekit device---///
//this is for custom storage usage
// In given example we are using \pair.dat   file in our spiffs system
//see implementation below
Serial.print("Free heap: ");
Serial.println(system_get_free_heap_size());
init_hap_storage();
set_callback_storage_change(storage_changed);
///---Adding Accessory---///
/// We will use for this example only one accessory (possible to use a several on the same esp)
//Our accessory type is thermostat, ???apple interface will proper show that???
// hap_setbase_accessorytype(homekit_accessory_category_thermostat); //old definition replaced by the line below
hap_setbase_accessorytype(homekit_accessory_category_humidifier);
///--- init base properties---///
hap_initbase_accessory_service("Environment Sensor","SeaMaster","258521521","DHT11_ESP8266","1.0");
// we will add ??temprature service and humifity accessory?? and keep pointer for nest using
temperature = hap_add_temperature_service("Temperature");
//humidity = hap_add_humidity_service("Humidity"); //old definition replaced by the line below
humidity=hap_add_hum_as_accessory(homekit_accessory_category_humidifier ,"Humidity");
///---Setup homekit device stop---///
///---initialize HAP---///
hap_init_homekit_server();
///---initialize HAP stop---///
///---End of setup()---///
}
///---DHT11 interrupt callback---///
void ICACHE_RAM_ATTR dht_wrapper() {
DHT.isrCallback();
}
///---DHT11 interrupt callback stop---///
///////////////////////////////
void loop() {
///---Reading the DHT11 sensor---///
// Reading temperature for humidity takes about 250 milliseconds!
// this sensor should not be polled more often then 2 sec apart
unsigned long currentMillis = millis();
int result = DHT.acquireAndWait(0);

if (currentMillis - previousMillis >= interval) {
// save the last time you read the sensor
previousMillis = currentMillis;
temp = DHT.getCelsius();     // Read temperature as Celsius
hum = DHT.getHumidity();        // Read humidity (percent)
Serial.print("Temperature: ");
Serial.println(temp); // Check if any reads failed and exit early (to try again).
Serial.print("Humidity: ");
Serial.println(hum); // Check if any reads failed and exit early (to try again).
if (isnan(hum) || isnan(temp)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
}
hap_homekit_loop(); //what does this exactly do?????
delay(10);
homekit_characteristic_t * ch1= homekit_service_characteristic_by_type(temperature, HOMEKIT_CHARACTERISTIC_CURRENT_TEMPERATURE);
ch1->value.float_value=temp;
homekit_characteristic_notify(ch1,ch1->value);
delay(10);
homekit_characteristic_t * ch2= homekit_service_characteristic_by_type(humidity, HOMEKIT_CHARACTERISTIC_CURRENT_RELATIVE_HUMIDITY);
ch2->value.float_value=hum;
homekit_characteristic_notify(ch2,ch2->value);
delay(10);
///--- end of the main loop ---///
}
///--- Formating function ---///
void Format(){
// Next lines have to be done ONLY ONCE!!!!!When SPIFFS is formatted ONCE you can comment these lines out!!
Serial.println("Please wait 30 secs for SPIFFS to be formatted");
SPIFFS.format();
Serial.println("Spiffs formatted");
}

Hi,
Any luck looking through my code to see why displaying humidity is not correct?
After playing around for a while, I could not make it show properly even if it is the only service/accessory in the sketch and even if I hardcoded the hum var to let's say 55% . It always shows "Updating..." even when it reads the correct  data from the sensor.  yet it shows the proper number in the setup screen. Could it be a problem with this specific CHARACTERISTIC somewhere in the library, or I'm dong it wrong all together?

#7  I think I´ve got the bug that makes humidity sensors showing the incorrect icon and "updating" status...

Yes, I found a mistake, #7 one of the problem,
Second problem:  primary property must be set to true for Humidity and Temperature sensors
And finally , if you made pairing and after that added new accessory in the code. Better to clear all pairing again..
I have tested my device with BME280 and it shows temp and humidity perfectly


Move error notification and task process creation logic into separate…

… methods for easier extendability.

LGTM

Need anything else from my end? If not, mind merging at your earliest convenience?

Was thinking if somebody else wanted to review. But I suppose this is not so controversial. Thanks for your PR!


Tet speedup

Codecov Report

Merging #11 into master will decrease coverage by -1.15%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master      #11      +/-   ##
==========================================
- Coverage   88.49%   87.35%   -1.15%
==========================================
  Files           7        7
  Lines         704      680      -24
==========================================
- Hits          623      594      -29
- Misses         81       86       +5

Impacted Files
Coverage Δ

voropy/mesh_tetra.py
89.47% <100%> (+0.7%)
:white_check_mark:

voropy/mesh_tri.py
90% <100%> (-2.16%)
:x:

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update eb52185...d116569. Read the comment docs.


StartupLoader

When I want to use convention based startup by environment I need to pass the assembly name to the UseStartup method.What is the subtle idea underneath this?Because it could be in another assembly? When I want to use the Generic version of this method, I specify exactly which startup class it should use.But when I was using the convention-based method UseStartup, I would prefer to search in the calling assembly.So I would not have to write a code like this;
public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args)
        .UseStartup(typeof(Program).Assembly.FullName)
        .Build();

Instead of;
public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args)
        .UseStartup()
        .Build();

It may be absurd, but I was really curious :)

Trying to make decisions based on the calling assembly identity has always been problematic for library APIs. It breaks down very quickly when your method gets wrapped by another method one in another assembly. Call stack is not a good indicator of intent.

@Tratcher thank you for answer.


Cannot open Viewer application with secure web map

When a Viewer application takes its map configuration from a non-public web map, the application hangs at the initialization screen unless the login has been cached by the browser.  The user should be prompted to log in.

@pMaske please test

@zwaap Passed QA. Please merge.

Verified.


Particle system roadmap

[ ] Time-dynamic billboard images, https://github.com/AnalyticalGraphicsInc/cesium/pull/5212#discussion_r112818097
[ ] Better memory management, https://github.com/AnalyticalGraphicsInc/cesium/pull/5212#discussion_r122434356

Initial implementation: #5212
Original notes: https://github.com/AnalyticalGraphicsInc/cesium/wiki/Particle-System-Details

Could be cool to check out BabylonJS's latest particle system for inspiration: https://twitter.com/deltakosh/status/888546806648274946

Reading: GPU-based particle simulation

For fillrate heavy particle systems, we may be able to render them at half resolution and then composite...and see if there are depth artifacts.


Failed to boot Windows MAAS images in bare-metal(keep trying to load grubx64.efi)

Hello,
First of all, thank you for the repo,
I have an issue to boot the windows images generated by this repo.
I was successfully able to generate windows 8.1 image, and uploaded the image in MaaS.
However, when I start to deploy the windows image, the MaaS shows the following errors below.

It simply shows that the bootload reads /efi/ubnutu/grubx64.efi instead of reading /efi/boot/bootx64.efi(which is the maas suppose to read to boot the windows image.)
I have generated with the windows image with "UEFI" option and I have used "experimental" branch for the windows image. I am not sure what I have missed and did wrong when I generated the image.  Btw, I am using MaaS 2.4.

Hello,
I think this is not an image issue you are seeing, but a MAAS one.
From the image generation, if you generate a Windows UEFI image you need to make sure the Windows host where you generate that image has UEFI boot enabled.
Thank you,
Adrian Vladu

You can take a look at: https://github.com/cloudbase/windows-openstack-imaging-tools/issues/197

Thanks, I was the one who opened #197. You are right, I had no problem to generate the windows and boot it from Maas before I upgraded from maas 2.3 to 2.4. I am not really sure what is wrong with it.


Revert to NIS 1.0.0.

Closes #46

I've posted this issue: https://github.com/NVIDIAGameWorks/NVIDIAImageScaling/issues/4
NIS 1.0.1 latest hotfix https://github.com/NVIDIAGameWorks/NVIDIAImageScaling/commit/aa37be760496e6d32a1f2d6b6faba40a00c76a9d is partially correcting the regression introduced with 1.0.1 but not fully yet.

After review, and testing again, I confirm NIS 1.0.1-fix released today is now working fine!

Not the right place to write a comment (maybe) but not other way to do so.
I have a question regarding you handtracking API. I have installed the latest UltraLeap driver,  SteamVR, WIN OpenXR (both) and your API. I do so it is available from the OpenXR Settings app. Though there is no log file generated like said in your readme file. I have the NIS as well, and that works fine. So, how to install the API correctly?
It is now installed as a folder in Ultraleap folder, but does not do something?

You're indeed a little bit lost.
Please file an issue here: https://github.com/mbucchia/XR_APILAYER_NOVENDOR_hand_to_controller/issues
Or join the conversation on this thread: https://forums.flightsimulator.com/t/hand-tracking-in-msfs-leap-motion-ultraleap-native-support-for-wmr-openxr/475308
Thanks!


Packed half precision support

I'm intending to utilize packed half precision computations on architectures that support it (e.g. Vega GPU).
It seems that sycl::half2 data type is missing. Of course it can be aliased to sycl::vec<sycl::detail::hp_float, 2> but then it seems that the multiply-add operations are not applied as packed but as scalar instead. I would expect sycl::fma(...) to map to __hfma2(...) function calls under HIP/CUDA. But that looks like it is not the case, is it?

Half support is not yet really implemented. sycl::detail::hp_float is more of a placeholder that does not map to a proper fp16 type. In order to implement half support we need to add some C++ library for half support as additional dependency for the host compilation path.

Thank you, this is clear.
This workaround is sufficient till support for half precision is added.


It is recommended to provide attributes that prohibit cross-column dragging

It is recommended to provide attributes that prohibit cross-column dragging

process it yourself in the business scenario


Integrated Google Analytics for issue #35

Issue #35 is now resolved from adding the Google Analytics script.
The Google Analytics account is under the name of "The Coderators" and I will give the team access to it.

Looks good to me
Sent from my Lge LG-M430 using FastHub


Provide debug logs for Intents

Is there an existing issue for this?

[X] I have searched the existing issues
[X] I have read the guide to filing a bug

Use case
Flutter has some default shortcuts in WidgetsApp. It's difficult to debug whether a key event is being handled by shortcuts in WidgetsApp, as Flutter doesn't provide any debug information when a key event generates an Intent.
With debugFocusChanges, Flutter logs when a Shortcuts handles a key event, but we don't know which intent was generated.
Proposal
Add another debug... flag to output debug information when an Intent was generated.

cc @gspencergoog


add a jinja filter quote

Describe the feature
In dbt Jinja, it would be great to have a custom filter for quote.
for example,
{% set jinja_var = "a hard-coded label" %}
SELECT {{ jinja_var | quote }}  as label

would render to
SELECT "a hard-coded label" AS label

It's similar to the jinja quote filer in Ansible
Describe alternatives you've considered
currently I use a custom macro,
{% macro s_quote (str, quote="'") %}
  {% set quoted = quote ~ str ~ quote %}
  {% do return(quoted) %}
{% endmacro %}

However, It doesn't support nice chaining as a filter does.
Additional context
Who will this benefit?
I think anyone who uses jinja to render hardcode string in SQL statements
Are you interested in contributing this feature?
yes, I am interested

Hey @hui-zheng! I don't think we do much with custom Jinja filters today—in fact, I think we've gotten away without implementing any. I appreciate that the syntax of chaining together filters feels nicer:
SELECT {{ jinja_var | capitalize | quote | length }}  as label

But this is still very much possible with custom macros:
SELECT {{ s_quote(jinja_var | capitalize) | length  }}  as label

In particular, when it comes to something as sensitive as quoting, I find myself agreeing with Dylan's recommendation in the Slack thread, and adding the quotes within the SQL layer:

Is there a reason you want it to be in the Jinja itself? i.e. would the following work?
SELECT "{{ jinja_var }}"  as label

While quoting a single string is simple enough without the jinja filter, mapping over a list requires the filter.
{% set my_strings = ['a', 'b', 'c'] %}
{{ my_strings | map('quote') |  join(',') }}

would render as
"a","b","c"

@kd7vrc: Just do "{{ my_strings |  join('","') }}".


[BUG] type of object is not shown correctly

I have coded the statement an put them in the template, exported it as csv. when uploading to the tool, the statement is shown incorrectly: as activation condition it states 'inanimate' and the object is divided.
The excel ais attached and the problem is shown in the picture
Institutional_statement_template-previous-Hidde csv.csv

Thanks for reporting! It seems like we are treating every , as a field separator, even if they are in a quoted string.
A work-around for now would be to not have any comma's in your csv files.
Related to #64


Demonstrate loading from db via pandas

Hey there,
There's not much to this tutorial, I just demo making a custom creator via pandas.
I imagine the same thing should work via dask using dd.read_sql or duckdb via postgres/sqlite scanner extensions.
You mention on the slack using the database engine to export to files, or even to DataFrame via something like https://docs.snowflake.com/en/user-guide/python-connector.html - do you think it's worth demoing or mentioning?

Yeah we had this question in Slack recently so we do need an example in the docs. Will merge it in and attach to index eventually!


Added small style tweaks to the sorting field

Added small style tweaks to the sorting field
Before

After

💯


Add a way to tag all tests with the CLI

At the moment if one want's to consolidate 2 different levels of tests inside a repository and have them tagged as different test levels (f.ex unit tests and integration tests) one has to first run oxygen for both the files, then run rebot for both files to tag them differently and then use rebot to consolidate the files

Possibly enhance the cli() method in BaseHandler so tags can be added per handler


Support datagen on any arbirtrary github repo

This is great, is there any plans to support debugging / dataset creation from any repository?
I imagine coding models for each repository would be beneficial however the "code interpretor" or the engine that runs the code must support more than just python. And from my perspective may be difficult and only support languages that implement jupyter notebooks? Is that a limitation you forsee for being able to gen a compiler/compute backed dataset for any arbitrary gh repo?
For example
https://github.com/vectordotdev/vector

Code models itself primarily focus on fundamental coding ability. To accomplish more complex coding tasks, we need to equip this brain (model) with limbs such as independent terminals, browsers, storage space, etc. Then, we can connect them with prompts to form an Agent or a Multi-Agent system.
We are currently working on a related project. Thank you for your attention.


Add support for "pattern properties" in schema display

JSON Schema (and therefore OpenAPI 3.1) includes support for "pattern properties", which match properties based on a regex. This patch adds these to the schema view in a similar style to "additional properties", e.g. pattern '^abc-\d+$' shows as '<pattern: ^abc-\d+$>'
https://json-schema.org/understanding-json-schema/reference/object.html#pattern-properties

I have read the CLA Document and I hereby sign the CLA

0.10.446


Updated PnP Version to 3.14.1910.1

Pull Request (PR) description
Updated PnP version to 3.14.1910.1
This Pull Request (PR) fixes the following issues
N/A

This change is

Codecov Report

Merging #220 into Dev will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##              Dev     #220   +/-   ##
=======================================
  Coverage   88.96%   88.96%
=======================================
  Files          53       53
  Lines        4756     4756
  Branches        8        8
=======================================
  Hits         4231     4231
  Misses        517      517
  Partials        8        8

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a3f4f8b...61b2be5. Read the comment docs.


for ... of loop break in IE11 with polyfills

Hi, I'm using the es6 version because I needs the Map and Set capabilities on the deep equal.
I'm locally transpiling my code to es6 with Map and Set polyfilled via corejs, but the problem is that if I use the /es6 version I automatically use the for...of loops that can't be used in IE11.
Is there any chance to avoid the for of loops?

@markov00 you need to build and transpire code for the target platform.


:bug: stop assining fetch to global constant fetch

I was trying to use Deta in my SvelteKit app and I've been getting this error:
Cannot assign to read only property 'fetch' of object '#<Object>'
TypeError: Cannot assign to read only property 'fetch' of object '#<Object>'
    at Object.<anonymous> (/Users/nebula/Git/asanaetc/node_modules/deta/dist/index.js:752:18)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:14)
    at ModuleWrap.<anonymous> (internal/modules/esm/translators.js:199:29)
    at ModuleJob.run (internal/modules/esm/module_job.js:169:25)
    at async Loader.import (internal/modules/esm/loader.js:177:24)
    at async prerender (file:///Users/nebula/Git/asanaetc/node_modules/@sveltejs/kit/dist/chunks/index6.js:113:14)
    at async Object.prerender (file:///Users/nebula/Git/asanaetc/node_modules/@sveltejs/kit/dist/chunks/index6.js:339:5)

I've added if statement to check if globalThis has fetch before trying to assign polyfill fetch in it.

Hi @jonasNobile thanks for reporting this and for the PR. We will be looking into it shortly.
But you are not supposed to use the Deta SDK directly on the front-end, this is a huge security risk and anyone can steal, alter or delete all your project's data. Please use a API to work with Base/Drive which could be easily hosted on a Deta Micro.

Hi @abdelhai, I'm not using it on the front-end. SvelteKit has back-end only endpoints, where I'm using Deta SDK. Ao, project key is never exposed to browser.
Problem probably that SveltKit is adding own fetch polyfill.

Hi @rabingaire, will you have a time for review and merge soon or should I create own modified package to be able to use it with Sveltekit?

Thank you for the PR @jonasNobile 🙏


add BPA model that updates wake spread based on TI

This has been added, but it still needs more complete testing based on Niayifar and Porte-Agel 2016 figure 7.


click on button does nothing

hi,
since recently, the text and button display still well, but clicking on button does nothing
Using js_cookie_rails 2.1.3
Using cookies_eu 1.5.0
thanks

Can you please tell me on which browser are you testing it?

Hi, just noticed the same with IE 10/11 on Windows. Works fine with Edge, Firefox, Safari and Chrome.
Thanks
Vito

Ahh, IE<edge doesn't support remove() on nodes, it's fixed now and a new release is out :)

hi,
thanks for answer
i'm using ubuntu. Ive tried on chrome, chromium and firefox, and none are working

Hey Netiko, could you please try the new release and if the issue still exists just reopen the task

still same problem

Hi, I think it's working now on IE - thanks ! - but the banner doesn't show up in Safari? I am trying with OSX in a virtual machine and have cleared the cookies etc but it seems like it doesn't show up anymore.

In the end I implemented it from scratch as it was very simple. Thanks anyway

for me what is weird is that when I try on dev mode on my computer, it is working, but in prod, it is not. Can it be because of assets pipeline ? (here my website http://veux-veux-pas.fr/)

Hej guys, this should be fixed now, added support for async and defer #39

Hey! I am experiencing the same issue at the moment. Click on 'OK' button works as expected locally but cannot be clicked on production.


Fedora 28 container does not get an IP address

Distribution: Ubuntu / Fedora
Distribution version: 18.04 / 28

Issue Description
Fresh install of 18.04 removed LXD package and installed LXD via snap.
Creating a Fedora 28 container does not get an IP address.
Creating any other container gets an IP address - no issue.
Fresh install of Fedora 28 and installed LXD via snap.
Same issue. Fedora 28 container does not get an IP address, however all other containers work fine and get an IP address.

I am using LXD 3.5 (snap).
$ lxc launch images:fedora/28 fedora
Creating fedora
Starting fedora

Then,
$ lxc list fedora
+--------+---------+---------------------+------+
|  NAME  |  STATE  |        IPV4         | IPV6 |
+--------+---------+---------------------+------+
| fedora | RUNNING | <IP_ADDRESS> (eth0) |      |
+--------+---------+---------------------+------+

So, in my case it managed to get an IP address.

Since it worked for me, it is likely some configuration issue on your end.
Could you please post this to the community forum at https://discuss.linuxcontainers.org/
Show also the relevant output of the command lxc profile show default (default profile).
The fedora/28/amd64 is one of the aliases of fedora/28. You can see them with lxc image info images:fedora/28.

I just did a fresh install of 18.04. Removed lxd and lxd-client.
Installed LXD via snap. Did a lxd init, all defaults, no changes.
lxc launch images:fedora/28 fedora
Still no IP
+----------+---------+----------------------+------+------------+-----------+ |   NAME   |  STATE  |         IPV4         | IPV6 |    TYPE    | SNAPSHOTS | +----------+---------+----------------------+------+------------+-----------+ | fedora   | RUNNING |                      |      | PERSISTENT |           | +----------+---------+----------------------+------+------------+-----------+ | fedora27 | RUNNING | <IP_ADDRESS> (eth0) |      | PERSISTENT |           | +----------+---------+----------------------+------+------------+-----------+

Thanks! @stgraber


Battery Health is showing health of '155%'

Any idea what could cause this? I wish this were true, but I don't think it is 😀. Is this a bug due to use of miles vs kilometers? Dividing by 1.6 yields a more likely 97%.

Hahahaha, I'm glad I gave you that joy even for a few minutes. My bad!. I think you are the first of the users who uses my dashboards  from the states. I've also noticed that the ranges at the right top, are showing incorrect length unit. I fixed all of them. May I kindly ask you to test it using the developer branch? If you tell me, it's OK then I will merge to the main branch.
In the mean time, I'll double check the other dashboards just in case :-)

For sure. I'll test today and confirm all looks good. Yes, apologies for our usage of 'Freedom units' 😂

Here's what the dev branch looks like. The health bar looks good, as does degradation 👍🏻. The "Battery Capacity" section still seems off, I think? The battery in the car is a 79.5 kWh, I believe, but it's showing that it's over 100 kWh.

It's so estrange. Could you refresh the dashboard?
Or if you are able to run this query from the database, to see what you get.
This is the query how you get the estimated new brand battery capacity, based in the max charge_energy_added in the whole time life of your car.
SELECT MAX((100.0 * charge_energy_added) / (end_battery_level - start_battery_level)) as Battery_Capacity
    FROM charging_processes
    WHERE charge_energy_added > 5  AND car_id = $car_id

Replace $car_id with 1 if you have only one car on your database.

Just out of curiosity, have you imported data from another system into Teslamate? or have you touched some record from the database? or maybe you have logged data while charging and did not conclude properly.
As you can see that's the max value you get from the charging_processes Table, so I guess you have a wrong data there. You may browse that table and see with one is it.

Here are some rows that likely lead to the calculation from said table. Perhaps your query could exclude those? I never touched the DB, except one time, where I migrated it from one PSQL server to another, but I think it's unlikely it created these issues as it was a lift and shift.

The query already is excluding those, try:
SELECT *  FROM charging_processes  WHERE charge_energy_added > 5  ORDER BY charge_energy_added  DESC

Looks like this record is the culprit. Formula yields 106.

Oh, I see. You have two options: manually change the record properly with some other value similar in other record from the same start/end battery level or consider to delete it (with a previous backup obviously) ;-)

Set the value to the average value for that calculation :) Problem solved. Thanks!

Where do I run the command from?

You could use any  postgresql database client of your choice or do it with command line in the postgresql container, here you have some samples https://docs.teslamate.org/docs/maintenance/backup_restore/
You could use Grafana as well although it is slower to browse.
In your screen shoot you have to replace the variable $car_id by 1 (if you only have one car logged in your database)

Ok... so what commands do you need to launch to fix?

In your case, as @dimatx did (as you can see above), you have to run:
SELECT *  FROM charging_processes  WHERE charge_energy_added > 5  ORDER BY charge_energy_added  DESC
Browse the records and see if you find an incoherent value on the charge_energy_added column.

and this:

How can I fix this mistake? I put everything that was found in it

Based on those values, the expected capacity of the battery is 106. Which isn't possible given that is much higher than the theoretical battery capacity. Check it with the formula from above. Run it on every line, and you'll likely see that at least one is out of bounds and is an outlier value due to some data issue with the charging session.

SELECT id,((100.0 * charge_energy_added) / (end_battery_level - start_battery_level)) AS puppamilafava
FROM charging_processes
where charge_energy_added > 5

Cheers!!! 👏👏👏

This happened just today .. because of the recharge with the ice symbol then he unlocked me kwh that didn't exist before!
You have to be careful

I see. This is a estrange behavior specially on cold weather or a miss calibrated BMS.

can you fix to use USABLE SOC ???? from last drive to charge? or pull request to adrian in teslamate for value in charge mode?... You are much more experienced than me @jheredianet I think you understood the problem.... you can use my photos without problems

Sure, give me some time to analyze it better 👌

https://github.com/adriankumpf/teslamate/issues/3081

@jheredianet original with buffer is mismatch.... sr+ is 53 max with buffer

I recommend changing the battery health calculation by taking refills from at least 15-20 kwh up @jheredianet , this would solve all the calculation problems... 5kwh at the moment is a problem

Already explained here https://github.com/jheredianet/Teslamate-CustomGrafanaDashboards/pull/18#issuecomment-1398023080


resources: AI to Android loses the transparency and add masks

Steps:

Generate an AI file at recommended size
Type ionic resources
Inspect the Android icons

Actual:

The generated .png's are not transparent
A mask was applied to the icons

Expected:
The icons look as they original.
PS: Using a PNG instead of an AI file produces the expected result.

Would you be able to provide screen shots? What's the background color you're receiving? Do you have an AI I could take a look at? thanks

Sure, here goes: https://drive.google.com/a/moodle.com/folderview?id=0Bww43zw3J7yjfi1TSC10N2pfWHZFZ1pfcS11YjljcnEwV2JITUtqWDgxeWVlaG5QUTg0OGM&usp=sharing

I've also seen this, same idea. (.ai worked fine on IOS) fails to a white background on android

Similar issue, even with PNG: only the generated drawable-xxxhdpi-icon is transparent...

Same here, although in my case, the iOS icons lose their transparency also. The other issue I am seeing is that the icons are pixilated. It looks like the resizing is taking place after rasterizing, rather than before.

I can confirm that this affects PNGs as well. I have added 2 images to confirm it.
NOTE: You should download the imags and not compare them online.

Thanks for opening the issue. It seems that issue has been resolved. I believe that AI are no longer a supported format for ionic resources. I was also able to test with a transparent png file and received them resized correctly with transparency intact.
I am going to close this issue but please feel free to reopen another issue if this occurs again.


UX/iOS: Hidden Agenda items getting forced out of layout, are made unreadable

known issue

@mattwbenson duplicate of #95 please add anything to that issue


Docker oom_score_adj is 0, should probably be lower (more important)

Docker oom_score_adj is 0, but it being killed is probably at least as disruptive as kube-proxy crashing.
(This turned out not to be the cause of my problem, but I think we probably want to do this)

@justinsb which version are you running? We did oom protect docker. Here is what I have on my node:
# pidof docker
14943

# cat /proc/14943/oom_score_adj
-900

Today, we oom protect monit(-901), docker (-900), kubelet (-900), kube-proxy (-899), and all podinfra containers' process
Is that enough?

I double checked my node, and restart docker daemon a couple of times, the oom_score_adj is set to be -900. I am closing it. Justin, feel free to open it if I missed anything here. Thanks!

Sorry for false alarm; this was with a 0.17.1 build.  Confirmed that on newer builds docker does have oom_score_adj=-900 (and looking at the code, kubelet even reapplies it after a docker crash - nice!)


[python] Adding learning_rates to args of sklearn API

The training API in the python package has a very handy feature of adjusting learning rate with iterations. However, this is not on the list of args of LGBMModel.fit(). Is there any particular reason not to do so? Otherwise, this feature would be very welcome.
From the sklearn.py  code structure it seems to be as easy as adding an arg to the fit() method and passing it over to the train() call.
Thanks in advance,
Misha

I am not very familiar with the sklearn interface. However, I think learning_rates isn't the standard features of sklearn. I don't know adding this is right or not, since it may break the compatibility with sklearn.
@StrikerRUS any ideas about this ?

@guolinke you are right, learning_rates is not a standard feature of the sklearn interface. However, it seems that there are many non-standard args of the LGBMModel.fit() method. Since I'm a new user I might have overlooked a basic conceptual reason from the LightGBM philosophy.

@guolinke I have the same thoughts as you. Sklearn interface itself is very conservative one. On the one hand, I don't think that overloading sklearn interface by all possible features is good idea, because it will confuse new users, who expect only standard (for sklearn estimatior) fit(), .predict() behavior with minimum params. On the other hand, LightGBM's sklearn wrapper has already additional functionality, so maybe it's OK to add another one.

Any decision on this issue?
I personally find the learning_rates very useful. But as a user I also strongly prefer to use the sklearn API, as it allows to make use of many nice sklearn functionalities. Thus, it would be wonderful to have such advanced (and useful) feature available in this interface. This arg can have the default disabled value and a beginner user doesn't have to be exposed to it

@mlisovyi Can't you do this by passing an argument as a reset_parameter callback in the sklearn api?

@stevenknguyen  This sounds interesting. Since I'm a new user, I have not mastered LightGBM callbacks yet. Do you have an example of what you have in mind?

@mlisovyi refer to https://lightgbm.readthedocs.io/en/latest/Python-API.html#lightgbm.reset_parameter
you can use callbacks= [callback.reset_parameter(learning_rate=learning_rates)]

@mlisovyi
something like this should work
lgb.fit(callbacks = [lgb.reset_parameter(learning_rate=lambda iter: base_learning rate  * np.pow(.99, iter))])

Thanks a lot! This looks easy and elegant. Let me try it out.
Just to be sure: base_learning_rate set to the learning_rate input arg value, isn't it?

@mlisovyi
It's just a placeholder you need to replace base_learning_rate with whatever learning rate is best for your problem.

Just to make it clear: under the hood learning_rates param works exactly via reset_parameter callback.
https://github.com/Microsoft/LightGBM/blob/04d37f9b38cb851c5201081c2b8289eb0ecbca02/python-package/lightgbm/engine.py#L167-L168
So I think we shouldn't duplicate the same functionality and issue may be closed.

Thanks for help and advices! I think it would be useful to add a remark.instruction about learning rate shrinkage implementation in the sklearn interface

@mlisovyi You are welcome!
Yeah, I'll try to do it. If you know the appropriate place where to insert a note, please let me know or create a PR.


Merge pull request #1 from pentaho/master

merge lastest rp

:white_check_mark: Build finished in 36m 5s
Build command:
mvn clean verify -B -e -Daudit -amd -pl core,engine

:ok_hand: All tests passed!
Tests run: 4767, Failures: 0, Skipped: 7    Test Results

:information_source:  This is an automatic message

:x: Build failed in 6s
Build command:
mvn clean verify -B -e -Daudit -amd

:exclamation: No tests found!
Errors:
Filtered log (click to expand)

Pull request build was aborted: Source fork/repository no longer exists! Please consider closing it.

:information_source:  This is an automatic message


Updating GCDAsyncSocket with new version

This change is

PR is added to the queue for testing as 3. task. (c6641e3)

Hi @dersim-davaod, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!
The agreement was validated by Microsoft and real humans are currently evaluating your PR.
TTYL, MSBOT;

Test 99559613 (c6641e3) build started.

Test (Fail) 99559613 build is completed (c6641e3)
See https://github.com/ThaliTester/TestResults/tree/99559613c6641e3_Updating_GCDAsyncSocket_with_new_version_dersim-davaod/ for the logs

PR is added to the queue for testing as 1. task. (d63b0ac)

Test (Fail) 99559613 build is completed (d63b0ac)
See https://github.com/ThaliTester/TestResults/tree/99559613d63b0ac_Updating_GCDAsyncSocket_with_new_version_dersim-davaod/ for the logs


Chef encountered an error attempting to load the node data for "fauxhai.local"   and Failed to authenticate to the chef server (http 401).

Any chance you have something like Chef::Node.load(...) in your cookbook code?

Here is the complete log. I masked the organization url for safety purposes. And by the way some of our cookbooks work and some fail. I am building a new server clone of another jenkins machine. Our previous all cookbooks converge and work but not on this one.
================================================================================
Chef encountered an error attempting to load the node data for "fauxhai.local"
Authentication Error:
Failed to authenticate to the chef server (http 401).
Server Response:
Relevant Config Settings:
chef_server_url   "https://xxxxxxxxxx"
node_name         "fauxhai.local"
client_key        ""
If these settings are correct, your client_key may be invalid, or
you may have a chef user with the same client name as this node.
Platform:
x86_64-linux
example at ./spec/recipes/users_spec.rb:18 (FAILED - 1)
================================================================================
Chef encountered an error attempting to load the node data for "fauxhai.local"
Authentication Error:
Failed to authenticate to the chef server (http 401).

@tas50 too vague to be actionable, can close this

I too am having this issue and this seems related to another ticket https://github.com/chef-cookbooks/chef-client/issues/464


server/express/test

So it's past time to write some tests for the express server, but i'm having trouble deciding on what testing framework to use.  I've been looking at a variety of things, including mocha, node-tap, vows, and jasmine, but I really don't have enough experience with testing to make a decision.  Does anyone have any thoughts, either on specific test libraries for node, or considerations when choosing one?

When I asked around about unit test frameworks for client-side javascript the name I got was Jasmine. I noticed Mocha mentioned on issue #100. I assume that would be for unti tests too.
Sinatra tests were developed in RSpec because that is the normal thing for Ruby and in many ways the progenitor of most modern frameworks. Selenium under RSpec is also well understood for integration tests. I hope we can keep that going.

The Selenium/RSpec stuff has been a bit of a speed bump in development for me, but I think it's important that the integration tests are the same on both servers, and it's been very nice having those already setup for me to try and work towards, so I've got no desire to change there.
What I really need is a good unit test setup so that I get better test coverage, and so I've got more bugs taken care of before I run the integration tests.  As far as I can tell there isn't really a consensus yet in node as far as testing goes like there is in ruby around RSpec.  I'll probably just pick one and give it a shot soon, and try not to be married to the idea so if it doesn't fit right I can throw it out and try a new one.

server/express now has testing with mocha, which seems to be going well.  It also passes 17/18 integration tests.  There is still a lot that is untested, but I think we can call this issue close :)


Check for previous/existing GitHub issues/module proposals

[X] I have checked for previous/existing GitHub issues/module proposals.

Check this module doesn't already exist in the module indexes

[X] I have checked for that this module doesn't already exist in the module indexes; or I'm proposing the module to be migrated from CARML/TFVM.

Bicep or Terraform?
Terraform
Module Classification?
Resource Module
Module Name
avm-res-insight-metricalert
Module Details
Metric Alerts Resource module
Do you want to be the owner of this module?
No
Module Owner's GitHub Username (handle)
No response
(Optional) Secondary Module Owner's GitHub Username (handle)
No response

Hello, I would like to take the ownership of this module.

@prjelesi I wish to become the owner of this module.

@arjenhuitema lets sync offline.

@arjenhuitema
Thanks for requesting/proposing to be an AVM module owner!
We just want to confirm you agree to the below pages that define what module ownership means:

Team Definitions & RACI
Shared Specification (Bicep & Terraform)
Module Support

Any questions or clarifications needed, let us know!
If you agree, please just reply to this issue with the exact sentence below (as this helps with our automation 👍):
"I CONFIRM I WISH TO OWN THIS AVM MODULE AND UNDERSTAND THE REQUIREMENTS AND DEFINITION OF A MODULE OWNER"
Thanks,
The AVM Core Team

I CONFIRM I WISH TO OWN THIS AVM MODULE AND UNDERSTAND THE REQUIREMENTS AND DEFINITION OF A MODULE OWNER

@arjenhuitema
Thanks for confirming that you wish to own this AVM module and understand the related requirements and responsibilities!
Before starting development, please ensure ALL the following requirements are met.
Please use the following values explicitly as provided in the module index page:

For your module:

ModuleName - for naming your module
TelemetryIdPrefix - for your module's telemetry

For your module's repository:

Repo name and folder path are defined in RepoURL
Create GitHub teams for module owners and contributors and grant them permissions as outlined here.
Grant permissions for the AVM core team and PG teams on your GitHub repo as described here.

Check if this module exists in the other IaC language. If so, collaborate with the other owner for consistency. 👍
You can now start the development of this module! ✅ Happy coding! 🎉
Please respond to this comment and request a review from the AVM core team once your module is ready to be published! Please include a link pointing to your PR, once available. 🙏
Any further questions or clarifications needed, let us know!
Thanks,
The AVM Core Team


SettingsEditor Console Error

I'm getting this error in my version 2018.3.14f1
in vanilla asset

hmmm, no problem with 2018.3.0f2.
Have you restarted Unity?
You could also try to do a "Reimport all" (this may take a while, depending on your project size)


Aprove change/create role

Describe the feature you'd like
We are wanting to use Bookstack to produce certains projects documentation. We are thinking that would be nice if we produce this documentation and give to the PO to approve (or not, asking for changes), creating an "official document" that everybody agree.
Some things that could be nice:

Set book to be only visible after aproved.
Set book to ask for a reason if not approved.
Ask for aprove when any changes is made in the book, keeping the "oficial document".
Show who aproved the book.

Describe the benefits this would bring to existing BookStack users
This could benefits other users that need to officialize documents or projects that is has been creating and demand an aproved scope.
Can the goal of this request already be achieved via other means?
We can verbally agree to set visible the books after an email aproval, put it would be better to use this feature inside bookstack.
Have you searched for an existing open/closed issue?

[X] I have searched for existing issues and none cover my fundemental request

How long have you been using BookStack?
1 to 5 years
Additional context
No response

Thanks for the request, but I feel the fundamental desired ability here is already covered by  #473 so I'll therefore close this off as a duplicate.


Kubeflow on GCP v1.2.1 doc update

/assign @zijianjoy

/lgtm
/approve
I have validated that kubeflow 1.2.1 deployment is successful with Kubernetes v1.16. Thank you so much Yuan!


Error in CBOW

The currently implementation of CBOW has a return statement inside the epoch loop, hence it never did more that a single epoch.

@LucaCappelletti94 Yes!! Thanks Luca. I was thinking that there must be a bug somewhere because I did not see any improvements in AUC score when I increased number of epochs.

I believe we should tackle this and the other errors I have mentioned on Gitter in refactoring of the word2vec methods.

Yes! Let's solve the issues at the zoom meeting today.

I think this was taken care of!


Unknown fields are denied for tagged newtype variant with unit struct or unit type

This issue is closely related to #2303 .
Let say we have the following unit struct and internally tagged enum:
#[derive(Deserialize, Debug)]
struct ErrorStruct;

#[derive(Deserialize, Debug)]
#[serde(tag = "result")]
enum Response {
    Success(()),
    Error(ErrorStruct),
}

Here, {"result": "Success"} can be deserialized into Response::Success(()) and {"result": "Error"} into Response::Error(ErrorStruct). But if we add more unknown fields it doesn't work. We cannot for example deserialize {"result": "Error", "msg": "Something really bad"} into Response::Error(ErrorStruct).
This should indeed be the behaviour if the deny_unknown_fields attribute is present, but I think that extra unknown fields should be allowed otherwise. Or does someone think differently?
I would be willing to make a PR if this feature is accepted.

First I must correct myself. The example enum in my previous comment should of course not has the deny_unknown_fields attribute. That was the entire point.
But I have thought a bit more about this. The reason it feels natural to allow unknown fields for internally tagged newtype variants over unit or unit structs is because we are deserializing/parsing from a map structure. The default behaviour if we deserialize into a struct type from a map is indeed to allow unknown fields, now we're still deserializing from a map so I think it makes alot sense to accept unknown fields here as well. Unless the deny_unknown_fields attribute is set of course.
But that makes us think, in what other cases do we deserialize something from a map and want to allow/deny unknown fields? And it turns out that internally tagged unit variants is such a case. However here it seems that unknown fields are allowed even though deny_unknown_fields is set. I.E. let's say we have the following enum:
#[derive(Deserialize, Debug)]
#[serde(tag = "result")]
enum AllowUnknownFields {
    Success,
}

#[derive(Deserialize, Debug)]
#[serde(tag = "result", deny_unknown_fields)]
enum DenyUnknownFields {
    Success,
}

Here both AllowUnknownFields::Success and DenyUnknownFields::Success can be deserialized from {"result": "success", "msg": "abc"}. But the intuition tells at least me that only AllowUnknownFields should be deserialized successfully from this input. Because msg is indeed an unknown field.
I split this into two features:

Allow unknown fields when deserializing internally tagged newtype variants over unit and unit struct unless `deny_unknown_fields is set.
Deny unknown fields when deserializing internally tagged unit variants if deny_unknown_fields is set.

I think that 1. is very easy to fix. I have the code in a fork here (on the master branch) and I can make a PR from that.
Number 2 is however a bit more contraversal since it might break existing code. I've also implemented this (just for fun) and you can find the code on my fork on the unit_variant_allow_unknown_fields branch.
I think that both 1 and 2 together is most consistant, but I'm not sure whether the possible breakage that might be introduced by 2 is acceptable.

First I must correct myself. The example enum in my previous comment should of course not has the deny_unknown_fields attribute. That was the entire point.

Can you edit the original post to fix that mistake? The code snippet is quite confusing to read, currently

#[derive(Deserialize, Debug)]
struct ErrorStruct;

#[derive(Deserialize, Debug)]
#[serde(tag = "result")]
enum Response {
    Success(()),
    Error(ErrorStruct),
}

Here, {"result": "Success"} can be deserialized into Response::Success(()) and {"result": "Error"} into Response::Error(ErrorStruct). But if we add more unknown fields it doesn't work. We cannot for example deserialize {"result": "Error", "msg": "Something really bad"} into Response::Error(ErrorStruct).

This issue is unrelated to enums. The fundamental reason is that serde parses JSON objects {}) into C-style structs struct Foo {} only.
If you change the code to
#[derive(Deserialize, Debug)]
struct ErrorStruct {}

#[derive(Deserialize, Debug)]
#[serde(tag = "result")]
enum Response {
    Success(()),
    Error(ErrorStruct),
}

deserializing from {"result": "Error", "msg": "Something really bad"} works fine.

Can you edit the original post to fix that mistake? The code snippet is quite confusing to read, currently

The original post is fixed now.

This issue is unrelated to enums. The fundamental reason is that serde parses JSON objects {}) into C-style structs struct Foo {} only. https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=85abdc5bedcfb8ff0e0b9c4cfbfb9080
If you change the code to
#[derive(Deserialize, Debug)]
struct ErrorStruct {}

#[derive(Deserialize, Debug)]
#[serde(tag = "result")]
enum Response {
    Success(()),
    Error(ErrorStruct),
}

deserializing from {"result": "Error", "msg": "Something really bad"} works fine.

But then unknown fields should neither be allowed on unit variants.
#[derive(Deserialize, Debug)]
#[serde(tag = "result")]
enum Response {
    Success,
    Error(()),
}

Now {"result": "Success", "msg": "abc"} can be deserialized into Response::Success but {"result": "Error", "msg": "abc"} cannot be deserialized into Response::Error(()). That just feels inconsistent to me.

It seems that this is a duplicate of #2294 or at least the reasons the same


Unit Testing

Unit test for the rest of the ROS Utilities that did not have any. Most are pretty straight forward, but some required a little multi-threading to get them to properly test the pathways. Let me know if anything is not commented enough or confusing.
Jira Tickets:
https://theaiinstitute.atlassian.net/browse/SW-223 and all the sub tickets
Suggested testing:
Try running these unit tests locally. It'll be good to test that the threading works on other machines. I'm relying on some sleeping to help cause certain clashes, which is not very reliable, but probably fine for a unit test.
Let me know if there's any issues or style things that I'm missing. I can also break up or squash the commits more.

Forgot to run the pre-checks will address those shortly

Pre-commit is fixed now, but CI doesn't seem to have the basic ros example services that I used for testing. I've seen us use it elsewhere at least in https://github.com/bdaiinstitute/bdai/pull/380 and it's a part of our normal docker image.

Fun. Apparently, this repo is using the docker image from spot_ros2. Probably should copy that one over, make a workflow to build it (can also be copied from spot_ros2), update it, and then use that instead.


Outer approximation differs when big floats are used

Expected true:
a = Fuzzy(1, 2, 3, steps = 50)           #Fuzzy: 	 ~ ( Range=[1, 3], Core=[1.97999, 2.02001] )
b = Fuzzy(BigFloat(1), BigFloat(2), BigFloat(3), steps = 50)  # Fuzzy: 	 ~ ( Range=[1, 3]₂₅₆, Core=[1.97999, 2.02001]₂₅₆ )

all(b.Membership .⊆ a.Membership)   # false

Linear interpolator:
function linearInterp(Core::Interval, Range::Interval, steps = 200)
    return interval.(range(Range.lo, Core.lo, length = steps), range(Range.hi, Core.hi, length = steps))
end

Related to #8

The following interpolator is better but still problematic:
function linearInterp(Core::Interval, Range::Interval, steps = 200)
    lows = range(interval(Range.lo), interval(Core.lo), length = steps )
    highs = range(interval(Range.hi), interval(Core.hi), length = steps )
    return interval.(left.(lows), right.(highs))
end

Neither of the following work either:
function linearInterp(Core::Interval, Range::Interval, steps = 200)
    return collect(LinRange(Range, Core, steps))
end

function linearInterp(Core::Interval, Range::Interval, steps = 200)
    return collect(range(Range, Core, length = steps))
end

also not working:
function linearInterp(Core::Interval, Range::Interval, steps = 200)
    lows = mince(interval(Range.lo, Core.lo), steps)
    highs = mince(interval(Core.hi, Range.hi), steps)
    return interval.(left.(lows), reverse(right.(highs)))
end

The following passes:
function linearInterp(Core::Interval{T}, Range::Interval{T}, steps = 200)  where T <: Real

    lows = setrounding(T, RoundDown) do
        collect(range(Range.lo, Core.lo, length = steps))
    end

    highs = setrounding(T, RoundUp) do
        collect(range(Range.hi, Core.hi, length = steps))
    end

    return interval.(lows, highs)
end

An nice alternative solution from @kolaru:
function linearInterp(Core::Interval, Range::Interval, steps = 200)
    width = Range - Core
    return reverse([Core + width * k/steps for k in 1:steps])
end


⚠ Spryr has degraded performance

In a414181, Spryr (https://spryr.com) experienced degraded performance:

HTTP code: 200
Response time: 5436 ms

Resolved: Spryr performance has improved in 1050da7 after 9 minutes.


Issues with moving floating buttons with 3rd Party sidebars

We need to review the way we're handling moving the floating buttons. We have 2 further issues:

3rd party integrations in the sidebar load later, and therefore the handler to move the floating buttons when the 3rd party addon icons are clicked is never added (the add happens before the 3rd part addons load)
The logic for spotting when the sidebar closes also does not appear to work when a 3rd party addon is closed

I noticed all this when opening the "Todoist" addon. Number 1 above is quite easy to fix... still looking into number 2

OK, so I found another issue... the sidebar monitoring is not switched on if the side bar is initially totally hidden, then is unhidden by clicking the button at the bottom right. I'll fix this tomorrow

@jonrandy
Thanks for taking care of this I will do the pull today and tomorrow and then repush to the Store