Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P093 Mitsubishi HeatPump - Add Remote Temperature #4809

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified before_deploy
100755 → 100644
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's desirable that you are adding these (empty) files, nor changing their permissions...

Empty file.
Empty file modified embed_files.sh
100755 → 100644
Empty file.
Empty file modified hooks/post-checkout
100755 → 100644
Empty file.
Empty file modified hooks/post-commit
100755 → 100644
Empty file.
Empty file modified hooks/post-merge
100755 → 100644
Empty file.
Empty file modified lib/LiquidCrystal_I2C/LiquidCrystal_I2C.cpp
100755 → 100644
Empty file.
Empty file modified lib/LiquidCrystal_I2C/LiquidCrystal_I2C.h
100755 → 100644
Empty file.
Empty file modified lib/LiquidCrystal_I2C/README.md
100755 → 100644
Empty file.
Empty file modified lib/LiquidCrystal_I2C/examples/CustomChars/CustomChars.pde
100755 → 100644
Empty file.
Empty file modified lib/LiquidCrystal_I2C/examples/HelloWorld/HelloWorld.pde
100755 → 100644
Empty file.
Empty file modified lib/LiquidCrystal_I2C/examples/SerialDisplay/SerialDisplay.pde
100755 → 100644
Empty file.
Empty file modified lib/LiquidCrystal_I2C/keywords.txt
100755 → 100644
Empty file.
Empty file modified lib/LiquidCrystal_I2C/library.json
100755 → 100644
Empty file.
Empty file modified lib/LiquidCrystal_I2C/library.properties
100755 → 100644
Empty file.
Empty file modified memanalyzer.py
100755 → 100644
Empty file.
Empty file modified patches/check_puya_patch
100755 → 100644
Empty file.
Empty file modified preflight.sh
100755 → 100644
Empty file.
Empty file modified release
100755 → 100644
Empty file.
Empty file modified releasebot
100755 → 100644
Empty file.
34 changes: 33 additions & 1 deletion src/src/PluginStructs/P093_data_struct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ bool P093_data_struct::read(String& result) const {
result += _currentValues.compressorFrequency;
}
result += F(",\"temperature\":");
result += toString(_currentValues.temperature, 1) + '}';
result += toString(_currentValues.temperature, 1);
result += F(",\"remoteTemperature\":");
result += toString(_currentValues.remoteTemperature, 1) + '}';

return true;
}
Expand Down Expand Up @@ -120,6 +122,9 @@ bool P093_data_struct::plugin_get_config_value(struct EventStruct *event,
} else
if (_includeStatus && equals(command, F("compressorfrequency"))) {
string = _currentValues.compressorFrequency;
} else
if (equals(command, F("remotetemperature"))) {
string = toString(_currentValues.remoteTemperature, 1);
} else {
success = false;
}
Expand Down Expand Up @@ -149,6 +154,13 @@ void P093_data_struct::write(const String& command, const String& value) {
_writeStatus.set(Vane);
} else if ((equals(command, F("widevane"))) && lookup(value, _mappings.wideVane, _wantedSettings.wideVane)) {
_writeStatus.set(WideVane);
} else if (equals(command, F("remotetemperature"))) {
float remotetemperature = 0;

if (string2float(value, remotetemperature)) {
_wantedSettings.remoteTemperature = remotetemperature;
_writeStatus.set(RemoteTemperature);
}
}

# undef lookup
Expand Down Expand Up @@ -294,6 +306,10 @@ void P093_data_struct::applySettingsLocally() {
if (_writeStatus.isDirty(WideVane)) {
_currentValues.wideVane = _wantedSettings.wideVane;
}

if (_writeStatus.isDirty(RemoteTemperature)) {
_currentValues.remoteTemperature = _wantedSettings.remoteTemperature;
}
}

