how to add auto add device setup wizard
-
- Posts: 18
- Joined: Fri Jun 16, 2017 1:48 am
hi i have uploaded the firmware but when i use this new feature that add io device from app it says this is not compatible something can u let me know how to achieve this
hi @fracz
i used firmware 2.6 build form supla-espressif IOT SDK
and log
Code: Select all
ENTER CFG MODE
state: 5 -> 0 (0)
rm 0
pm close 7
del if0
usl
mode : softAP(b6:e6:2d:03:43:d7)
add if1
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
bcn 100
If i used firmware 2.53 of zybi, it ok
do you know why?
Which board?
Should work :/
wifisocket.c
wifisocket.h
Code: Select all
#define B_RELAY1_PORT 12
#define B_RELAY2_PORT 13
#define B_RELAY3_PORT 14
#define B_CFG_PORT 0
#define B_BTN2_PORT 4
#define B_BTN3_PORT 5
void supla_esp_board_set_device_name(char *buffer, uint8 buffer_size) {
ets_snprintf(buffer, buffer_size, "supla-Light switch");
}
void ICACHE_FLASH_ATTR supla_esp_board_gpio_init(void) {
supla_input_cfg[0].type = INPUT_TYPE_BTN_MONOSTABLE;
supla_input_cfg[0].gpio_id = B_CFG_PORT;
supla_input_cfg[0].flags = INPUT_FLAG_PULLUP | INPUT_FLAG_CFG_BTN;
supla_input_cfg[0].relay_gpio_id = B_RELAY1_PORT;
supla_input_cfg[0].channel = 0;
supla_input_cfg[1].type = INPUT_TYPE_BTN_MONOSTABLE;
supla_input_cfg[1].gpio_id = B_BTN2_PORT;
supla_input_cfg[1].flags = INPUT_FLAG_PULLUP;
supla_input_cfg[1].relay_gpio_id = B_RELAY2_PORT;
supla_input_cfg[1].channel = 1;
supla_input_cfg[2].type = supla_esp_cfg.CfgButtonType == BTN_TYPE_BISTABLE ? INPUT_TYPE_BTN_BISTABLE : INPUT_TYPE_BTN_MONOSTABLE;
supla_input_cfg[2].gpio_id = B_BTN3_PORT;
supla_input_cfg[2].flags = INPUT_FLAG_PULLUP;
supla_input_cfg[2].relay_gpio_id = B_RELAY3_PORT;
supla_input_cfg[2].channel = 2;
// ---------------------------------------
// ---------------------------------------
supla_relay_cfg[0].gpio_id = B_RELAY1_PORT;
supla_relay_cfg[0].flags = RELAY_FLAG_RESTORE_FORCE;
supla_relay_cfg[0].channel = 0;
supla_relay_cfg[1].gpio_id = B_RELAY2_PORT;
supla_relay_cfg[1].flags = RELAY_FLAG_RESTORE_FORCE;
supla_relay_cfg[1].channel = 1;
supla_relay_cfg[2].gpio_id = B_RELAY3_PORT;
supla_relay_cfg[2].flags = RELAY_FLAG_RESTORE_FORCE;
supla_relay_cfg[2].channel = 2;
}
void ICACHE_FLASH_ATTR supla_esp_board_set_channels(TDS_SuplaDeviceChannel_B *channels, unsigned char *channel_count) {
*channel_count = 3;
channels[0].Number = 0;
channels[0].Type = SUPLA_CHANNELTYPE_RELAY;
channels[0].FuncList = SUPLA_BIT_RELAYFUNC_POWERSWITCH \
| SUPLA_BIT_RELAYFUNC_LIGHTSWITCH;
channels[0].Default = SUPLA_CHANNELFNC_LIGHTSWITCH;
channels[0].value[0] = supla_esp_gpio_relay_on(B_RELAY1_PORT);
channels[1].Number = 1;
channels[1].Type = channels[0].Type;
channels[1].FuncList = channels[0].FuncList;
channels[1].Default = channels[0].Default;
channels[1].value[0] = supla_esp_gpio_relay_on(B_RELAY2_PORT);
channels[2].Number = 2;
channels[2].Type = channels[0].Type;
channels[2].FuncList = channels[0].FuncList;
channels[2].Default = channels[0].Default;
channels[2].value[0] = supla_esp_gpio_relay_on(B_RELAY3_PORT);
}
void ICACHE_FLASH_ATTR supla_esp_board_send_channel_values_with_delay(void *srpc) {
supla_esp_channel_value_changed(0, supla_esp_gpio_relay_on(B_RELAY1_PORT));
supla_esp_channel_value_changed(1, supla_esp_gpio_relay_on(B_RELAY2_PORT));
supla_esp_channel_value_changed(2, supla_esp_gpio_relay_on(B_RELAY3_PORT));
}
Code: Select all
#ifndef WIFISOCKET_H_
#define WIFISOCKET_H_
#define CFGBTN_TYPE_SELECTION
#define LED_RED_PORT 15
void ICACHE_FLASH_ATTR supla_esp_board_send_channel_values_with_delay(void *srpc);
#endif
Open list of the wifi networks and check that your device is visible. The name of the network should match the rules that you can find in this function:
https://github.com/SUPLA/supla-android/ ... .java#L820
https://github.com/SUPLA/supla-android/ ... .java#L820