mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-24 11:46:34 +00:00
Fix Button discovery payload #421
This commit is contained in:
parent
972ed6583f
commit
d664693407
@ -10,7 +10,7 @@
|
||||
// Device Drivers
|
||||
#include "dev/device.h"
|
||||
#include "drv/tft/tft_driver.h"
|
||||
//#include "drv/touch/touch_driver.h"
|
||||
// #include "drv/touch/touch_driver.h"
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP8266
|
||||
#define INPUT_PULLDOWN INPUT
|
||||
@ -67,7 +67,7 @@ static inline void gpio_update_group(uint8_t group, lv_obj_t* obj, bool power, i
|
||||
// uint32_t div_a; /*!<Division factor. Range: 0 ~ 63. */
|
||||
// } adc_digi_clk_t;
|
||||
#include "driver/adc.h"
|
||||
//#include "driver/dac_common.h"
|
||||
// #include "driver/dac_common.h"
|
||||
#include "driver/ledc.h"
|
||||
#include "driver/uart.h"
|
||||
#include "esp32-hal-dac.h"
|
||||
@ -815,7 +815,7 @@ hasp_gpio_config_t gpioGetPinConfig(uint8_t num)
|
||||
|
||||
void gpio_discovery(JsonObject& input, JsonArray& relay, JsonArray& light, JsonArray& dimmer)
|
||||
{
|
||||
char description[20];
|
||||
char description[20] = "";
|
||||
|
||||
for(uint8_t i = 0; i < HASP_NUM_GPIO_CONFIG; i++) {
|
||||
switch(gpioConfig[i].type) {
|
||||
@ -836,6 +836,7 @@ void gpio_discovery(JsonObject& input, JsonArray& relay, JsonArray& light, JsonA
|
||||
break;
|
||||
|
||||
case SWITCH:
|
||||
case BUTTON ... TOUCH:
|
||||
strcpy_P(description, PSTR("none"));
|
||||
break;
|
||||
case BATTERY:
|
||||
@ -910,9 +911,21 @@ void gpio_discovery(JsonObject& input, JsonArray& relay, JsonArray& light, JsonA
|
||||
case WINDOW:
|
||||
strcpy_P(description, PSTR("window"));
|
||||
break;
|
||||
case CARBON_MONOXIDE:
|
||||
strcpy_P(description, PSTR("carbon_monoxide"));
|
||||
break;
|
||||
case RUNNING:
|
||||
strcpy_P(description, PSTR("running"));
|
||||
break;
|
||||
case TAMPER:
|
||||
strcpy_P(description, PSTR("tamper"));
|
||||
break;
|
||||
case UPDATE:
|
||||
strcpy_P(description, PSTR("update"));
|
||||
break;
|
||||
case hasp_gpio_type_t::FREE:
|
||||
default:
|
||||
break;
|
||||
strcpy_P(description, PSTR("unknown"));
|
||||
}
|
||||
|
||||
if((gpioConfig[i].type >= hasp_gpio_type_t::SWITCH && gpioConfig[i].type <= hasp_gpio_type_t::WINDOW) ||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* MIT License - Copyright (c) 2019-2022 Francis Van Roie
|
||||
/* MIT License - Copyright (c) 2019-2023 Francis Van Roie
|
||||
For full license information read the LICENSE file in the project folder */
|
||||
|
||||
#ifndef HASP_GPIO_H
|
||||
@ -74,26 +74,34 @@ enum hasp_gpio_type_t {
|
||||
USED = 0x01,
|
||||
|
||||
/* Outputs */
|
||||
LED = 0x02,
|
||||
LED_R = 0x03,
|
||||
LED_G = 0x04,
|
||||
LED_B = 0x05,
|
||||
LED_CW = 0x06,
|
||||
LED_WW = 0x07,
|
||||
LED_W = 0x08,
|
||||
LIGHT_RELAY = 0x0A,
|
||||
POWER_RELAY = 0x0B,
|
||||
SHUTTER_RELAY = 0x0C,
|
||||
SHUTTER_OPEN = 0x1A,
|
||||
SHUTTER_CLOSE = 0x1B,
|
||||
BACKLIGHT = 0x20,
|
||||
PWM = 0x21,
|
||||
HASP_DAC = 0x22,
|
||||
SERIAL_DIMMER = 0x30,
|
||||
LED = 0x02,
|
||||
LED_R = 0x03,
|
||||
LED_G = 0x04,
|
||||
LED_B = 0x05,
|
||||
LED_CW = 0x06,
|
||||
LED_WW = 0x07,
|
||||
LED_W = 0x08,
|
||||
LIGHT_RELAY = 0x0A,
|
||||
POWER_RELAY = 0x0B,
|
||||
SHUTTER_RELAY = 0x0C,
|
||||
SHUTTER_OPEN = 0x1A,
|
||||
SHUTTER_CLOSE = 0x1B,
|
||||
BACKLIGHT = 0x20,
|
||||
PWM = 0x21,
|
||||
HASP_DAC = 0x22,
|
||||
SERIAL_DIMMER = 0x30,
|
||||
SERIAL_DIMMER_L8_HD_INVERTED = 0x31,
|
||||
SERIAL_DIMMER_L8_HD = 0x32,
|
||||
BUZZER = 0x40,
|
||||
HAPTIC = 0x41,
|
||||
SERIAL_DIMMER_L8_HD = 0x32,
|
||||
BUZZER = 0x40,
|
||||
HAPTIC = 0x41,
|
||||
|
||||
AWNING = 0x89,
|
||||
BLIND = 0x8A,
|
||||
CURTAIN = 0x8B,
|
||||
DAMPER = 0x8C,
|
||||
GATE = 0x8D,
|
||||
SHADE = 0x8E,
|
||||
SHUTTER = 0x8F,
|
||||
|
||||
/* Inputs */
|
||||
SWITCH = 0xA0, // Binary Sensors
|
||||
@ -121,14 +129,10 @@ enum hasp_gpio_type_t {
|
||||
SOUND = 0xB6,
|
||||
VIBRATION = 0xB7,
|
||||
WINDOW = 0xB8,
|
||||
|
||||
AWNING = 0xB9,
|
||||
BLIND = 0xBA,
|
||||
CURTAIN = 0xBB,
|
||||
DAMPER = 0xBC,
|
||||
GATE = 0xBD,
|
||||
SHADE = 0xBE,
|
||||
SHUTTER = 0xBF,
|
||||
CARBON_MONOXIDE = 0xB9,
|
||||
RUNNING = 0xBA,
|
||||
TAMPER = 0xBB,
|
||||
UPDATE = 0xBC,
|
||||
|
||||
BUTTON = 0xF0,
|
||||
BUTTON_TOGGLE_UP = 0xF1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user