void P093_data_struct::cancelWaitingAndTransitTo(P093_data_struct::State state) {
Expand Down Expand Up @@ -359,6 +375,22 @@ void P093_data_struct::applySettings() {
packet[7] |= 0x01;
}

if (_writeStatus.isDirty(RemoteTemperature)) {
packet[5] |= 0x07;
if(_wantedSettings.remoteTemperature > 0) {
packet[6] |= 0x01;
if (_tempMode) {
packet[8] = static_cast<uint8_t>(_wantedSettings.remoteTemperature * 2.0f + 128.0f);
} else {
packet[7] = _wantedSettings.remoteTemperature;
}
}
else {
packet[6] |= 0x00;
packet[8] |= 0x80; //MHK1 send 80, even though it could be 00, since ControlByte is 00
}
}

packet[21] = checkSum(packet, 21);

sendPacket(packet, PACKET_LEN);
Expand Down
16 changes: 10 additions & 6 deletions src/src/PluginStructs/P093_data_struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,13 @@ struct P093_data_struct : public PluginTaskData_base {
ReadTimeout
};

static const uint8_t Temperature = 0x01;
static const uint8_t Power = 0x02;
static const uint8_t Mode = 0x04;
static const uint8_t Fan = 0x08;
static const uint8_t Vane = 0x10;
static const uint8_t WideVane = 0x20;
static const uint8_t Temperature = 0x01;
static const uint8_t Power = 0x02;
static const uint8_t Mode = 0x04;
static const uint8_t Fan = 0x08;
static const uint8_t Vane = 0x10;
static const uint8_t WideVane = 0x20;
static const uint8_t RemoteTemperature = 0x07;

struct WriteStatus {
WriteStatus() : _flags(0) {}
Expand Down Expand Up @@ -158,6 +159,7 @@ struct P093_data_struct : public PluginTaskData_base {
uint8_t vane;
uint8_t wideVane;
float roomTemperature;
float remoteTemperature;
bool operating;
uint8_t compressorFrequency;

Expand All @@ -170,6 +172,7 @@ struct P093_data_struct : public PluginTaskData_base {
vane(0),
wideVane(0),
roomTemperature(0),
remoteTemperature(0),
operating(false),
compressorFrequency(0) {}

Expand All @@ -182,6 +185,7 @@ struct P093_data_struct : public PluginTaskData_base {
wideVane != rhs.wideVane ||
iSee != rhs.iSee ||
roomTemperature != rhs.roomTemperature ||
remoteTemperature != rhs.remoteTemperature ||
operating != rhs.operating ||
compressorFrequency != rhs.compressorFrequency;
}
Expand Down
Empty file modified test/espcli
100755 → 100644
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these (empty) files included?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got no idea? i will close this pr.. i went through the docs you told me and iam a closer to making it working. will do a new pr when its running on my esp. sorry for these troubles...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you just give me a hint how i can set up a test environement just for plugin p093 not to compile each time all plugins containing collection_d_esp8266_4m1m...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My usual mode of operation is to change the pre_custom_esp82xx.py file, adding/enabling the plugin I'm working on (don't include these changes in your PR please), and then build the PIO environment custom_ESP8266_4M1M.
After the initial full build, the next time it should only compile the changed files (it will always generate & compile ESPEasy.ino.c), plus a bunch of framework files (don't know yet how to suppress that 😞). That usually builds quite quick, but still depends on the speed of your computer.
The dependency checks by PIO are also a rather slow part of the process, not much we can do about that, other than throw more 'iron' at it 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, got it... Will try this for the next build :_) Thanks a lot for your help.. Am just a beginner ;-)

Empty file.
Empty file modified test/esptool.py
100755 → 100644
Empty file.
Empty file modified test/test000.py
100755 → 100644
Empty file.
Empty file modified test/test001.py
100755 → 100644
Empty file.
Empty file modified test/test002.py
100755 → 100644
Empty file.
Empty file modified test/test003.py
100755 → 100644
Empty file.
Empty file modified test/test004.py
100755 → 100644
Empty file.
Empty file modified test/test005.py
100755 → 100644
Empty file.
Empty file modified test/test006.py
100755 → 100644
Empty file.
Empty file modified test/testall
100755 → 100644
Empty file.
Empty file modified tools/build_ESPeasy.sh
100755 → 100644
Empty file.