Compare commits

...

3 commits

Author SHA1 Message Date
reaw55
d4604d28c3 adjust IR behaviour 2024-04-07 17:30:34 +07:00
reaw55
6a15d99e52 edit nextion display 2024-04-06 04:07:20 +07:00
reaw55
2eb06c1c25 complied now 2024-04-06 04:06:17 +07:00
16 changed files with 1301 additions and 606 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 4 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 6 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Before After
Before After

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -2,6 +2,7 @@
#include "ise_display_definitions.hpp"
#include <ESPMegaDisplay.hpp>
#include <ESPMegaIoT.hpp>
#include <TimeStructure.hpp>
#include <DigitalInputCard.hpp>
#include <DigitalOutputCard.hpp>
@ -24,11 +25,12 @@ struct lightPosition {
class ISEDisplay : public ESPMegaDisplay {
public:
ISEDisplay(HardwareSerial* adapter, const uint8_t *light_array, uint8_t row, uint8_t column);
void begin(DigitalInputCard* inputCard, DigitalOutputCard* outputCard, ClimateCard* climateCard_daikin, ClimateCard* climateCard_york, RemoteVariable* pm_switch, RemoteVariable* pm_fan_speed);
void begin(DigitalInputCard* inputCard, DigitalOutputCard* outputCard, ClimateCard* climateCard_daikin, ClimateCard* climateCard_york, RemoteVariable* pm_switch, RemoteVariable* pm_fan_speed, RemoteVariable* ac_lock, RemoteVariable* pm_lock, ESPMegaIoT *iot);
void updateLightGroupStatePageDashboard();
void updateLightGroupStatePageStandby();
void updateAirPurifierState();
void updateAirPurifierStateStandby();
void updateSystemtoggle();
void updateDateTimeText(rtctime_t time);
void updateWeather(char *weather_string);
void updateTempOutside(float temp_outside);
@ -54,6 +56,7 @@ class ISEDisplay : public ESPMegaDisplay {
DigitalOutputCard *outputCard;
ClimateCard *climateCard_daikin;
ClimateCard *climateCard_york;
ESPMegaIoT *iot;
const uint8_t *light_array;
uint8_t row;
@ -61,12 +64,18 @@ class ISEDisplay : public ESPMegaDisplay {
RemoteVariable *pm_switch;
RemoteVariable *remote_pm_fan_speed;
RemoteVariable *ac_lock;
RemoteVariable *pm_lock;
uint8_t outputCallbackHandle;
uint8_t climateCallbackHandle;
uint32_t time_since_last_ac_change;
uint8_t user_mode;
uint8_t ac_lock_state;
uint8_t pm_lock_state;
uint8_t ac_mode;
uint8_t ac_fan_speed;
uint8_t ac_temperature;
bool ac_press_pending;
uint8_t pm_fan_speed;
uint8_t time_since_last_screen_update;
u_int8_t lightLevelRow1;
@ -77,14 +86,23 @@ class ISEDisplay : public ESPMegaDisplay {
void updateuserACmode();
void updateACfanSpeed();
void updateLightSwitch();
bool calculateLightGroupState();
bool calculateAllState();
void toggleSystem();
void sendACIRcode();
void setPMlockstate(bool is_pm_lock_on);
void setAClockstate(bool is_ac_lock_on);
void toggleACLock();
void togglePMLock();
void allOn();
void toggleLightGroupState();
void toggleLightGroupStateStandby();
void toggleLightIndividual(uint8_t row);
void toggleSliderLight(uint8_t row,uint8_t lightLevel);
void togglePM();
void togglePMStandby();
void toggleAC();
void setLightGroupState(uint8_t level);
void toggleACStandby();
void changeUserACmode();

View file

@ -23,6 +23,13 @@ change light assignment
8: row 4 column 2
*/
#define DAIKIN_MAX_TEMP 32
#define DAIKIN_MIN_TEMP 16
#define YORK_MAX_TEMP 30
#define YORK_MIN_TEMP 18
#define LIGHT_ROW1_COLUMN1 10
#define LIGHT_ROW1_COLUMN2 11
#define LIGHT_ROW2_COLUMN1 9
@ -72,178 +79,457 @@ lights have 4 states
#define PAGE_STANDBY 1
#define PAGE_DASHBOARD 2
//gmov logo size
#define COMPONENT_LOGO_500X500 0 //original size
#define COMPONENT_LOGO_260X260 1 //use for boot page loading
#define COMPONENT_LOGO_140X140 2 //use for standby page logo
#define COMPONENT_LOGO_62X62 3 //use for dashboard page top left logo
//font
#define COMPONENT_FONT_K2D_SB_24 0 //use for date
#define COMPONENT_FONT_BAIJ_B_32 1 //use for PM
#define COMPONENT_FONT_BAIJ_B_48 2 //use for time
#define COMPONENT_FONT_BAIJ_SB_80 3 //use for AC temperature
#define COMPONENT_FONT_BAIJ_B_40 4 //use for PM
//color (PCO)
#define COMPONENT_COLOR_ACTIVE_BLUE 7775
#define COMPONENT_COLOR_INACTIVE_GREY 44405
#define COMPONENT_COLOR_WHITE 65535
#define COMPONENT_COLOR_BLACK 0
//-------------BOOT PAGE----------------
//logo gmov boot
#define COMPONENT_OBJ_BOOT_LOGO 1
//boot background
#define COMPONENT_BOOT_BACKGROUND_PIC 0
#define COMPONENT_BOOT_BACKGROUND_PIC_REFERENCE 1
//-------------STANDBY PAGE----------------
//standby page object id and object name
#define COMPONENT_OBJ_STANDBY_LOGO 1 //logo
#define COMPONENT_OBJ_STANDBY_BTN_OPEN_ALL_TOGGLE 2 //s_open_all
#define COMPONENT_OBJ_STANDBY_BTN_LIGHT_TOGGLE 3 //s_light_toggle
#define COMPONENT_OBJ_STANDBY_BTN_AC_TOGGLE 4 //s_ac_toggle
#define COMPONENT_OBJ_STANDBY_BTN_PM_TOGGLE 5 //s_pm_toggle
#define COMPONENT_OBJ_STANDBY_TXT_TIME 6 //time
#define COMPONENT_OBJ_STANDBY_TXT_DATE 7 //date
#define COMPONENT_OBJ_STANDBY_TIMER_IDLE 8 //idle_timer
#define COMPONENT_OBJ_STANDBY_TXT_PM_OUTSIDE 9 //pm_out
#define COMPONENT_OBJ_STANDBY_TXT_PM_INSIDE 10 //pm_in
//---------standby page picture id and picture name------------
//Standby background
#define COMPONENT_STANDBY_PIC_BACKGROUND 2
#define COMPONENT_STANDBY_PIC_BACKGROUND_REFERENCE 3
//Standby open all toggle
#define COMPONENT_STANDBY_PIC_OPEN_ALL_TOGGLE_OFF 4
#define COMPONENT_STANDBY_PIC_OPEN_ALL_TOGGLE_OFF_PRESSED 5
#define COMPONENT_STANDBY_PIC_OPEN_ALL_TOGGLE_ON 6
#define COMPONENT_STANDBY_PIC_OPEN_ALL_TOGGLE_ON_PRESSED 7
//Standby light toggle
#define COMPONENT_STANDBY_PIC_LIGHT_TOGGLE_OFF 8
#define COMPONENT_STANDBY_PIC_LIGHT_TOGGLE_OFF_PRESSED 9
#define COMPONENT_STANDBY_PIC_LIGHT_TOGGLE_ON 10
#define COMPONENT_STANDBY_PIC_LIGHT_TOGGLE_ON_PRESSED 11
//Standby AC toggle
#define COMPONENT_STANDBY_PIC_AC_TOGGLE_OFF 12
#define COMPONENT_STANDBY_PIC_AC_TOGGLE_OFF_PRESSED 13
#define COMPONENT_STANDBY_PIC_AC_TOGGLE_ON 14
#define COMPONENT_STANDBY_PIC_AC_TOGGLE_ON_PRESSED 15
//Standby PM toggle
#define COMPONENT_STANDBY_PIC_PM_TOGGLE_OFF 16
#define COMPONENT_STANDBY_PIC_PM_TOGGLE_OFF_PRESSED 17
#define COMPONENT_STANDBY_PIC_PM_TOGGLE_ON 18
#define COMPONENT_STANDBY_PIC_PM_TOGGLE_ON_PRESSED 19
//-------------DASHBOARD PAGE----------------
//dashboard page object id and object name
//AC
#define COMPONENT_OBJ_DASHBOARD_NUM_AC_TEMP 1 //ac_temp
#define COMPONENT_OBJ_DASHBOARD_BTN_AC_TOGGLE 2 //ac_sw
#define COMPONENT_OBJ_DASHBOARD_BTN_AC_MODE 3 //ac_mode
#define COMPONENT_OBJ_DASHBOARD_BTN_AC_FAN_SPEED 4 //ac_speed
#define COMPONENT_OBJ_DASHBOARD_BTN_AC_TEMP_MINUS 5 //ac_minus
#define COMPONENT_OBJ_DASHBOARD_BTN_AC_TEMP_PLUS 6 //ac_plus
//PM
#define COMPONENT_OBJ_DASHBOARD_BTN_PM_TOGGLE 7 //pm_sw
#define COMPONENT_OBJ_DASHBOARD_TXT_PM_INSIDE 8 //pm_in
#define COMPONENT_OBJ_DASHBOARD_TXT_PM_OUTSIDE 9 //pm_out
//DECAPRICATED
#define DONTUSE_COMPONENT_OBJ_DASHBOARD_BTN_LIGHT_MASTER 10 //DONT USE THIS D_light_master
//Light Pic Holder
#define COMPONENT_OBJ_DASHBOARD_HOLDER_PIC_LIGHT_ROW1 11 //light_row1
#define COMPONENT_OBJ_DASHBOARD_HOLDER_PIC_LIGHT_ROW2 12 //light_row2
#define COMPONENT_OBJ_DASHBOARD_HOLDER_PIC_LIGHT_ROW3 13 //light_row3
#define COMPONENT_OBJ_DASHBOARD_HOLDER_PIC_LIGHT_ROW4 14 //light_row4
//Light Button
#define COMPONENT_OBJ_DASHBOARD_BTN_LIGHT_ROW1 15 //light_row1_sw
#define COMPONENT_OBJ_DASHBOARD_BTN_LIGHT_ROW2 16 //light_row2_sw
#define COMPONENT_OBJ_DASHBOARD_BTN_LIGHT_ROW3 17 //light_row3_sw
#define COMPONENT_OBJ_DASHBOARD_BTN_LIGHT_ROW4 18 //light_row4_sw
//Timer
#define COMPONENT_OBJ_DASHBOARD_TIMER_TEN_SEC 19 //time_10sec
#define COMPONENT_OBJ_DASHBOARD_VAL_TIME_PAST 20 //time_past
#define COMPONENT_OBJ_DASHBOARD_TIMER_INACTIVE_CHECK 21 //inactive_check
//System toggle
#define COMPONENT_OBJ_DASHBOARD_BTN_SYSTEM_TOGGLE 22 //system_toggle
//PM Button
#define COMPONENT_OBJ_DASHBOARD_BTN_PM_SPEED 23 //pm_speed
#define COMPONENT_OBJ_DASHBOARD_BTN_PM_MODE 24 //pm_mode
//Light Master Pic Holder
#define COMPONENT_OBJ_DASHBOARD_HOLDER_PIC_MASTER_LIGHT 25 //master_light
//Logo
#define COMPONENT_OBJ_DASHBOARD_LOGO 26 //small_ise_logo
//Lock Pic Holder
#define COMPONENT_OBJ_DASHBOARD_HOLDER_PIC_PM_LOCK 27 //pm_lock
#define COMPONENT_OBJ_DASHBOARD_HOLDER_PIC_AC_LOCK 28 //ac_lock
//Light Master Button
#define COMPONENT_OBJ_DASHBOARD_BTN_LIGHT_MASTER 29 //light_m_sw
//Light Master Hotspot
#define COMPONENT_OBJ_DASHBOARD_HOTSPOT_LIGHT_MASTER_LV1 30 //light_m_lv1
#define COMPONENT_OBJ_DASHBOARD_HOTSPOT_LIGHT_MASTER_LV2 31 //light_m_lv2
#define COMPONENT_OBJ_DASHBOARD_HOTSPOT_LIGHT_MASTER_LV3 32 //light_m_lv3
//Light Row1 Hotspot
#define COMPONENT_OBJ_DASHBOARD_HOTSPOT_LIGHT_ROW1_LV1 33 //light_row1_lv1
#define COMPONENT_OBJ_DASHBOARD_HOTSPOT_LIGHT_ROW1_LV2 34 //light_row1_lv2
#define COMPONENT_OBJ_DASHBOARD_HOTSPOT_LIGHT_ROW1_LV3 35 //light_row1_lv3
//Light Row2 Hotspot
#define COMPONENT_OBJ_DASHBOARD_HOTSPOT_LIGHT_ROW2_LV1 36 //light_row2_lv1
#define COMPONENT_OBJ_DASHBOARD_HOTSPOT_LIGHT_ROW2_LV2 37 //light_row2_lv2
#define COMPONENT_OBJ_DASHBOARD_HOTSPOT_LIGHT_ROW2_LV3 38 //light_row2_lv3
//Light Row3 Hotspot
#define COMPONENT_OBJ_DASHBOARD_HOTSPOT_LIGHT_ROW3_LV1 39 //light_row3_lv1
#define COMPONENT_OBJ_DASHBOARD_HOTSPOT_LIGHT_ROW3_LV2 40 //light_row3_lv2
#define COMPONENT_OBJ_DASHBOARD_HOTSPOT_LIGHT_ROW3_LV3 41 //light_row3_lv3
//Light Row4 Hotspot
#define COMPONENT_OBJ_DASHBOARD_HOTSPOT_LIGHT_ROW4_LV1 42 //light_row4_lv1
#define COMPONENT_OBJ_DASHBOARD_HOTSPOT_LIGHT_ROW4_LV2 43 //light_row4_lv2
#define COMPONENT_OBJ_DASHBOARD_HOTSPOT_LIGHT_ROW4_LV3 44 //light_row4_lv3
//Degree Pic Holder
#define COMPONENT_OBJ_DASHBOARD_HOLDER_PIC_C_DEGREE 45 //c_degree
//-----------------dashboard page picture id and picture name----------------
//Dashboard Background
#define COMPONENT_DASHBOARD_PIC_BACKGROUND_WITH_C 20
#define COMPONENT_DASHBOARD_PIC_BACKGROUND 21 //use this
#define COMPONENT_DASHBOARD_PIC_BACKGROUND_REFERENCE 22
//System Toggle Button
#define COMPONENT_DASHBOARD_PIC_SYSTEM_TOGGLE_OFF 23
#define COMPONENT_DASHBOARD_PIC_SYSTEM_TOGGLE_OFF_PRESSED 24
#define COMPONENT_DASHBOARD_PIC_SYSTEM_TOGGLE_ON 25
#define COMPONENT_DASHBOARD_PIC_SYSTEM_TOGGLE_ON_PRESSED 26
//AC Temperature Minus
#define COMPONENT_DASHBOARD_PIC_AC_TEMP_MINUS 27
#define COMPONENT_DASHBOARD_PIC_AC_TEMP_MINUS_PRESSED 28
//AC Temperature Plus
#define COMPONENT_DASHBOARD_PIC_AC_TEMP_PLUS 29
#define COMPONENT_DASHBOARD_PIC_AC_TEMP_PLUS_PRESSED 30
//AC Mode Cool
#define COMPONENT_DASHBOARD_PIC_AC_MODE_COOL_OFF 31
#define COMPONENT_DASHBOARD_PIC_AC_MODE_COOL_OFF_PRESSED 32
#define COMPONENT_DASHBOARD_PIC_AC_MODE_COOL_ON 33
#define COMPONENT_DASHBOARD_PIC_AC_MODE_COOL_ON_PRESSED 34
//AC Mode Dry
#define COMPONENT_DASHBOARD_PIC_AC_MODE_DRY_OFF 35
#define COMPONENT_DASHBOARD_PIC_AC_MODE_DRY_OFF_PRESSED 36
#define COMPONENT_DASHBOARD_PIC_AC_MODE_DRY_ON 37
#define COMPONENT_DASHBOARD_PIC_AC_MODE_DRY_ON_PRESSED 38
//AC Mode Fan
#define COMPONENT_DASHBOARD_PIC_AC_MODE_FAN_OFF 39
#define COMPONENT_DASHBOARD_PIC_AC_MODE_FAN_OFF_PRESSED 40
#define COMPONENT_DASHBOARD_PIC_AC_MODE_FAN_ON 41
#define COMPONENT_DASHBOARD_PIC_AC_MODE_FAN_ON_PRESSED 42
//AC Fan Speed Auto
#define COMPONENT_DASHBOARD_PIC_AC_FAN_AUTO_OFF 43
#define COMPONENT_DASHBOARD_PIC_AC_FAN_AUTO_OFF_PRESSED 44
#define COMPONENT_DASHBOARD_PIC_AC_FAN_AUTO_ON 45
#define COMPONENT_DASHBOARD_PIC_AC_FAN_AUTO_ON_PRESSED 46
//AC Fan Speed High
#define COMPONENT_DASHBOARD_PIC_AC_FAN_HIGH_OFF 47
#define COMPONENT_DASHBOARD_PIC_AC_FAN_HIGH_OFF_PRESSED 48
#define COMPONENT_DASHBOARD_PIC_AC_FAN_HIGH_ON 49
#define COMPONENT_DASHBOARD_PIC_AC_FAN_HIGH_ON_PRESSED 50
//AC Fan Speed Mid
#define COMPONENT_DASHBOARD_PIC_AC_FAN_MID_OFF 51
#define COMPONENT_DASHBOARD_PIC_AC_FAN_MID_OFF_PRESSED 52
#define COMPONENT_DASHBOARD_PIC_AC_FAN_MID_ON 53
#define COMPONENT_DASHBOARD_PIC_AC_FAN_MID_ON_PRESSED 54
//AC Fan Speed Low
#define COMPONENT_DASHBOARD_PIC_AC_FAN_LOW_OFF 55
#define COMPONENT_DASHBOARD_PIC_AC_FAN_LOW_OFF_PRESSED 56
#define COMPONENT_DASHBOARD_PIC_AC_FAN_LOW_ON 57
#define COMPONENT_DASHBOARD_PIC_AC_FAN_LOW_ON_PRESSED 58
//AC Toggle Button
#define COMPONENT_DASHBOARD_PIC_AC_TOGGLE_OFF 59
#define COMPONENT_DASHBOARD_PIC_AC_TOGGLE_OFF_PRESSED 60
#define COMPONENT_DASHBOARD_PIC_AC_TOGGLE_ON 61
#define COMPONENT_DASHBOARD_PIC_AC_TOGGLE_ON_PRESSED 62
//PM Toggle Button
#define COMPONENT_DASHBOARD_PIC_PM_TOGGLE_OFF 63
#define COMPONENT_DASHBOARD_PIC_PM_TOGGLE_OFF_PRESSED 64
#define COMPONENT_DASHBOARD_PIC_PM_TOGGLE_ON 65
#define COMPONENT_DASHBOARD_PIC_PM_TOGGLE_ON_PRESSED 66
//Light Switch Button
#define COMPONENT_DASHBOARD_PIC_LIGHT_SWITCH_OFF 67
#define COMPONENT_DASHBOARD_PIC_LIGHT_SWITCH_OFF_PRESSED 68
#define COMPONENT_DASHBOARD_PIC_LIGHT_SWITCH_ON 69
#define COMPONENT_DASHBOARD_PIC_LIGHT_SWITCH_ON_PRESSED 70
//Light Row Level
#define COMPONENT_DASHBOARD_PIC_LIGHT_ROW_LEVEL_0 71
#define COMPONENT_DASHBOARD_PIC_LIGHT_ROW_LEVEL_1 72
#define COMPONENT_DASHBOARD_PIC_LIGHT_ROW_LEVEL_2 73
#define COMPONENT_DASHBOARD_PIC_LIGHT_ROW_LEVEL_3 74
//Light Master Switch Button
#define COMPONENT_DASHBOARD_PIC_LIGHT_MASTER_OFF 75
#define COMPONENT_DASHBOARD_PIC_LIGHT_MASTER_OFF_PRESSED 76
#define COMPONENT_DASHBOARD_PIC_LIGHT_MASTER_ON 77
#define COMPONENT_DASHBOARD_PIC_LIGHT_MASTER_ON_PRESSED 78
//Light Master Level
#define COMPONENT_DASHBOARD_PIC_LIGHT_MASTER_LEVEL_D 79
#define COMPONENT_DASHBOARD_PIC_LIGHT_MASTER_LEVEL_0 80
#define COMPONENT_DASHBOARD_PIC_LIGHT_MASTER_LEVEL_1 81
#define COMPONENT_DASHBOARD_PIC_LIGHT_MASTER_LEVEL_2 82
#define COMPONENT_DASHBOARD_PIC_LIGHT_MASTER_LEVEL_3 83
//Lock Pic
#define COMPONENT_DASHBOARD_PIC_LOCK 84
#define COMPONENT_DASHBOARD_PIC_UNLOCK 85
//Degree Pic
#define COMPONENT_DASHBOARD_PIC_DEGREE_C_OFF 86
#define COMPONENT_DASHBOARD_PIC_DEGREE_C_ON 87
//-----------------DECAPRICATED----------------
//boot page
//logo gmov boot
#define COMPONENT_LOGO_BOOT 1
#define COMPONENT_LOGO_BOOT_VID 1
#define OLD_COMP_LOGO_BOOT 1
#define OLD_COMP_LOGO_BOOT_VID 1
//boot background
#define COMPONENT_BACKGROUND_BOOT_PIC 43
#define OLD_COMP_BACKGROUND_BOOT_PIC 43
//standby page object id
#define COMPONENT_LOGO_STANDBY 1
#define COMPONENT_LOGO_STANDBY_VID 2
#define OLD_COMP_LOGO_STANDBY 1
#define OLD_COMP_LOGO_STANDBY_VID 2
#define COMPONENT_STANDBY_OPEN_ALL_TOGGLE 2
#define COMPONENT_STANDBY_LIGHT_TOGGLE 3
#define COMPONENT_STANDBY_AC_TOGGLE 4
#define COMPONENT_STANDBY_PM_TOGGLE 5
#define OLD_COMP_STANDBY_OPEN_ALL_TOGGLE 2
#define OLD_COMP_STANDBY_LIGHT_TOGGLE 3
#define OLD_COMP_STANDBY_AC_TOGGLE 4
#define OLD_COMP_STANDBY_PM_TOGGLE 5
//text
#define COMPONENT_STANDBY_TIME_TXT 6
#define COMPONENT_STANDBY_DATE_TXT 7
#define COMPONENT_STANDBY_OUTSIDE_TEMP_TXT 8
#define OLD_COMP_STANDBY_TIME_TXT 6
#define OLD_COMP_STANDBY_DATE_TXT 7
#define OLD_COMP_STANDBY_OUTSIDE_TEMP_TXT 8
#define COMPONENT_STANDBY_TIMER 9
#define COMPONENT_STANDBY_WEATHER_ICON 10
#define OLD_COMP_STANDBY_TIMER 9
#define OLD_COMP_STANDBY_WEATHER_ICON 10
//standby page picture id
#define COMPONENT_BACKGROUND_PIC 44
#define COMPONENT_BACKGROUND_REFERENCE_PIC 45
#define OLD_COMP_BACKGROUND_PIC 44
#define OLD_COMP_BACKGROUND_REFERENCE_PIC 45
#define COMPONENT_STANDBY_OPEN_ALL_TOGGLE_PIC_OFF 46
#define COMPONENT_STANDBY_OPEN_ALL_TOGGLE_PIC_OFF_PRESSED 47
#define COMPONENT_STANDBY_OPEN_ALL_TOGGLE_PIC_ON 48
#define COMPONENT_STANDBY_OPEN_ALL_TOGGLE_PIC_ON_PRESSED 49
#define OLD_COMP_STANDBY_OPEN_ALL_TOGGLE_PIC_OFF 46
#define OLD_COMP_STANDBY_OPEN_ALL_TOGGLE_PIC_OFF_PRESSED 47
#define OLD_COMP_STANDBY_OPEN_ALL_TOGGLE_PIC_ON 48
#define OLD_COMP_STANDBY_OPEN_ALL_TOGGLE_PIC_ON_PRESSED 49
#define COMPONENT_STANDBY_AC_PIC_OFF 50
#define COMPONENT_STANDBY_AC_PIC_OFF_PRESSED 51
#define COMPONENT_STANDBY_AC_PIC_ON 52
#define COMPONENT_STANDBY_AC_PIC_ON_PRESSED 53
#define OLD_COMP_STANDBY_AC_PIC_OFF 50
#define OLD_COMP_STANDBY_AC_PIC_OFF_PRESSED 51
#define OLD_COMP_STANDBY_AC_PIC_ON 52
#define OLD_COMP_STANDBY_AC_PIC_ON_PRESSED 53
#define COMPONENT_STANDBY_LIGHT_PIC_OFF 54
#define COMPONENT_STANDBY_LIGHT_PIC_OFF_PRESSED 55
#define COMPONENT_STANDBY_LIGHT_PIC_ON 56
#define COMPONENT_STANDBY_LIGHT_PIC_ON_PRESSED 57
#define OLD_COMP_STANDBY_LIGHT_PIC_OFF 54
#define OLD_COMP_STANDBY_LIGHT_PIC_OFF_PRESSED 55
#define OLD_COMP_STANDBY_LIGHT_PIC_ON 56
#define OLD_COMP_STANDBY_LIGHT_PIC_ON_PRESSED 57
#define COMPONENT_STANDBY_PM_PIC_OFF 58
#define COMPONENT_STANDBY_PM_PIC_OFF_PRESSED 59
#define COMPONENT_STANDBY_PM_PIC_ON 60
#define COMPONENT_STANDBY_PM_PIC_ON_PRESSED 61
#define OLD_COMP_STANDBY_PM_PIC_OFF 58
#define OLD_COMP_STANDBY_PM_PIC_OFF_PRESSED 59
#define OLD_COMP_STANDBY_PM_PIC_ON 60
#define OLD_COMP_STANDBY_PM_PIC_ON_PRESSED 61
#define COMPONENT_REFERENCE_BACKGROUND_PIC 62
#define OLD_COMP_REFERENCE_BACKGROUND_PIC 62
//dashboard page
//dashboard page object id
#define COMPONENT_AC_TOGGLE_BUTTON 3
#define COMPONENT_AC_MODE 4
#define COMPONENT_AC_FAN_SPEED 5
#define COMPONENT_AC_TEMP_DOWN_BUTTON 6
#define COMPONENT_AC_TEMP_UP_BUTTON 7
#define OLD_COMP_AC_TOGGLE_BUTTON 3
#define OLD_COMP_AC_MODE 4
#define OLD_COMP_AC_FAN_SPEED 5
#define OLD_COMP_AC_TEMP_DOWN_BUTTON 6
#define OLD_COMP_AC_TEMP_UP_BUTTON 7
#define COMPONENT_PM_TOGGLE_BUTTON 8
#define COMPONENT_PM_FAN_SPEED_DECREASE 9
#define COMPONENT_PM_FAN_SPEED_INCREASE 10
#define OLD_COMP_PM_TOGGLE_BUTTON 8
#define OLD_COMP_PM_FAN_SPEED_DECREASE 9
#define OLD_COMP_PM_FAN_SPEED_INCREASE 10
#define COMPONENT_PM_INSIDE_TXT 11
#define COMPONENT_PM_OUTSIDE_TXT 12
#define OLD_COMP_PM_INSIDE_TXT 11
#define OLD_COMP_PM_OUTSIDE_TXT 12
#define COMPONENT_LIGHT_MASTER_BUTTON 13
#define COMPONENT_LIGHT_ROW1_PIC_PLACEHOLDER 14
#define COMPONENT_LIGHT_ROW2_PIC_PLACEHOLDER 15
#define COMPONENT_LIGHT_ROW3_PIC_PLACEHOLDER 16
#define COMPONENT_LIGHT_ROW4_PIC_PLACEHOLDER 17
#define OLD_COMP_LIGHT_MASTER_BUTTON 13
#define OLD_COMP_LIGHT_ROW1_PIC_PLACEHOLDER 14
#define OLD_COMP_LIGHT_ROW2_PIC_PLACEHOLDER 15
#define OLD_COMP_LIGHT_ROW3_PIC_PLACEHOLDER 16
#define OLD_COMP_LIGHT_ROW4_PIC_PLACEHOLDER 17
#define COMPONENT_LIGHT_MASTER_LEVEL1_TOUCHPOINT 18
#define COMPONENT_LIGHT_MASTER_LEVEL2_TOUCHPOINT 19
#define COMPONENT_LIGHT_MASTER_LEVEL3_TOUCHPOINT 20
#define OLD_COMP_LIGHT_MASTER_LEVEL1_TOUCHPOINT 18
#define OLD_COMP_LIGHT_MASTER_LEVEL2_TOUCHPOINT 19
#define OLD_COMP_LIGHT_MASTER_LEVEL3_TOUCHPOINT 20
#define COMPONENT_DASHBOARD_TIME_TXT 21
#define COMPONENT_DASHBOARD_DATE_TXT 22
#define COMPONENT_DASHBOARD_OUTSIDE_TEMP_TXT 23
#define OLD_COMP_DASHBOARD_TIME_TXT 21
#define OLD_COMP_DASHBOARD_DATE_TXT 22
#define OLD_COMP_DASHBOARD_OUTSIDE_TEMP_TXT 23
#define COMPONENT_LIGHT_ROW1_SLIDER 24
#define COMPONENT_LIGHT_ROW2_SLIDER 25
#define COMPONENT_LIGHT_ROW3_SLIDER 26
#define COMPONENT_LIGHT_ROW4_SLIDER 27
#define OLD_COMP_LIGHT_ROW1_SLIDER 24
#define OLD_COMP_LIGHT_ROW2_SLIDER 25
#define OLD_COMP_LIGHT_ROW3_SLIDER 26
#define OLD_COMP_LIGHT_ROW4_SLIDER 27
#define COMPONENT_LIGHT_ROW1_SWITCH 28
#define COMPONENT_LIGHT_ROW2_SWITCH 29
#define COMPONENT_LIGHT_ROW3_SWITCH 30
#define COMPONENT_LIGHT_ROW4_SWITCH 31
#define OLD_COMP_LIGHT_ROW1_SWITCH 28
#define OLD_COMP_LIGHT_ROW2_SWITCH 29
#define OLD_COMP_LIGHT_ROW3_SWITCH 30
#define OLD_COMP_LIGHT_ROW4_SWITCH 31
#define COMPONENT_DASHBOARD_WEATHER_ICON 32
#define OLD_COMP_DASHBOARD_WEATHER_ICON 32
//dashboard page picture id
#define COMPONENT_DASHBOARD_REFERENCE_BACKGROUND_PIC 0
#define COMPONENT_DASHBOARD_BACKGROUND_PIC 1
#define COMPONENT_DASHBOARD_BACKGROUND_VARIANT_PIC 2
#define OLD_COMP_DASHBOARD_REFERENCE_BACKGROUND_PIC 0
#define OLD_COMP_DASHBOARD_BACKGROUND_PIC 1
#define OLD_COMP_DASHBOARD_BACKGROUND_VARIANT_PIC 2
//AC on/off
#define COMPONENT_AC_TOGGLE_PIC_OFF 3
#define COMPONENT_AC_TOGGLE_PIC_OFF_PRESSED 4
#define COMPONENT_AC_TOGGLE_PIC_ON 5
#define COMPONENT_AC_TOGGLE_PIC_ON_PRESSED 6
#define COMPONENT_AC_TEMP_DOWN_PIC 7
#define COMPONENT_AC_TEMP_DOWN_PIC_PRESSED 8
#define COMPONENT_AC_TEMP_UP_PIC 9
#define COMPONENT_AC_TEMP_UP_PIC_PRESSED 10
#define OLD_COMP_AC_TOGGLE_PIC_OFF 3
#define OLD_COMP_AC_TOGGLE_PIC_OFF_PRESSED 4
#define OLD_COMP_AC_TOGGLE_PIC_ON 5
#define OLD_COMP_AC_TOGGLE_PIC_ON_PRESSED 6
#define OLD_COMP_AC_TEMP_DOWN_PIC 7
#define OLD_COMP_AC_TEMP_DOWN_PIC_PRESSED 8
#define OLD_COMP_AC_TEMP_UP_PIC 9
#define OLD_COMP_AC_TEMP_UP_PIC_PRESSED 10
#define COMPONENT_AC_FAN_MODE_AUTO_PIC 11
#define COMPONENT_AC_FAN_MODE_AUTO_PIC_PRESSED 12
#define COMPONENT_AC_FAN_MODE_HIGH_PIC 13
#define COMPONENT_AC_FAN_MODE_HIGH_PIC_PRESSED 14
#define COMPONENT_AC_FAN_MODE_MID_PIC 15
#define COMPONENT_AC_FAN_MODE_MID_PIC_PRESSED 16
#define COMPONENT_AC_FAN_MODE_LOW_PIC 17
#define COMPONENT_AC_FAN_MODE_LOW_PIC_PRESSED 18
#define OLD_COMP_AC_FAN_MODE_AUTO_PIC 11
#define OLD_COMP_AC_FAN_MODE_AUTO_PIC_PRESSED 12
#define OLD_COMP_AC_FAN_MODE_HIGH_PIC 13
#define OLD_COMP_AC_FAN_MODE_HIGH_PIC_PRESSED 14
#define OLD_COMP_AC_FAN_MODE_MID_PIC 15
#define OLD_COMP_AC_FAN_MODE_MID_PIC_PRESSED 16
#define OLD_COMP_AC_FAN_MODE_LOW_PIC 17
#define OLD_COMP_AC_FAN_MODE_LOW_PIC_PRESSED 18
#define COMPONENT_AC_MODE_DRY_PIC 19
#define COMPONENT_AC_MODE_DRY_PIC_PRESSED 20
#define COMPONENT_AC_MODE_COOL_PIC 21
#define COMPONENT_AC_MODE_COOL_PIC_PRESSED 22
#define COMPONENT_AC_MODE_FAN_PIC 23
#define COMPONENT_AC_MODE_FAN_PIC_PRESSED 24
#define OLD_COMP_AC_MODE_DRY_PIC 19
#define OLD_COMP_AC_MODE_DRY_PIC_PRESSED 20
#define OLD_COMP_AC_MODE_COOL_PIC 21
#define OLD_COMP_AC_MODE_COOL_PIC_PRESSED 22
#define OLD_COMP_AC_MODE_FAN_PIC 23
#define OLD_COMP_AC_MODE_FAN_PIC_PRESSED 24
//pm; air purifier
#define COMPONENT_PM_TOGGLE_PIC_OFF 25
#define COMPONENT_PM_TOGGLE_PIC_OFF_PRESSED 26
#define COMPONENT_PM_TOGGLE_PIC_ON 27
#define COMPONENT_PM_TOGGLE_PIC_ON_PRESSED 28
#define OLD_COMP_PM_TOGGLE_PIC_OFF 25
#define OLD_COMP_PM_TOGGLE_PIC_OFF_PRESSED 26
#define OLD_COMP_PM_TOGGLE_PIC_ON 27
#define OLD_COMP_PM_TOGGLE_PIC_ON_PRESSED 28
#define COMPONENT_PM_FAN_SPEED_DECREASE_PIC 29
#define COMPONENT_PM_FAN_SPEED_DECREASE_PIC_PRESSED 30
#define COMPONENT_PM_FAN_SPEED_INCREASE_PIC 31
#define COMPONENT_PM_FAN_SPEED_INCREASE_PIC_PRESSED 32
#define OLD_COMP_PM_FAN_SPEED_DECREASE_PIC 29
#define OLD_COMP_PM_FAN_SPEED_DECREASE_PIC_PRESSED 30
#define OLD_COMP_PM_FAN_SPEED_INCREASE_PIC 31
#define OLD_COMP_PM_FAN_SPEED_INCREASE_PIC_PRESSED 32
//AC status indicator
#define COMPONENT_AC_STATUS_OFF 33
#define COMPONENT_AC_STATUS_ON 34
#define OLD_COMP_AC_STATUS_OFF 33
#define OLD_COMP_AC_STATUS_ON 34
//light master
#define COMPONENT_LIGHT_MASTER_OFF 35
#define COMPONENT_LIGHT_MASTER_OFF_PRESSED 36
#define COMPONENT_LIGHT_MASTER_ON 37
#define COMPONENT_LIGHT_MASTER_ON_PRESSED 38
#define OLD_COMP_LIGHT_MASTER_OFF 35
#define OLD_COMP_LIGHT_MASTER_OFF_PRESSED 36
#define OLD_COMP_LIGHT_MASTER_ON 37
#define OLD_COMP_LIGHT_MASTER_ON_PRESSED 38
//light level component
#define COMPONENT_LIGHT_LEVEL_0 39
#define COMPONENT_LIGHT_LEVEL_1 40
#define COMPONENT_LIGHT_LEVEL_2 41
#define COMPONENT_LIGHT_LEVEL_3 42
#define OLD_COMP_LIGHT_LEVEL_0 39
#define OLD_COMP_LIGHT_LEVEL_1 40
#define OLD_COMP_LIGHT_LEVEL_2 41
#define OLD_COMP_LIGHT_LEVEL_3 42
//weather icon legend
#define COMPONENT_WEATHER_ICON_FAIR_DAY 63
#define COMPONENT_WEATHER_ICON_FAIR_NIGHT 64
#define COMPONENT_WEATHER_ICON_CLOUDY 65
#define COMPONENT_WEATHER_ICON_CLEARSKY_DAY 66
#define COMPONENT_WEATHER_ICON_CLEARSKY_NIGHT 67
#define COMPONENT_WEATHER_ICON_PARTLYCLOUDY_DAY 68
#define COMPONENT_WEATHER_ICON_PARTLYCLOUDY_NIGHT 69
#define COMPONENT_WEATHER_ICON_HEAVY_RAIN 70
#define COMPONENT_WEATHER_ICON_HEAVY_RAIN_AND_THUNDER 71
#define COMPONENT_WEATHER_ICON_RAIN_AND_THUNDER 72
#define COMPONENT_WEATHER_ICON_RAIN 73
#define COMPONENT_WEATHER_ICON_LIGHT_RAIN 74
#define COMPONENT_WEATHER_ICON_FOG 75
#define OLD_COMP_WEATHER_ICON_FAIR_DAY 63
#define OLD_COMP_WEATHER_ICON_FAIR_NIGHT 64
#define OLD_COMP_WEATHER_ICON_CLOUDY 65
#define OLD_COMP_WEATHER_ICON_CLEARSKY_DAY 66
#define OLD_COMP_WEATHER_ICON_CLEARSKY_NIGHT 67
#define OLD_COMP_WEATHER_ICON_PARTLYCLOUDY_DAY 68
#define OLD_COMP_WEATHER_ICON_PARTLYCLOUDY_NIGHT 69
#define OLD_COMP_WEATHER_ICON_HEAVY_RAIN 70
#define OLD_COMP_WEATHER_ICON_HEAVY_RAIN_AND_THUNDER 71
#define OLD_COMP_WEATHER_ICON_RAIN_AND_THUNDER 72
#define OLD_COMP_WEATHER_ICON_RAIN 73
#define OLD_COMP_WEATHER_ICON_LIGHT_RAIN 74
#define OLD_COMP_WEATHER_ICON_FOG 75
//need to toggle 4 row of light independently and have one master switch that can control all

View file

@ -6,15 +6,15 @@
***********************************************/
// Analog Card & Current Transformer Configuration
bool analogCardAvailable = false;
AnalogCard analogCard = AnalogCard();
float voltage = CT_RMS_VOLTAGE;
CurrentTransformerCard ct1 = CurrentTransformerCard(&analogCard, 0, &voltage, &adc2current, 5000);
CurrentTransformerCard ct2 = CurrentTransformerCard(&analogCard, 1, &voltage, &adc2current, 5000);
CurrentTransformerCard ct3 = CurrentTransformerCard(&analogCard, 2, &voltage, &adc2current, 5000);
CurrentTransformerCard ct4 = CurrentTransformerCard(&analogCard, 3, &voltage, &adc2current, 5000);
CurrentTransformerCard ct5 = CurrentTransformerCard(&analogCard, 4, &voltage, &adc2current, 5000);
CurrentTransformerCard ct6 = CurrentTransformerCard(&analogCard, 5, &voltage, &adc2current, 5000);
// bool analogCardAvailable = false;
// AnalogCard analogCard = AnalogCard();
// float voltage = CT_RMS_VOLTAGE;
// CurrentTransformerCard ct1 = CurrentTransformerCard(&analogCard, 0, &voltage, &adc2current, 5000);
// CurrentTransformerCard ct2 = CurrentTransformerCard(&analogCard, 1, &voltage, &adc2current, 5000);
// CurrentTransformerCard ct3 = CurrentTransformerCard(&analogCard, 2, &voltage, &adc2current, 5000);
// CurrentTransformerCard ct4 = CurrentTransformerCard(&analogCard, 3, &voltage, &adc2current, 5000);
// CurrentTransformerCard ct5 = CurrentTransformerCard(&analogCard, 4, &voltage, &adc2current, 5000);
// CurrentTransformerCard ct6 = CurrentTransformerCard(&analogCard, 5, &voltage, &adc2current, 5000);
// Remote Variables
RemoteVariable pm25_in = RemoteVariable();
@ -23,6 +23,8 @@ RemoteVariable temp_out = RemoteVariable();
RemoteVariable weather = RemoteVariable();
RemoteVariable pm_switch = RemoteVariable();
RemoteVariable pm_fan_speed = RemoteVariable();
RemoteVariable pm_lock = RemoteVariable();
RemoteVariable ac_lock = RemoteVariable();
float adc2current(uint16_t adc_val) {
return adc_val * 1.0;
@ -45,8 +47,8 @@ const char *mode_names_york[] = {"off", "cool", "fan_only"};
const char *fan_speed_names[] = {"auto", "high", "medium", "low"};
AirConditioner ac_daikin = {
.max_temperature = 30,
.min_temperature = 18,
.max_temperature = DAIKIN_MAX_TEMP,
.min_temperature = DAIKIN_MIN_TEMP,
.modes = 4,
.mode_names = mode_names_daikin,
.fan_speeds = 4,
@ -54,8 +56,8 @@ AirConditioner ac_daikin = {
.getInfraredCode = &getInfraredCode_daikin};
AirConditioner ac_york = {
.max_temperature = 30,
.min_temperature = 18,
.max_temperature = YORK_MAX_TEMP,
.min_temperature = YORK_MIN_TEMP,
.modes = 3,
.mode_names = mode_names_york,
.fan_speeds = 4,
@ -121,17 +123,6 @@ void setup()
espmega.inputs.setDebounceTime(i,200);
}
// if (clear_fram)
// {
// Serial.print("boot_state.txt=\"Factory Resetting . . .\"");
// sendStopBytes();
// for (uint16_t i = 0; i < 32768; i++)
// {
// espmega.fram.write8(i, 0);
// }
// esp_restart();
// }
// // ------------ End Factory Reset Routine ------------
@ -174,37 +165,29 @@ void setup()
climateCard_daikin.setFRAMAutoSave(true);
espmega.display->bindClimateCard(&climateCard_daikin);
// Current Transformers
espmega.installCard(4, &analogCard);
// // Current Transformers
// espmega.installCard(4, &analogCard);
espmega.installCard(5, &ct1);
ct1.bindFRAM(&espmega.fram, 6000);
espmega.iot->registerCard(5);
// espmega.installCard(5, &ct1);
// ct1.bindFRAM(&espmega.fram, 6000);
// espmega.iot->registerCard(5);
espmega.installCard(6, &ct2);
ct2.bindFRAM(&espmega.fram, 6100);
espmega.iot->registerCard(6);
espmega.installCard(7, &ct3);
ct3.bindFRAM(&espmega.fram, 6200);
espmega.iot->registerCard(7);
espmega.installCard(8, &ct4);
ct4.bindFRAM(&espmega.fram, 6300);
espmega.iot->registerCard(8);
espmega.installCard(9, &ct5);
ct5.bindFRAM(&espmega.fram, 6400);
espmega.iot->registerCard(9);
espmega.installCard(10, &ct6);
ct6.bindFRAM(&espmega.fram, 6500);
espmega.iot->registerCard(10);
// auto binded_display_update_on_pm25_out = std::bind(&display_update,0,std::placeholders::_1);
// auto binded_display_update_on_pm25_in = std::bind(&display_update,1,std::placeholders::_1);
// auto binded_display_update_on_temp_out = std::bind(&display_update,2,std::placeholders::_1);
// auto binded_display_update_on_weather = std::bind(&display_update,3,std::placeholders::_1);
// auto binded_display_update_on_pm_switch = std::bind(&display_update,4,std::placeholders::_1);
// auto binded_display_update_on_pm_fan_speed = std::bind(&display_update,5,std::placeholders::_1);
// espmega.installCard(6, &ct2);
// ct2.bindFRAM(&espmega.fram, 6100);
// espmega.iot->registerCard(6);
// espmega.installCard(7, &ct3);
// ct3.bindFRAM(&espmega.fram, 6200);
// espmega.iot->registerCard(7);
// espmega.installCard(8, &ct4);
// ct4.bindFRAM(&espmega.fram, 6300);
// espmega.iot->registerCard(8);
// espmega.installCard(9, &ct5);
// ct5.bindFRAM(&espmega.fram, 6400);
// espmega.iot->registerCard(9);
// espmega.installCard(10, &ct6);
// ct6.bindFRAM(&espmega.fram, 6500);
// espmega.iot->registerCard(10);
// ------------ Climate Cards Initialization Routine ------------
ESP_LOGD("ISE OS", "Setting up climate cards");
@ -227,40 +210,40 @@ void setup()
// ------------ End Climate Cards Initialization Routine ------------
// ------------ Current Transformer Cards Initialization Routine ------------
ESP_LOGD("ISE OS", "Installing current transformer cards");
//ESP_LOGD("ISE OS", "Installing current transformer cards");
// First try to install the analog card
analogCardAvailable = espmega.installCard(4, &analogCard);
//analogCardAvailable = espmega.installCard(4, &analogCard);
// If the analog card is available, install the current transformer cards
// If the analog card is not available, current transformer cards will not be installed
// Unless CT_FORCE_ENABLE is set to true
// This is to prevent soft locking the device when the device tries to read from an ADC channel that does not exist
if (analogCardAvailable || CT_FORCE_ENABLE)
{
ESP_LOGV("ISE OS", "Analog card available, installing current transformer cards");
espmega.installCard(5, &ct1);
ct1.bindFRAM(&espmega.fram, 5010);
espmega.installCard(6, &ct2);
ct2.bindFRAM(&espmega.fram, 5020);
espmega.installCard(7, &ct3);
ct3.bindFRAM(&espmega.fram, 5030);
espmega.installCard(8, &ct4);
ct4.bindFRAM(&espmega.fram, 5040);
espmega.installCard(9, &ct5);
ct5.bindFRAM(&espmega.fram, 5050);
espmega.installCard(10, &ct5);
ct6.bindFRAM(&espmega.fram, 5060);
espmega.iot->registerCard(5);
espmega.iot->registerCard(6);
espmega.iot->registerCard(7);
espmega.iot->registerCard(8);
espmega.iot->registerCard(9);
espmega.iot->registerCard(10);
}
else
{
ESP_LOGE("ISE OS", "Analog card not available, current transformer cards cannot and will not be installed.");
}
ESP_LOGD("ISE OS", "Registering Current Transformer Cards with IoT Module");
// if (analogCardAvailable || CT_FORCE_ENABLE)
// {
// ESP_LOGV("ISE OS", "Analog card available, installing current transformer cards");
// // espmega.installCard(5, &ct1);
// // ct1.bindFRAM(&espmega.fram, 5010);
// // espmega.installCard(6, &ct2);
// // ct2.bindFRAM(&espmega.fram, 5020);
// // espmega.installCard(7, &ct3);
// // ct3.bindFRAM(&espmega.fram, 5030);
// // espmega.installCard(8, &ct4);
// // ct4.bindFRAM(&espmega.fram, 5040);
// // espmega.installCard(9, &ct5);
// // ct5.bindFRAM(&espmega.fram, 5050);
// // espmega.installCard(10, &ct5);
// // ct6.bindFRAM(&espmega.fram, 5060);
// espmega.iot->registerCard(5);
// espmega.iot->registerCard(6);
// espmega.iot->registerCard(7);
// espmega.iot->registerCard(8);
// espmega.iot->registerCard(9);
// espmega.iot->registerCard(10);
// }
// else
// {
// ESP_LOGE("ISE OS", "Analog card not available, current transformer cards cannot and will not be installed.");
// }
//ESP_LOGD("ISE OS", "Registering Current Transformer Cards with IoT Module")
// ------------ End Current Transformer Cards Initialization Routine ------------
@ -271,6 +254,9 @@ void setup()
weather.registerCallback(&weatherupdatedisplay);
pm_switch.registerCallback(&pmswitchupdatedisplay);
pm_fan_speed.registerCallback(&pmfanspeedupdatedisplay);
pm_lock.registerCallback(&pmlockupdatedisplay);
ac_lock.registerCallback(&aclockupdatedisplay);
// PM2.5 PPM Remote Variable
pm25_out.begin(6, "/aqi/value", espmega.iot, true, "/aqi/request_value");
@ -286,6 +272,12 @@ void setup()
// Air Purifier Fan Speed Remote Variable
pm_fan_speed.begin(6, "/pm/fan_speed", espmega.iot, true, "/pm/request_fan_speed");
pm_fan_speed.enableSetValue("/pm/set_fan_speed");
// Air Purifier Lock Remote Variable
pm_lock.begin(6, "/pm/lock_state", espmega.iot, true, "/pm/request_lock_pm_state");
pm_lock.enableSetValue("/pm/set_lock_pm_state");
// Air Conditioner Lock Remote Variable
ac_lock.begin(6, "/ac/lock_state", espmega.iot, true, "/ac/request_lock_ac_state");
ac_lock.enableSetValue("/ac/set_lock_ac_state");
// ------------ End Remote Variables Initialization Routine ------------
@ -299,7 +291,7 @@ void setup()
// ------------ External Display Initialization Routine ------------
auto bindedGetTime = std::bind(&ESPMegaPRO::getTime, &espmega);
iseDisplay.begin(&espmega.inputs, &espmega.outputs, &climateCard_daikin, &climateCard_york, &pm_switch, &pm_fan_speed);
iseDisplay.begin(&espmega.inputs, &espmega.outputs, &climateCard_daikin, &climateCard_york, &pm_switch, &pm_fan_speed, &pm_lock, &ac_lock, espmega.iot);
espmega.iot->registerRelativeMqttCallback(&handleMqttMessage);
iseDisplay.registerPageChangeCallback(&handlePageChange);
// ------------ End External Display Initialization Routine ------------
@ -315,11 +307,11 @@ void pm25inupdatedisplay(char *value)
}
void tempoutupdatedisplay(char *value)
{
iseDisplay.updateTempOutside(get_temp_out());
//iseDisplay.updateTempOutside(get_temp_out());
}
void weatherupdatedisplay(char *value)
{
iseDisplay.updateWeather(weather.getValue());
//iseDisplay.updateWeather(weather.getValue());
}
void pmfanspeedupdatedisplay(char *value)
{
@ -331,6 +323,18 @@ void pmswitchupdatedisplay(char *value)
iseDisplay.updateAirPurifierState();
ESP_LOGI("PM switch", "toggling PM switch state from: %d to %d", pm_switch.getValue(), !pm_switch.getValue());
}
void pmlockupdatedisplay(char *value)
{
ESP_LOGI("PM lock", "getting PM lock state from MQTT: %d", pm_lock.getValue());
iseDisplay.updateAirPurifierState();
ESP_LOGI("PM lock", "toggling PM lock state from: %d to %d", pm_lock.getValue(), !pm_lock.getValue());
}
void aclockupdatedisplay(char *value)
{
ESP_LOGI("AC lock", "getting AC lock state from MQTT: %d", ac_lock.getValue());
iseDisplay.updateACState();
ESP_LOGI("AC lock", "toggling AC lock state from: %d to %d", ac_lock.getValue(), !ac_lock.getValue());
}
void loop()
{
@ -418,6 +422,20 @@ uint8_t get_pm_fanspeed()
return pm_fan_speed_value;
}
bool get_pm_lock()
{
ESP_LOGI("PM lock", "getting PM lock state from MQTT: %d", pm_lock.getValue());
bool is_pm_lock_on = strcmp(pm_lock.getValue(), "on") == 0;
return is_pm_lock_on;
}
bool get_ac_lock()
{
ESP_LOGI("AC lock", "getting AC lock state from MQTT: %d", ac_lock.getValue());
bool is_ac_lock_on = strcmp(ac_lock.getValue(), "on") == 0;
return is_ac_lock_on;
}
/**
* @brief Get the PM switch state from home assistant
* @return true if the PM switch is on, false if the PM switch is off
@ -436,6 +454,20 @@ void toggle_pm_switch()
pm_switch.setValue(is_pm_switch_on ? "0" : "1");
}
void toggle_ac_lock()
{
bool is_ac_lock_on = get_ac_lock();
ESP_LOGI("AC lock", "toggling AC lock state from: %d to %d", is_ac_lock_on, !is_ac_lock_on);
ac_lock.setValue(is_ac_lock_on ? "0" : "1");
}
void toggle_pm_lock()
{
bool is_pm_lock_on = get_pm_lock();
ESP_LOGI("PM lock", "toggling PM lock state from: %d to %d", is_pm_lock_on, !is_pm_lock_on);
pm_lock.setValue(is_pm_lock_on ? "0" : "1");
}
void set_pm_fanspeed(uint8_t speed)
{
ESP_LOGI("PM fan speed", "setting PM fan speed to: %d", speed);
@ -458,6 +490,7 @@ void handlePageChange(uint8_t page)
case PAGE_DASHBOARD:
iseDisplay.updateLightGroupStatePageDashboard();
iseDisplay.updateAirPurifierState();
iseDisplay.updateSystemtoggle();
break;
default:
break;
@ -465,8 +498,8 @@ void handlePageChange(uint8_t page)
iseDisplay.updatePMoutside(get_pm25_out());
iseDisplay.updatePMinside(get_pm25_in());
iseDisplay.updateWeather(weather.getValue());
iseDisplay.updateTempOutside(get_temp_out());
//iseDisplay.updateWeather(weather.getValue());
//iseDisplay.updateTempOutside(get_temp_out());
iseDisplay.updateACState();
}

View file

@ -26,15 +26,15 @@ SET_LOOP_TASK_STACK_SIZE(32*1024);
#define AIR_CONDITIONER_RMT_CHANNEL0 RMT_CHANNEL_0
#define AIR_CONDITIONER_RMT_CHANNEL1 RMT_CHANNEL_1
// CT Configuration
#define CT_FORCE_ENABLE false
#define CT_RMS_VOLTAGE 1.0
#define CT_PIN_LIGHT_PHASE1 0
#define CT_PIN_LIGHT_PHASE2 1
#define CT_PIN_SOCKET 2
#define CT_PIN_AC_PHASE1 3
#define CT_PIN_AC_PHASE2 4
#define CT_PIN_AC_PHASE3 5
// // CT Configuration
// #define CT_FORCE_ENABLE false
// #define CT_RMS_VOLTAGE 1.0
// #define CT_PIN_LIGHT_PHASE1 0
// #define CT_PIN_LIGHT_PHASE2 1
// #define CT_PIN_SOCKET 2
// #define CT_PIN_AC_PHASE1 3
// #define CT_PIN_AC_PHASE2 4
// #define CT_PIN_AC_PHASE3 5
void handleMqttMessage(char *topic, char *payload);
void subscribeToMqttTopics();
@ -51,6 +51,10 @@ void on_pin_change(uint8_t pin, uint8_t value);
uint16_t get_pm25_out();
uint16_t get_pm25_in();
float get_temp_out();
bool get_pm_lock();
bool get_ac_lock();
void toggle_ac_lock();
void toggle_pm_lock();
void toggle_pm_switch();
void set_pm_fanspeed(uint8_t speed);
void display_update();
@ -59,5 +63,7 @@ void pm25inupdatedisplay(char* value);
void tempoutupdatedisplay(char* value);
void weatherupdatedisplay(char* value);
void pmfanspeedupdatedisplay(char* value);
void pmlockupdatedisplay(char* value);
void aclockupdatedisplay(char* value);
void pmswitchupdatedisplay(char* value);
float adc2current(uint16_t adc_val);