maximkulkin / esp-homekit

Apple HomeKit accessory server library for ESP-OPEN-RTOS
MIT License
1.1k stars 169 forks source link

esp8266 add device failed. Write value too large [json.c] #79

Closed xxfenxx closed 5 years ago

xxfenxx commented 5 years ago

HomeKit: [Client 1] Verification successful, secure session established HomeKit: [Client 1] Get Accessories !!! HomeKit: Write value too large HomeKit: [Client 1] Closing client connection

I try to add led device using demo code led_strip and failed logouting info like adove.

maximkulkin commented 5 years ago

Did you change anything? I do not see anything that could cause it. This issue is when you try to generate a JSON with a single value larger than the whole JSON buffer. JSON buffer for get accessories is 1024 bytes. I feel like you have a dangling/uninitialized string pointer or non-terminated string.

xxfenxx commented 5 years ago

Hello, I got some troubles!

because someone say look at: https://github.com/maximkulkin/esp-homekit/issues/24:

I change [json.c] as:

void json_float(json_stream *json, float x) {
   ...
    void _do_write() {
        json_write(json, "%1.15g", x); 
    }
   ...
}

to

void json_float(json_stream *json, float x) {
   ...
    void _do_write() {
        json_write(json, "%ld", x); 
    }
   ...
}

doesn't work for me !!!

Compile warnings

