Closed udo1toni closed 6 years ago
the last message hints at the root of the evil. I have seen this -99 stuff also but then it went away without any reason. In the log, in the beginning, you can see the definition if the shutter with all parameters. Shutterinvert must be 1. Otherwise, it will not work as requested. I will check where the -99 came from
shutterinvert1 1 should do the job and also give a correct answer in the result. See code below.
else if (CMND_SHUTTERINVERT == command_code && (index > 0) && (index <= shutters_present)) {
if ( (XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 1)) {
Settings.shutter_invert[index-1] = XdrvMailbox.payload;
}
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_NVALUE, command, index, XdrvMailbox.payload);
}
13:36:53 CMD: shutterinvert1 1 13:36:53 MQT: sonoff_t9/stat/RESULT = {"shutterinvert1":1} 13:37:09 CMD: shutterinvert1 13:37:09 MQT: sonoff_t9/stat/RESULT = {"shutterinvert1":-99}
Ahh, no worries about this. The second one is a bug I just fixed right now. the shutterinvert is 1. Now back to your problem. Please post a logfile and tell we what you do. In the logfile open is 0 and close is 100. This will not change. Only in the UI and from the MQTT messages you send and receive just the opposite position. With shutterinvert not the internal calculation will change. Only the reporting changes.
Sure :) From console:
15:09:51 CMD: shutteropen1
15:09:51 MQT: sonoff_t9/stat/RESULT = {"POWER2":"ON"}
15:09:51 MQT: sonoff_t9/stat/POWER2 = ON
15:09:51 MQT: sonoff_t9/stat/RESULT = {"shutteropen1":100}
15:09:52 Shutter 0: Real Pos: 21400, Target 0, source: Shutter, pos %: 100, direction: -1, rtcshutter: 7
15:09:53 Shutter 0: Real Pos: 19300, Target 0, source: Shutter, pos %: 100, direction: -1, rtcshutter: 28
15:09:54 Shutter 0: Real Pos: 17300, Target 0, source: Shutter, pos %: 100, direction: -1, rtcshutter: 48
15:09:55 Shutter 0: Real Pos: 15300, Target 0, source: Shutter, pos %: 100, direction: -1, rtcshutter: 68
15:09:56 Shutter 0: Real Pos: 13300, Target 0, source: Shutter, pos %: 100, direction: -1, rtcshutter: 88
15:09:57 Shutter 0: Real Pos: 11300, Target 0, source: Shutter, pos %: 100, direction: -1, rtcshutter: 108
15:09:58 Shutter 0: Real Pos: 9300, Target 0, source: Shutter, pos %: 100, direction: -1, rtcshutter: 128
15:09:59 Shutter 0: Real Pos: 7300, Target 0, source: Shutter, pos %: 100, direction: -1, rtcshutter: 148
15:10:00 Shutter 0: Real Pos: 5300, Target 0, source: Shutter, pos %: 100, direction: -1, rtcshutter: 168
15:10:01 Shutter 0: Real Pos: 3300, Target 0, source: Shutter, pos %: 100, direction: -1, rtcshutter: 188
15:10:02 Shutter 0: Real Pos: 1300, Target 0, source: Shutter, pos %: 100, direction: -1, rtcshutter: 208
15:10:02 MQT: sonoff_t9/stat/SHUTTER1 = 100
15:10:02 MQT: sonoff_t9/stat/RESULT = {"POWER2":"OFF"}
15:10:02 MQT: sonoff_t9/stat/POWER2 = OFF
15:10:59 CMD: shutterclose1
15:10:59 MQT: sonoff_t9/stat/RESULT = {"POWER1":"ON"}
15:10:59 MQT: sonoff_t9/stat/POWER1 = ON
15:10:59 MQT: sonoff_t9/stat/RESULT = {"shutterclose1":0}
15:11:00 Shutter 0: Real Pos: 900, Target 22000, source: Shutter, pos %: 0, direction: 1, rtcshutter: 10
15:11:01 Shutter 0: Real Pos: 3000, Target 22000, source: Shutter, pos %: 0, direction: 1, rtcshutter: 30
15:11:02 Shutter 0: Real Pos: 4900, Target 22000, source: Shutter, pos %: 0, direction: 1, rtcshutter: 51
15:11:03 Shutter 0: Real Pos: 7000, Target 22000, source: Shutter, pos %: 0, direction: 1, rtcshutter: 71
15:11:04 Shutter 0: Real Pos: 8900, Target 22000, source: Shutter, pos %: 0, direction: 1, rtcshutter: 91
15:11:05 Shutter 0: Real Pos: 10900, Target 22000, source: Shutter, pos %: 0, direction: 1, rtcshutter: 111
15:11:06 Shutter 0: Real Pos: 12900, Target 22000, source: Shutter, pos %: 0, direction: 1, rtcshutter: 131
15:11:07 Shutter 0: Real Pos: 15000, Target 22000, source: Shutter, pos %: 0, direction: 1, rtcshutter: 151
15:11:08 Shutter 0: Real Pos: 17000, Target 22000, source: Shutter, pos %: 0, direction: 1, rtcshutter: 171
15:11:09 Shutter 0: Real Pos: 19000, Target 22000, source: Shutter, pos %: 0, direction: 1, rtcshutter: 191
15:11:10 Shutter 0: Real Pos: 21000, Target 22000, source: Shutter, pos %: 0, direction: 1, rtcshutter: 211
15:11:10 MQT: sonoff_t9/stat/SHUTTER1 = 0
15:11:10 MQT: sonoff_t9/stat/RESULT = {"POWER1":"OFF"}
15:11:10 MQT: sonoff_t9/stat/POWER1 = OFF
As you can see, the wrong Relay is switched, as POWER1
should be for open
and POWER2
should be for close
15:14:49 CMD: shutteropen1
15:14:49 MQT: sonoff_t9/stat/RESULT = {"POWER2":"ON"}
15:14:49 MQT: sonoff_t9/stat/POWER2 = ON
15:14:49 MQT: sonoff_t9/stat/RESULT = {"shutteropen1":100}
15:14:49 Shutter 0: Real Pos: 22000, Target 0, source: Shutter, pos %: 100, direction: -1, rtcshutter: 0
15:14:50 Shutter 0: Real Pos: 20000, Target 0, source: Shutter, pos %: 100, direction: -1, rtcshutter: 21
15:14:51 Shutter 0: Real Pos: 18000, Target 0, source: Shutter, pos %: 100, direction: -1, rtcshutter: 41
15:14:52 CMD: shutterstop1
15:14:52 MQT: sonoff_t9/stat/RESULT = {"shutterstop1":75}
15:14:52 MQT: sonoff_t9/stat/SHUTTER1 = 26
15:14:52 MQT: sonoff_t9/stat/RESULT = {"POWER2":"OFF"}
15:14:52 MQT: sonoff_t9/stat/POWER2 = OFF
15:15:00 CMD: shutterstop1
15:15:00 MQT: sonoff_t9/stat/RESULT = {"POWER2":"ON"}
15:15:00 MQT: sonoff_t9/stat/POWER2 = ON
15:15:00 MQT: sonoff_t9/stat/RESULT = {"shutterstop1":74}
15:15:00 Shutter 0: Real Pos: 16100, Target 5720, source: Shutter, pos %: 74, direction: -1, rtcshutter: 4
15:15:01 Shutter 0: Real Pos: 14000, Target 5720, source: Shutter, pos %: 74, direction: -1, rtcshutter: 25
15:15:02 Shutter 0: Real Pos: 12000, Target 5720, source: Shutter, pos %: 74, direction: -1, rtcshutter: 45
15:15:03 Shutter 0: Real Pos: 10000, Target 5720, source: Shutter, pos %: 74, direction: -1, rtcshutter: 65
15:15:04 Shutter 0: Real Pos: 8000, Target 5720, source: Shutter, pos %: 74, direction: -1, rtcshutter: 85
15:15:05 Shutter 0: Real Pos: 6000, Target 5720, source: Shutter, pos %: 74, direction: -1, rtcshutter: 105
15:15:05 MQT: sonoff_t9/stat/SHUTTER1 = 75
15:15:05 MQT: sonoff_t9/stat/RESULT = {"POWER2":"OFF"}
15:15:05 MQT: sonoff_t9/stat/POWER2 = OFF
15:15:07 CMD: shutterstop1
15:15:07 MQT: sonoff_t9/stat/RESULT = {"POWER1":"ON"}
15:15:07 MQT: sonoff_t9/stat/POWER1 = ON
15:15:07 MQT: sonoff_t9/stat/RESULT = {"shutterstop1":25}
15:15:08 Shutter 0: Real Pos: 7200, Target 16500, source: Shutter, pos %: 25, direction: 1, rtcshutter: 16
15:15:09 Shutter 0: Real Pos: 9200, Target 16500, source: Shutter, pos %: 25, direction: 1, rtcshutter: 36
15:15:10 Shutter 0: Real Pos: 11200, Target 16500, source: Shutter, pos %: 25, direction: 1, rtcshutter: 56
15:15:11 Shutter 0: Real Pos: 13200, Target 16500, source: Shutter, pos %: 25, direction: 1, rtcshutter: 76
15:15:12 Shutter 0: Real Pos: 15200, Target 16500, source: Shutter, pos %: 25, direction: 1, rtcshutter: 96
15:15:13 MQT: sonoff_t9/stat/SHUTTER1 = 25
15:15:13 MQT: sonoff_t9/stat/RESULT = {"POWER1":"OFF"}
15:15:13 MQT: sonoff_t9/stat/POWER1 = OFF
15:15:15 CMD: shutterstop1
15:15:15 MQT: sonoff_t9/stat/RESULT = {"POWER2":"ON"}
15:15:15 MQT: sonoff_t9/stat/POWER2 = ON
15:15:15 MQT: sonoff_t9/stat/RESULT = {"shutterstop1":75}
15:15:15 Shutter 0: Real Pos: 15600, Target 5500, source: Shutter, pos %: 75, direction: -1, rtcshutter: 10
15:15:16 Shutter 0: Real Pos: 13500, Target 5500, source: Shutter, pos %: 75, direction: -1, rtcshutter: 31
15:15:17 Shutter 0: Real Pos: 11500, Target 5500, source: Shutter, pos %: 75, direction: -1, rtcshutter: 51
15:15:18 Shutter 0: Real Pos: 9500, Target 5500, source: Shutter, pos %: 75, direction: -1, rtcshutter: 71
15:15:19 Shutter 0: Real Pos: 7500, Target 5500, source: Shutter, pos %: 75, direction: -1, rtcshutter: 91
15:15:20 MQT: sonoff_t9/stat/SHUTTER1 = 75
15:15:20 MQT: sonoff_t9/stat/RESULT = {"POWER2":"OFF"}
15:15:20 MQT: sonoff_t9/stat/POWER2 = OFF
The first stop was executed correctly (I'm curious why it didn't work the first time...) but as you can see, when the shutter is already stopped, a stop command results in a move to the mirrored posistion (i.e. ~ positionnew = 100 - positionold)
15:20:42 MQT: sonoff_t9/stat/RESULT = {"shutterposition1":50}
15:20:43 Shutter 0: Real Pos: 7400, Target 11000, source: Shutter, pos %: 25, direction: 1, rtcshutter: 20
15:20:44 Shutter 0: Real Pos: 9400, Target 11000, source: Shutter, pos %: 25, direction: 1, rtcshutter: 40
15:20:45 MQT: sonoff_t9/stat/SHUTTER1 = 50
15:20:45 MQT: sonoff_t9/stat/RESULT = {"POWER1":"OFF"}
15:20:45 MQT: sonoff_t9/stat/POWER1 = OFF
15:20:57 CMD: shotterstop1
15:20:57 Shutter unknown
15:20:57 MQT: sonoff_t9/stat/RESULT = {"Command":"Unknown"}
15:21:06 CMD: shutterstop1
15:21:06 MQT: sonoff_t9/stat/RESULT = {"shutterstop1":50}
15:21:17 CMD: shutterstop1
15:21:17 MQT: sonoff_t9/stat/RESULT = {"shutterstop1":50}
15:21:36 CMD: shutterposition 49
15:21:36 MQT: sonoff_t9/stat/RESULT = {"POWER1":"ON"}
15:21:36 MQT: sonoff_t9/stat/POWER1 = ON
15:21:36 MQT: sonoff_t9/stat/RESULT = {"shutterposition1":49}
15:21:36 MQT: sonoff_t9/stat/SHUTTER1 = 49
15:21:36 MQT: sonoff_t9/stat/RESULT = {"POWER1":"OFF"}
15:21:36 MQT: sonoff_t9/stat/POWER1 = OFF
15:21:40 CMD: shutterstop1
15:21:40 MQT: sonoff_t9/stat/RESULT = {"POWER2":"ON"}
15:21:40 MQT: sonoff_t9/stat/POWER2 = ON
15:21:40 MQT: sonoff_t9/stat/RESULT = {"shutterstop1":51}
15:21:40 MQT: sonoff_t9/stat/SHUTTER1 = 52
15:21:40 MQT: sonoff_t9/stat/RESULT = {"POWER2":"OFF"}
15:21:40 MQT: sonoff_t9/stat/POWER2 = OFF
15:21:42 CMD: shutterstop1
15:21:42 MQT: sonoff_t9/stat/RESULT = {"POWER1":"ON"}
15:21:42 MQT: sonoff_t9/stat/POWER1 = ON
15:21:42 MQT: sonoff_t9/stat/RESULT = {"shutterstop1":48}
15:21:42 MQT: sonoff_t9/stat/SHUTTER1 = 48
15:21:42 MQT: sonoff_t9/stat/RESULT = {"POWER1":"OFF"}
15:21:42 MQT: sonoff_t9/stat/POWER1 = OFF
15:21:44 CMD: shutterstop1
15:21:44 MQT: sonoff_t9/stat/RESULT = {"POWER2":"ON"}
15:21:44 MQT: sonoff_t9/stat/POWER2 = ON
15:21:44 MQT: sonoff_t9/stat/RESULT = {"shutterstop1":52}
15:21:45 MQT: sonoff_t9/stat/SHUTTER1 = 53
15:21:45 MQT: sonoff_t9/stat/RESULT = {"POWER2":"OFF"}
15:21:45 MQT: sonoff_t9/stat/POWER2 = OFF
15:21:46 CMD: shutterstop1
15:21:46 MQT: sonoff_t9/stat/RESULT = {"POWER1":"ON"}
15:21:46 MQT: sonoff_t9/stat/POWER1 = ON
15:21:46 MQT: sonoff_t9/stat/RESULT = {"shutterstop1":47}
15:21:47 MQT: sonoff_t9/stat/SHUTTER1 = 47
15:21:47 MQT: sonoff_t9/stat/RESULT = {"POWER1":"OFF"}
15:21:47 MQT: sonoff_t9/stat/POWER1 = OFF
15:21:48 CMD: shutterstop1
15:21:48 MQT: sonoff_t9/stat/RESULT = {"POWER2":"ON"}
15:21:48 MQT: sonoff_t9/stat/POWER2 = ON
15:21:48 MQT: sonoff_t9/stat/RESULT = {"shutterstop1":53}
15:21:49 MQT: sonoff_t9/stat/SHUTTER1 = 54
15:21:49 MQT: sonoff_t9/stat/RESULT = {"POWER2":"OFF"}
15:21:49 MQT: sonoff_t9/stat/POWER2 = OFF
15:21:51 CMD: shutterstop1
15:21:51 MQT: sonoff_t9/stat/RESULT = {"POWER1":"ON"}
15:21:51 MQT: sonoff_t9/stat/POWER1 = ON
15:21:51 MQT: sonoff_t9/stat/RESULT = {"shutterstop1":46}
15:21:51 Shutter 0: Real Pos: 10300, Target 11880, source: Shutter, pos %: 46, direction: 1, rtcshutter: 1
15:21:52 MQT: sonoff_t9/stat/SHUTTER1 = 46
15:21:52 MQT: sonoff_t9/stat/RESULT = {"POWER1":"OFF"}
15:21:52 MQT: sonoff_t9/stat/POWER1 = OFF
15:21:58 CMD: shutterstop1
15:21:58 MQT: sonoff_t9/stat/RESULT = {"POWER2":"ON"}
15:21:58 MQT: sonoff_t9/stat/POWER2 = ON
15:21:58 MQT: sonoff_t9/stat/RESULT = {"shutterstop1":54}
15:21:58 Shutter 0: Real Pos: 11300, Target 10120, source: Shutter, pos %: 54, direction: -1, rtcshutter: 7
15:21:59 MQT: sonoff_t9/stat/SHUTTER1 = 55
15:21:59 MQT: sonoff_t9/stat/RESULT = {"POWER2":"OFF"}
15:21:59 MQT: sonoff_t9/stat/POWER2 = OFF
15:22:03 CMD: shutterstop1
15:22:03 MQT: sonoff_t9/stat/RESULT = {"POWER1":"ON"}
15:22:03 MQT: sonoff_t9/stat/POWER1 = ON
15:22:03 MQT: sonoff_t9/stat/RESULT = {"shutterstop1":45}
15:22:04 Shutter 0: Real Pos: 12000, Target 12100, source: Shutter, pos %: 45, direction: 1, rtcshutter: 20
15:22:04 MQT: sonoff_t9/stat/SHUTTER1 = 45
15:22:04 MQT: sonoff_t9/stat/RESULT = {"POWER1":"OFF"}
15:22:04 MQT: sonoff_t9/stat/POWER1 = OFF
15:22:08 CMD: shutterstop1
15:22:08 MQT: sonoff_t9/stat/RESULT = {"POWER2":"ON"}
15:22:08 MQT: sonoff_t9/stat/POWER2 = ON
15:22:08 MQT: sonoff_t9/stat/RESULT = {"shutterstop1":55}
15:22:09 Shutter 0: Real Pos: 10300, Target 9900, source: Shutter, pos %: 55, direction: -1, rtcshutter: 19
15:22:09 MQT: sonoff_t9/stat/SHUTTER1 = 55
15:22:09 MQT: sonoff_t9/stat/RESULT = {"POWER2":"OFF"}
15:22:09 MQT: sonoff_t9/stat/POWER2 = OFF
15:22:11 MQT: sonoff_t9/tele/SENSOR = {"Time":"2018-08-28T15:22:11","SHUTTER-1":55}
15:22:14 CMD: shutterstop1
15:22:14 MQT: sonoff_t9/stat/RESULT = {"POWER1":"ON"}
15:22:14 MQT: sonoff_t9/stat/POWER1 = ON
15:22:14 MQT: sonoff_t9/stat/RESULT = {"shutterstop1":45}
15:22:15 Shutter 0: Real Pos: 10200, Target 12100, source: Shutter, pos %: 45, direction: 1, rtcshutter: 5
15:22:15 MQT: sonoff_t9/stat/SHUTTER1 = 45
15:22:15 MQT: sonoff_t9/stat/RESULT = {"POWER1":"OFF"}
15:22:15 MQT: sonoff_t9/stat/POWER1 = OFF
15:22:24 CMD: shutterstop1
15:22:24 MQT: sonoff_t9/stat/RESULT = {"POWER2":"ON"}
15:22:24 MQT: sonoff_t9/stat/POWER2 = ON
15:22:24 MQT: sonoff_t9/stat/RESULT = {"shutterstop1":55}
15:22:25 Shutter 0: Real Pos: 11300, Target 9900, source: Shutter, pos %: 55, direction: -1, rtcshutter: 9
15:22:25 MQT: sonoff_t9/stat/SHUTTER1 = 55
15:22:25 MQT: sonoff_t9/stat/RESULT = {"POWER2":"OFF"}
15:22:25 MQT: sonoff_t9/stat/POWER2 = OFF
ok, let's work on getting it fixed. First, you HAVE to switch your relays. If on open close the direction is wrong you need to switch it. shutteropen and shutterstop have no options like 50 or 75. They just open/close/stop. No matter where they are. shutterposition is the only command that is aware of invert and allows a value to define the position from 0-100. Let me know if more questions.
Additionally if the position is 50 you are not able to set it to 49 or 51 because in most cases the operating time is to low. therefore the firmware just do not move. If you want to test change it at least 5 or better 10% up or down to have a minimum movement
Hmm, shutterstop really seems to start the relay. also if it is already stopped. This seems to be a bug.
Yep on the shutterstop there was an IF missing that takes care about the inverted functionality. I checked in a new version. Maybe you can give it a try.
as far as I understood the wiki, I have to use channel 1 for UP and channel 2 for DOWN, so if switching POWER1 to ON, the shutter has to move up, and if switching the POWER2 to ON, the shutter has to move down. And this is what I see here. But when sending a shutteropen command, POWER2 is set to ON, so the Shutter moves down.
If changing shutterinvert to 0, the commands work as expected. So, the shutterinvert does a complete invert. If changing the "polarity" of the motor, this would result in shutter opening if switching POWER2 to ON, but also in a 100 if open and a 0 if closed... that's the same problem as without the shutterinvert option at all, in fact, I could handle the problem by using the wrong commands, but I think this is not intended... ;)
In question of shutterstop, this command is ok now :)
AH. I think i found the issue... in xdrv_97_shutter.ino
the code for open and close is
XdrvMailbox.payload = CMND_OPEN == command_code ? 100 : 0;
command_code = CMND_POSITION;
So, if sending a shutteropen, this will always result in a command position 100
Ok let me do another deep dive. I assume you are right. It was not my idea to implement the invert. Anyhow should be fixable and I assume the error came in with the change of reporting shutterposition as a result.
Yep. And another bug fixed. I reverted the last change and applied the current fix to it too. If I set the SOURCE to WEBGUI then the inverted will have no effect. This I'm using now for open/close/stop. Then these commands are indepedend from the invert and should work all the time current version checked in. Also upgraded to the latest TASMOTA version.
Cool! Will have a try...
Hi, I do some cleanup and fixed some side-effects when using a wall switch. now the shutter should stop and move in the opposite direction if you hit the switch in the other direction
Did not see any problems with wall switches (I'm using a Sonoff T 2-gang), in fact, the last version works pretty good here, since last week... sorry for forgetting to close the issue!
I've setup a Sonoff T1 2CH as a rollershutter.
shutterposition works perfectly. using
shutterinvert 1
results in upper position = 0, lower position = 100, perfect.But now, there is something weird (
shutterinvert=1
): When sendingshutteropen
, the shutter closes to position0
When sendingshutterclose
, the shutter opens ans stops immediately (returning1
as position) When sendingshutterclose
from a position other than fully open or fully closed, it moves the shutter up When sendingshutterstop
, there is no reaction when the shutter is moving. When sendingshutterstop
when the shutter is already stopped, the shutter moves to position65
. When sendingshutterstop
when the shutter is already stopped at position65
, the shutter moves to position35
. When sending ashutterinvert
without any parameter, tasmota reacts in sending astat RESULT {"shutterinvert1":-99}
regardless, ifshutterinvert
is set to 0 or to 1.