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

Fix remaining issues on shutterinvert #22120

Merged
merged 1 commit into from
Sep 10, 2024
Merged
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
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