Skip to content

Commit

Permalink
Fix remaining issues on shutterinvert (arendst#22120)
Browse files Browse the repository at this point in the history
found another place where the invert was not reported correctly
  • Loading branch information
stefanbode authored and hawa-lc4 committed Sep 16, 2024
1 parent 6041098 commit 2079f49
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tasmota/tasmota_xdrv_driver/xdrv_27_esp32_shutter.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
xdrv_27_esp32_shutter.ino - Shutter/Blind support for Tasmota
Copyright (C) 2023 Stefan Bode
Copyright (C) 2024 Stefan Bode
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -1356,7 +1356,8 @@ void ShutterUpdatePosition(void)
// sending MQTT result to broker
snprintf_P(scommand, sizeof(scommand),PSTR(D_SHUTTER "%d"), i + 1);
GetTopic_P(stopic, STAT, TasmotaGlobal.mqtt_topic, scommand);
Response_P("%d", ShutterSettings.shutter_position[i]);
uint32_t position = ShutterRealToPercentPosition(Shutter[i].real_position, i);
Response_P("%d", (ShutterSettings.shutter_options[i] & 1) ? 100 - position : position);
MqttPublish(stopic, Settings->flag.mqtt_power_retain); // CMND_POWERRETAIN
}

Expand Down Expand Up @@ -2332,11 +2333,13 @@ bool Xdrv27(uint32_t function)
for (uint8_t i = 0; i < TasmotaGlobal.shutters_present; i++) {
ResponseAppend_P(",");
uint8_t position = ShutterRealToPercentPosition(Shutter[i].real_position, i);
position = (ShutterSettings.shutter_options[i] & 1) ? 100 - position : position;
uint8_t target = ShutterRealToPercentPosition(Shutter[i].target_position, i);
ResponseAppend_P(JSON_SHUTTER_POS, i + 1, (ShutterSettings.shutter_options[i] & 1) ? 100 - position : position, Shutter[i].direction,(ShutterSettings.shutter_options[i] & 1) ? 100 - target : target, Shutter[i].tilt_real_pos );
target = (ShutterSettings.shutter_options[i] & 1) ? 100 - target : target;
ResponseAppend_P(JSON_SHUTTER_POS, i + 1, position, Shutter[i].direction, target, Shutter[i].tilt_real_pos );
#ifdef USE_DOMOTICZ
if ((0 == TasmotaGlobal.tele_period) && (0 == i)) {
DomoticzSensor(DZ_SHUTTER, ShutterRealToPercentPosition(Shutter[i].real_position, i));
DomoticzSensor(DZ_SHUTTER, position);
}
#endif // USE_DOMOTICZ
}
Expand Down

0 comments on commit 2079f49

Please sign in to comment.