warning: initialized field overwritten [-Woverride-init]
     HOMEKIT_ACCESSORY(.id = 1, .category = homekit_accessory_category_lightbulb, .services = (homekit_service_t*[]) {
     ^
warning: (near initialization for '(anonymous).category') [-Woverride-init]

Here my example code:

void json_float(json_stream *json, float x) {
   ...
    void _do_write() {
        json_write(json, "%ld", x); 
    }
   ...
}

LED example code:

#include <stdio.h>
#include <string.h>

#include <esp_system.h>
#include <esp_wifi.h>
#include <esp_wifi_types.h>

#include <homekit/homekit.h>
#include <homekit/characteristics.h>
#include <homekit/types.h>

#include "wf_homekit_header.h"

#define LED_ON 0                // this is the value to write to GPIO for led on (0 = GPIO low)
#define LED_INBUILT_GPIO 2      // this is the onboard LED used to show on/off only
#define LED_COUNT 16            // this is the number of WS2812B leds on the strip
#define LED_RGB_SCALE 255       // this is the scaling factor used for color conversion

// Global variables
float led_hue = 50;              // hue is scaled 0 to 360
float led_saturation = 50;      // saturation is scaled 0 to 100
int led_brightness = 50;     // brightness is scaled 0 to 100
uint32_t led_color_temp = 50;     // color temperate is scaled 50 to 100
bool led_on = false;            // on is boolean on or off

void led_identify(homekit_value_t _value) {
    printf(">>> led_identify 1\n");
}

homekit_value_t led_on_get() {
    return HOMEKIT_BOOL(led_on);
}

void led_on_set(homekit_value_t value) {
    printf(">> led_on_set\n");
}

homekit_value_t led_brightness_get() {
    return HOMEKIT_INT(led_brightness);
}
void led_brightness_set(homekit_value_t value) {
    printf(">> led_brightness_set\n");
}

homekit_value_t led_hue_get() {
    return HOMEKIT_FLOAT(led_hue);
}

void led_hue_set(homekit_value_t value) {
    printf(">> led_hue_set\n");
}

homekit_value_t led_saturation_get() {
    return HOMEKIT_FLOAT(led_saturation);
}

void led_saturation_set(homekit_value_t value) {
    printf(">> led_saturation_set\n");
}

homekit_value_t led_color_temp_get() {
    return HOMEKIT_UINT32(led_color_temp);
}

void led_color_temp_set(homekit_value_t value) {
    printf(">> led_saturation_set\n");
}

homekit_characteristic_t info_name = HOMEKIT_CHARACTERISTIC_(NAME, "Sample LED Strip");

homekit_accessory_t *accessories[] = {
    HOMEKIT_ACCESSORY(.id = 1, .category = homekit_accessory_category_lightbulb, .services = (homekit_service_t*[]) {
        HOMEKIT_SERVICE(ACCESSORY_INFORMATION, .id = 100, .primary = false, .hidden = false, .characteristics = (homekit_characteristic_t*[]) {
            &info_name,
            HOMEKIT_CHARACTERISTIC(MANUFACTURER, "Generic"),
            HOMEKIT_CHARACTERISTIC(SERIAL_NUMBER, "037A2BABF19D"),
            HOMEKIT_CHARACTERISTIC(MODEL, "LEDStrip"),
            HOMEKIT_CHARACTERISTIC(FIRMWARE_REVISION, "0.1"),
            HOMEKIT_CHARACTERISTIC(IDENTIFY, led_identify),
            NULL
        }),
        HOMEKIT_SERVICE(LIGHTBULB, .id = 200, .primary = true, .hidden = false, .characteristics = (homekit_characteristic_t*[]) {
            HOMEKIT_CHARACTERISTIC(NAME, 
            "Sample LED Strip"
            ),
            HOMEKIT_CHARACTERISTIC(
                ON, false,
                .getter = led_on_get,
                .setter = led_on_set
            ),
            HOMEKIT_CHARACTERISTIC(
                BRIGHTNESS, 50,
                .getter = led_brightness_get,
                .setter = led_brightness_set
            ),
            HOMEKIT_CHARACTERISTIC(
                HUE, 50,
                .getter = led_hue_get,
                .setter = led_hue_set
            ),
            HOMEKIT_CHARACTERISTIC(
                SATURATION, 50,
                .getter = led_saturation_get,
                .setter = led_saturation_set
            ),
            NULL
        }),
        NULL
    }),
    NULL
};

homekit_server_config_t server_config = {
    .accessories = accessories,
    .password = "123-45-678",
    .setupId = "1QJ8"
};

void init_led_strip(void) {
    uint8_t macaddr[6];
    esp_wifi_get_mac(WIFI_IF_STA, macaddr);

    char *name_value = malloc(18);
    snprintf(name_value, 18, "Smart Light %02X%02X%02X", macaddr[3], macaddr[4], macaddr[5]);
    info_name.value = HOMEKIT_STRING(name_value);

    homekit_server_init(&server_config);
}

I got some printouts

>>> HomeKit: Starting server
>>> HomeKit: Finish load accessory ID
>>> HomeKit: Using existing accessory ID: 5E:19:96:5D:E2:2E
D (2094) nvs: nvs_open_from_partition homekit 1
D (2094) nvs: nvs_get_str_or_blob _PAIRING_0_
D (2104) nvs: nvs_close 9
D (2104) nvs: nvs_open_from_partition homekit 1
D (2104) nvs: nvs_get_str_or_blob _PAIRING_1_
D (2114) nvs: nvs_close 10
D (2114) nvs: nvs_open_from_partition homekit 1
D (2114) nvs: nvs_get_str_or_blob _PAIRING_2_
D (2124) nvs: nvs_close 11
D (2124) nvs: nvs_open_from_partition homekit 1
D (2124) nvs: nvs_get_str_or_blob _PAIRING_3_
D (2134) nvs: nvs_close 12
D (2134) nvs: nvs_open_from_partition homekit 1
D (2144) nvs: nvs_get_str_or_blob _PAIRING_4_
D (2144) nvs: nvs_close 13
D (2144) nvs: nvs_open_from_partition homekit 1
D (2154) nvs: nvs_get_str_or_blob _PAIRING_5_
D (2154) nvs: nvs_close 14
D (2154) nvs: nvs_open_from_partition homekit 1
D (2164) nvs: nvs_get_str_or_blob _PAIRING_6_
D (2164) nvs: nvs_close 15
D (2164) nvs: nvs_open_from_partition homekit 1
D (2174) nvs: nvs_get_str_or_blob _PAIRING_7_
D (2174) nvs: nvs_close 16
D (2174) nvs: nvs_open_from_partition homekit 1
D (2184) nvs: nvs_get_str_or_blob _PAIRING_8_
D (2184) nvs: nvs_close 17
D (2194) nvs: nvs_open_from_partition homekit 1
D (2194) nvs: nvs_get_str_or_blob _PAIRING_9_
D (2194) nvs: nvs_close 18
D (2204) nvs: nvs_open_from_partition homekit 1
D (2204) nvs: nvs_get_str_or_blob _PAIRING_10_
D (2204) nvs: nvs_close 19
D (2214) nvs: nvs_open_from_partition homekit 1
D (2214) nvs: nvs_get_str_or_blob _PAIRING_11_
D (2224) nvs: nvs_close 20
D (2224) nvs: nvs_open_from_partition homekit 1
D (2224) nvs: nvs_get_str_or_blob _PAIRING_12_
D (2234) nvs: nvs_close 21
D (2234) nvs: nvs_open_from_partition homekit 1
D (2234) nvs: nvs_get_str_or_blob _PAIRING_13_
D (2244) nvs: nvs_close 22
D (2244) nvs: nvs_open_from_partition homekit 1
D (2244) nvs: nvs_get_str_or_blob _PAIRING_14_
D (2254) nvs: nvs_close 23
D (2254) nvs: nvs_open_from_partition homekit 1
D (2254) nvs: nvs_get_str_or_blob _PAIRING_15_
D (2264) nvs: nvs_close 24
>>> HomeKit: Configuring mDNS
.[0;32mI (12034) wf_example_main: Free heap size: 48620 for count: 1.[0m
>>> HomeKit: Got new client connection: 1
>>> HomeKit: [Client 1] Pair Setup Step 1/3
.[0;32mI (22034) wf_example_main: Free heap size: 26804 for count: 2.[0m
>>> HomeKit: [Client 1] Pair Setup Step 2/3
.[0;32mI (32034) wf_example_main: Free heap size: 22596 for count: 3.[0m
.[0;32mI (42034) wf_example_main: Free heap size: 22400 for count: 4.[0m
>>> HomeKit: [Client 1] Pair Setup Step 3/3
D (45944) nvs: nvs_open_from_partition homekit 1
D (45944) nvs: nvs_get_str_or_blob _PAIRING_0_
D (45944) nvs: nvs_close 25
D (45944) nvs: nvs_open_from_partition homekit 1
D (45944) nvs: nvs_set_blob _PAIRING_0_ 73
D (45954) nvs: nvs_close 26
>>> HomeKit: Added pairing with 092D5506-7CF1-45BB-8E8E-CDFF93758E51
>>> HomeKit: Configuring mDNS
>>> HomeKit: [Client 1] Successfully paired
>>> HomeKit: [Client 1] Closing client connection
>>> HomeKit: Got new client connection: 1
>>> HomeKit: [Client 1] Pair Verify Step 1/2
>>> HomeKit: [Client 1] Pair Verify Step 2/2
D (47274) nvs: nvs_open_from_partition homekit 1
D (47274) nvs: nvs_get_str_or_blob _PAIRING_0_
D (47274) nvs: nvs_close 27
>>> HomeKit: [Client 1] Found pairing with 092D5506-7CF1-45BB-8E8E-CDFF93758E51
>>> HomeKit: [Client 1] Verification successful, secure session established
>>> HomeKit: [Client 1] Get Accessories
>>> HomeKit: [Client 1] Remove Pairing
D (47704) nvs: nvs_open_from_partition homekit 1
D (47704) nvs: nvs_get_str_or_blob _PAIRING_0_
D (47704) nvs: nvs_close 28
D (47704) nvs: nvs_open_from_partition homekit 1
D (47704) nvs: nvs_get_str_or_blob _PAIRING_0_
D (47714) nvs: nvs_close 29
D (47714) nvs: nvs_open_from_partition homekit 1
D (47724) nvs: nvs_set_blob _PAIRING_0_ 73
D (47724) nvs: nvs_close 30
>>> HomeKit: Removed pairing with 092D5506-7CF1-45BB-8E8E-CDFF93758E51
D (47734) nvs: nvs_open_from_partition homekit 1
D (47734) nvs: nvs_get_str_or_blob _PAIRING_0_
D (47744) nvs: nvs_close 31
D (47744) nvs: nvs_open_from_partition homekit 1
D (47744) nvs: nvs_get_str_or_blob _PAIRING_1_
D (47754) nvs: nvs_close 32
D (47754) nvs: nvs_open_from_partition homekit 1
D (47754) nvs: nvs_get_str_or_blob _PAIRING_2_
D (47764) nvs: nvs_close 33
D (47764) nvs: nvs_open_from_partition homekit 1
D (47774) nvs: nvs_get_str_or_blob _PAIRING_3_
D (47774) nvs: nvs_close 34
D (47774) nvs: nvs_open_from_partition homekit 1
D (47784) nvs: nvs_get_str_or_blob _PAIRING_4_
D (47784) nvs: nvs_close 35
D (47784) nvs: nvs_open_from_partition homekit 1
D (47794) nvs: nvs_get_str_or_blob _PAIRING_5_
D (47794) nvs: nvs_close 36
D (47794) nvs: nvs_open_from_partition homekit 1
D (47804) nvs: nvs_get_str_or_blob _PAIRING_6_
D (47804) nvs: nvs_close 37
D (47804) nvs: nvs_open_from_partition homekit 1
D (47814) nvs: nvs_get_str_or_blob _PAIRING_7_
D (47814) nvs: nvs_close 38
D (47824) nvs: nvs_open_from_partition homekit 1
D (47824) nvs: nvs_get_str_or_blob _PAIRING_8_
D (47824) nvs: nvs_close 39
D (47834) nvs: nvs_open_from_partition homekit 1
D (47834) nvs: nvs_get_str_or_blob _PAIRING_9_
D (47844) nvs: nvs_close 40
D (47844) nvs: nvs_open_from_partition homekit 1
D (47844) nvs: nvs_get_str_or_blob _PAIRING_10_
D (47854) nvs: nvs_close 41
D (47854) nvs: nvs_open_from_partition homekit 1
D (47854) nvs: nvs_get_str_or_blob _PAIRING_11_
D (47864) nvs: nvs_close 42
D (47864) nvs: nvs_open_from_partition homekit 1
D (47864) nvs: nvs_get_str_or_blob _PAIRING_12_
D (47874) nvs: nvs_close 43
D (47874) nvs: nvs_open_from_partition homekit 1
D (47884) nvs: nvs_get_str_or_blob _PAIRING_13_
D (47884) nvs: nvs_close 44
D (47884) nvs: nvs_open_from_partition homekit 1
D (47894) nvs: nvs_get_str_or_blob _PAIRING_14_
D (47894) nvs: nvs_close 45
D (47894) nvs: nvs_open_from_partition homekit 1
D (47904) nvs: nvs_get_str_or_blob _PAIRING_15_
D (47904) nvs: nvs_close 46
>>> HomeKit: Last admin pairing was removed, enabling pair setup
>>> HomeKit: Configuring mDNS
>>> HomeKit: [Client 1] Closing client connection
xxfenxx commented 5 years ago

Hello again !

If I don't change the code[json.c]

void json_float(json_stream *json, float x) {
   ...
    void _do_write() {
        json_write(json, "%1.15g", x); 
    }
   ...
}

to

void json_float(json_stream *json, float x) {
   ...
    void _do_write() {
        json_write(json, "%ld", x); 
    }
   ...
}

and keep the code as:

void json_float(json_stream *json, float x) {
   ...
    void _do_write() {
        json_write(json, "%1.15g", x); 
    }
   ...
}

and the LED example code:

#include <stdio.h>
#include <string.h>

#include <esp_system.h>
#include <esp_wifi.h>
#include <esp_wifi_types.h>

#include <homekit/homekit.h>
#include <homekit/characteristics.h>
#include <homekit/types.h>

#include "wf_homekit_header.h"

#define LED_ON 0                // this is the value to write to GPIO for led on (0 = GPIO low)
#define LED_INBUILT_GPIO 2      // this is the onboard LED used to show on/off only
#define LED_COUNT 16            // this is the number of WS2812B leds on the strip
#define LED_RGB_SCALE 255       // this is the scaling factor used for color conversion

// Global variables
float led_hue = 50;              // hue is scaled 0 to 360
float led_saturation = 50;      // saturation is scaled 0 to 100
int led_brightness = 50;     // brightness is scaled 0 to 100
uint32_t led_color_temp = 50;     // color temperate is scaled 50 to 100
bool led_on = false;            // on is boolean on or off

void led_identify(homekit_value_t _value) {
    printf(">>> led_identify 1\n");
}

homekit_value_t led_on_get() {
    return HOMEKIT_BOOL(led_on);
}

void led_on_set(homekit_value_t value) {
    printf(">> led_on_set\n");
}

homekit_value_t led_brightness_get() {
    return HOMEKIT_INT(led_brightness);
}
void led_brightness_set(homekit_value_t value) {
    printf(">> led_brightness_set\n");
}

homekit_value_t led_hue_get() {
    return HOMEKIT_FLOAT(led_hue);
}

void led_hue_set(homekit_value_t value) {
    printf(">> led_hue_set\n");
}

homekit_value_t led_saturation_get() {
    return HOMEKIT_FLOAT(led_saturation);
}

void led_saturation_set(homekit_value_t value) {
    printf(">> led_saturation_set\n");
}

homekit_value_t led_color_temp_get() {
    return HOMEKIT_UINT32(led_color_temp);
}

void led_color_temp_set(homekit_value_t value) {
    printf(">> led_saturation_set\n");
}

homekit_characteristic_t info_name = HOMEKIT_CHARACTERISTIC_(NAME, "Sample LED Strip");

homekit_accessory_t *accessories[] = {
    HOMEKIT_ACCESSORY(.id = 1, .category = homekit_accessory_category_lightbulb, .services = (homekit_service_t*[]) {
        HOMEKIT_SERVICE(ACCESSORY_INFORMATION, .id = 100, .primary = false, .hidden = false, .characteristics = (homekit_characteristic_t*[]) {
            &info_name,
            HOMEKIT_CHARACTERISTIC(MANUFACTURER, "Generic"),
            HOMEKIT_CHARACTERISTIC(SERIAL_NUMBER, "037A2BABF19D"),
            HOMEKIT_CHARACTERISTIC(MODEL, "LEDStrip"),
            HOMEKIT_CHARACTERISTIC(FIRMWARE_REVISION, "0.1"),
            HOMEKIT_CHARACTERISTIC(IDENTIFY, led_identify),
            NULL
        }),
        HOMEKIT_SERVICE(LIGHTBULB, .id = 200, .primary = true, .hidden = false, .characteristics = (homekit_characteristic_t*[]) {
            HOMEKIT_CHARACTERISTIC(NAME, 
            "Sample LED Strip"
            ),
            HOMEKIT_CHARACTERISTIC(
                ON, false,
                .getter = led_on_get,
                .setter = led_on_set
            ),
            HOMEKIT_CHARACTERISTIC(
                BRIGHTNESS, 50,
                .getter = led_brightness_get,
                .setter = led_brightness_set
            ),
            HOMEKIT_CHARACTERISTIC(
                HUE, 50,
                .getter = led_hue_get,
                .setter = led_hue_set
            ),
            HOMEKIT_CHARACTERISTIC(
                SATURATION, 50,
                .getter = led_saturation_get,
                .setter = led_saturation_set
            ),
            NULL
        }),
        NULL
    }),
    NULL
};
homekit_server_config_t server_config = {
    .accessories = accessories,
    .password = "123-45-678",
    .setupId = "1QJ8"
};

void init_led_strip(void) {
    uint8_t macaddr[6];
    esp_wifi_get_mac(WIFI_IF_STA, macaddr);

    char *name_value = malloc(18);
    snprintf(name_value, 18, "Smart Light %02X%02X%02X", macaddr[3], macaddr[4], macaddr[5]);
    info_name.value = HOMEKIT_STRING(name_value);

    homekit_server_init(&server_config);
}

I would get some printouts

>>> HomeKit: Starting server
D (5505) nvs: nvs_open_from_partition homekit 1
D (5505) nvs: nvs_get_str_or_blob _MAGIC_
D (5505) nvs: nvs_close 6
>>> HomeKit: Start load accessory ID
D (5515) nvs: nvs_open_from_partition homekit 1
D (5515) nvs: nvs_get_str_or_blob _ACCESSORY_ID_
D (5525) nvs: nvs_close 7
>>> HomeKit: Finish load accessory ID
D (5525) nvs: nvs_open_from_partition homekit 1
D (5535) nvs: nvs_get_str_or_blob _ACCESSORY_KEY_
D (5535) nvs: nvs_close 8
>>> HomeKit: Using existing accessory ID: 0F:D0:99:77:E9:40
D (5545) nvs: nvs_open_from_partition homekit 1
D (5545) nvs: nvs_get_str_or_blob _PAIRING_0_
D (5555) nvs: nvs_close 9
D (5555) nvs: nvs_open_from_partition homekit 1
D (5555) nvs: nvs_get_str_or_blob _PAIRING_1_
D (5565) nvs: nvs_close 10
D (5565) nvs: nvs_open_from_partition homekit 1
D (5565) nvs: nvs_get_str_or_blob _PAIRING_2_
D (5575) nvs: nvs_close 11
D (5575) nvs: nvs_open_from_partition homekit 1
D (5575) nvs: nvs_get_str_or_blob _PAIRING_3_
D (5585) nvs: nvs_close 12
D (5585) nvs: nvs_open_from_partition homekit 1
D (5585) nvs: nvs_get_str_or_blob _PAIRING_4_
D (5595) nvs: nvs_close 13
D (5595) nvs: nvs_open_from_partition homekit 1
D (5605) nvs: nvs_get_str_or_blob _PAIRING_5_
D (5605) nvs: nvs_close 14
D (5605) nvs: nvs_open_from_partition homekit 1
D (5615) nvs: nvs_get_str_or_blob _PAIRING_6_
D (5615) nvs: nvs_close 15
D (5615) nvs: nvs_open_from_partition homekit 1
D (5625) nvs: nvs_get_str_or_blob _PAIRING_7_
D (5625) nvs: nvs_close 16
D (5625) nvs: nvs_open_from_partition homekit 1
D (5635) nvs: nvs_get_str_or_blob _PAIRING_8_
D (5635) nvs: nvs_close 17
D (5635) nvs: nvs_open_from_partition homekit 1
D (5645) nvs: nvs_get_str_or_blob _PAIRING_9_
D (5645) nvs: nvs_close 18
D (5645) nvs: nvs_open_from_partition homekit 1
D (5655) nvs: nvs_get_str_or_blob _PAIRING_10_
D (5655) nvs: nvs_close 19
D (5665) nvs: nvs_open_from_partition homekit 1
D (5665) nvs: nvs_get_str_or_blob _PAIRING_11_
D (5665) nvs: nvs_close 20
D (5675) nvs: nvs_open_from_partition homekit 1
D (5675) nvs: nvs_get_str_or_blob _PAIRING_12_
D (5685) nvs: nvs_close 21
D (5685) nvs: nvs_open_from_partition homekit 1
D (5685) nvs: nvs_get_str_or_blob _PAIRING_13_
D (5695) nvs: nvs_close 22
D (5695) nvs: nvs_open_from_partition homekit 1
D (5695) nvs: nvs_get_str_or_blob _PAIRING_14_
D (5705) nvs: nvs_close 23
D (5705) nvs: nvs_open_from_partition homekit 1
D (5705) nvs: nvs_get_str_or_blob _PAIRING_15_
D (5715) nvs: nvs_close 24
>>> HomeKit: Configuring mDNS
.[0;32mI (15485) wf_example_main: Free heap size: 48356 for count: 1.[0m
>>> HomeKit: Got new client connection: 1
>>> HomeKit: [Client 1] Pair Setup Step 1/3
.[0;32mI (25485) wf_example_main: Free heap size: 26792 for count: 2.[0m
.[0;32mI (35485) wf_example_main: Free heap size: 43324 for count: 3.[0m
>>> HomeKit: [Client 1] Pair Setup Step 2/3
.[0;32mI (45485) wf_example_main: Free heap size: 22592 for count: 4.[0m
>>> HomeKit: [Client 1] Pair Setup Step 3/3
D (51665) nvs: nvs_open_from_partition homekit 1
D (51675) nvs: nvs_get_str_or_blob _PAIRING_0_
D (51675) nvs: nvs_close 25
D (51675) nvs: nvs_open_from_partition homekit 1
D (51675) nvs: nvs_set_blob _PAIRING_0_ 73
D (51685) nvs: nvs_close 26
>>> HomeKit: Added pairing with 092D5506-7CF1-45BB-8E8E-CDFF93758E51
>>> HomeKit: Configuring mDNS
>>> HomeKit: [Client 1] Successfully paired
>>> HomeKit: [Client 1] Closing client connection
>>> HomeKit: Got new client connection: 1
>>> HomeKit: [Client 1] Pair Verify Step 1/2
>>> HomeKit: [Client 1] Pair Verify Step 2/2
D (52465) nvs: nvs_open_from_partition homekit 1
D (52465) nvs: nvs_get_str_or_blob _PAIRING_0_
D (52465) nvs: nvs_close 27
>>> HomeKit: [Client 1] Found pairing with 092D5506-7CF1-45BB-8E8E-CDFF93758E51
>>> HomeKit: [Client 1] Verification successful, secure session established
.[0;32mI (55485) wf_example_main: Free heap size: 45720 for count: 5.[0m
>>> HomeKit: [Client 1] Get Accessories
!!! HomeKit: Write value too large
>>> HomeKit: [Client 1] Closing client connection

I don't know how to deal with it now !!!

maximkulkin commented 5 years ago

If you get lost, you can fallback to using ESP-OPEN-RTOS instead which is the official supported SDK for esp-homekit.

xxfenxx commented 5 years ago

Thanks to @maximkulkin, but we have to use ESP8266_RTOS_SDK to do something,is it because they are different, you know what the reason might be ?

The error !!! HomeKit: Write value too large occur to is because [json.c] do not support float value in esp8266 ? Can I replace json_write(json, "%1.15g", x); with json_write(json, "%ld", x); ?