try remotevar

This commit is contained in:
reaw55 2024-02-07 05:50:32 +07:00
parent ab759ef08e
commit 6c8638319e
5 changed files with 60 additions and 18 deletions

View file

@ -1,5 +1,5 @@
#include <ise_display.hpp>
ISEDisplay::ISEDisplay(HardwareSerial *adapter) : ESPMegaDisplay(adapter)
ISEDisplay::ISEDisplay(HardwareSerial *adapter) : ESPMegaDisplay(adapter, 115200, 912600, 4, 17)
{
}
// sat->sun
@ -254,21 +254,41 @@ void ISEDisplay::handlePWMChange(uint8_t pin, bool state, uint16_t value)
{
// NEED to switch case for different page
// Question: can add another input and placeholder for page differentation
// or that would mean changing the data structure of the callback
if (pin >= 1 && pin <= 4)
uint8_t current_page = this->currentPage;
if (current_page == PAGE_STANDBY)
{
// Light
updateLightGroupStatePageDashboard();
updateLightGroupStatePageStandby();
time_since_last_screen_update = millis(); // update time since last activity
if (pin >= 1 && pin <= 4)
{
// Light
updateLightGroupStatePageDashboard();
updateLightGroupStatePageStandby();
time_since_last_screen_update = millis(); // update time since last activity
}
else if (pin == 4 || pin == 5)
{
// Air Purifier
updateAirPurifierState();
time_since_last_screen_update = millis(); // update time since last activity
}
}
else if (pin == 4 || pin == 5)
else if (current_page == PAGE_DASHBOARD)
{
// Air Purifier
updateAirPurifierState();
time_since_last_screen_update = millis(); // update time since last activity
if (pin >= 1 && pin <= 4)
{
// Light
updateLightGroupStatePageStandby();
time_since_last_screen_update = millis(); // update time since last activity
}
else if (pin == 4 || pin == 5)
{
// Air Purifier
updateAirPurifierState();
time_since_last_screen_update = millis(); // update time since last activity
}
}
else
{
return;
}
}
void ISEDisplay::updateDateTimeText(rtctime_t time)
@ -295,16 +315,21 @@ void ISEDisplay::updateDateTimeText(rtctime_t time)
// appdeamon
void ISEDisplay::updateWeather(uint8_t weather_code, float outside_temp)
{
}
void ISEDisplay::updatePMoutside(float pm25_outside)
{
// TODO : use remotevar to get data from appdaemon and update the display
}
void ISEDisplay::updatePMinside(float pm25_inside)
{
// TODO : get data from HA's Xiaomi air purifier sensor
}
void ISEDisplay::setPMstate(bool is_pm_on, uint8_t pm_fan_speed)
{
// TODO : set data to HA's Xiaomi air purifier sensor
}
void ISEDisplay::setACstate(uint8_t ac_fan_speed, uint8_t ac_mode, uint8_t ac_temperature)
@ -364,8 +389,8 @@ void ISEDisplay::changeUserACmode()
}
else
{ // ie mode is off
// do nothing as the state is keep in user_mode
// the mode will change to user_mode when turn on by toggleAC()
// do nothing as the state is keep in user_mode
// the mode will change to user_mode when turn on by toggleAC()
}
updateuserACmode(); // call to update mode part of the display seperately
}