-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 #4813
P093 Mitsubishi HeatPump #4813
Changes from 1 commit
98af072
cc14a49
ed4a0c2
0f042b6
d61506d
242051e
bb11167
516fd1a
92d33d0
06a2009
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
} | ||
|
@@ -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; | ||
} | ||
|
@@ -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 | ||
|
@@ -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) { | ||
|
@@ -362,6 +378,29 @@ void P093_data_struct::applySettings() { | |
packet[21] = checkSum(packet, 21); | ||
|
||
sendPacket(packet, PACKET_LEN); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I need Help here... When i put line 382 to 384
under line 404 remote temperature works, but not the other commands (line 347 to 380).. if these lines are like this the other commands work, but not remote temperature... What am I missing??? Sorry I am not a programmer, i try just to help myself out on an issue i opened long time ago... Thx for your help... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume you are moving those lines from 382-384 to below where the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes that´s right.. I also tried with another buffer called packet2, which is just handled after the if (_writeStatus.isDirty(RemoteTemperature)) section.. but same behaviour, i can set the hp on /off etc, but not the remote temp. I can just set remote temperature when it is buffer called packet behind if (_writeStatus.isDirty(RemoteTemperature))... |
||
if (_writeStatus.isDirty(RemoteTemperature)) { | ||
packet[PACKET_LEN] = {}; | ||
|
||
packet[5] |= 0x07; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An improvement might be to re-initialize the packet buffer by inserting |
||
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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this intended? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No it´s not intended, will be fixed... |
||
packet[8] |= 0x80; //MHK1 send 80, even though it could be 00, since ControlByte is 00 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original code has a simple assignment operator here, not an OR-assign, though effectively it doesn't make a difference, best would be to use just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, i wondered why in the whole code the or assignment was used... thats why i choose this on also for the modification.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this specific case it should be an assignment, the other places should keep |
||
} | ||
|
||
packet[21] = checkSum(packet, 21); | ||
|
||
sendPacket(packet, PACKET_LEN); | ||
} | ||
|
||
} | ||
|
||
void P093_data_struct::connect() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jfmennedy these flags are being used as a bitmap, not as a numeric value. If you change this to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will try this now.. saw this comment too late before my last commit and comment... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That´s it :-) It is working :-) Thank you sooooo much :-) |
||
|
||
struct WriteStatus { | ||
WriteStatus() : _flags(0) {} | ||
|
@@ -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; | ||
|
||
|
@@ -170,6 +172,7 @@ struct P093_data_struct : public PluginTaskData_base { | |
vane(0), | ||
wideVane(0), | ||
roomTemperature(0), | ||
remoteTemperature(0), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could be initialized with a float zero value: |
||
operating(false), | ||
compressorFrequency(0) {} | ||
|
||
|
@@ -182,6 +185,7 @@ struct P093_data_struct : public PluginTaskData_base { | |
wideVane != rhs.wideVane || | ||
iSee != rhs.iSee || | ||
roomTemperature != rhs.roomTemperature || | ||
remoteTemperature != rhs.remoteTemperature || | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here you can use a specific, more accurate, float compare function: |
||
operating != rhs.operating || | ||
compressorFrequency != rhs.compressorFrequency; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changelog is supposed to be from the top from new to old... 😉 I see why this one can be confusing, but the Start message should have been the giveaway 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modified ;-)