thehookup / Motorized_MQTT_Blinds

Motorized_MQTT_Blinds
292 stars 75 forks source link

Blind keep closing by there-self #41

Open jhppc opened 3 years ago

jhppc commented 3 years ago

this is driving me nuts. I dont have any automation set up to close the blinds but the blind keep closing my there self.

image

rjmcfadd commented 3 years ago

This is happening to me as well! Any advice @thehookup?

binaryn3xus commented 3 years ago

I'm having this issue too. I think it is because of how the code reacts when it experiences a fault, reconnects to wifi, or MQTT checks in (such as with home-assistant or node-red). I am going to try to look into this myself since Rob is pretty busy.

If I am successful finding a solution, I will try to open a PR for Rob or I will at least put some notes in this issue.

rjmcfadd commented 3 years ago

I actually just fixed my issue. The problem I was having was the blinds would open if I lost power. I used this rule:

Rule2 ON Power1#Boot DO TuyaSend4 1,1 ENDON Rule2 1

binaryn3xus commented 3 years ago

Are these Tasmota rules? Or something else?

rjmcfadd commented 3 years ago

Yeah, it is Tasmota rules.

On Mon, Jan 11, 2021 at 8:45 PM Joshua notifications@github.com wrote:

Are these Tasmota rules? Or something else?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/thehookup/Motorized_MQTT_Blinds/issues/41#issuecomment-758338744, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFONNWUXM672I5MILRXHN5TSZOSTJANCNFSM4QTZVBZA .

binaryn3xus commented 3 years ago

@rjmcfadd You got Tasmota to work with this setup? Do you mind sharing your configuration string if so?

ericullmann commented 3 years ago

I am having the same issue as well. Did anyone find a solution to this?

binaryn3xus commented 3 years ago

@ericullmann I am rewriting some of this code because I couldn't get it to work with Tasmota without the motor getting stupid hot. So once I get my code cleaned up and tested to not auto open I'll will share it.

ericullmann commented 3 years ago

Appreciate it!

Sent from my iPhone

On Jan 19, 2021, at 5:49 PM, Joshua notifications@github.com wrote:

 @ericullmann I am rewriting some of this code because I couldn't get it to work with Tasmota without the motor getting stupid hot. So once I get my code cleaned up and tested to not auto open I'll will share it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

binaryn3xus commented 3 years ago

@ericullmann I have begun trying to track down this bug but I cant seem to reliable reproduce it. Do you have any specific steps that you do that make it happen? Here is my fork of this project: https://github.com/JoshuaGarrison27/Motorized_MQTT_Blinds

thehookup commented 3 years ago

I'm super confused by this thread. Is this an issue with Tasmota, or my code? Is this issue with the MQTT version or the Alexa version?

ericullmann commented 3 years ago

My issue is related to your code and seems to be affected after version 0.118 of home assistant but does seem to be related to reconnects of the nodemcu to broker.

Sent from my iPhone

On Jan 20, 2021, at 7:56 PM, thehookup notifications@github.com wrote:

 I'm super confused by this thread. Is this an issue with Tasmota, or my code? Is this issue with the MQTT version or the Alexa version?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

thehookup commented 3 years ago

I'd suspect 2 issues: First, there are two ways to open the blinds with MQTT via HA 1) send the OPEN command and 2) send a position value. If HA changed the way it publishes positional commands it's possible that there is a retained OPEN command or position command that gets picked up on reconnect.

ericullmann commented 3 years ago

@thehookup I would need to rennable the position topic as I have disable every topic except the command so now position is missing on home assistant for the blinds. However, i can tell you the problem still occurs and is random. It affects certain blinds and then sometimes they all are fine.

thehookup commented 3 years ago

Do you have a way to check for retained messages? (MQTT Explorer, Node Red, etc?)

I've got 9 of these deployed my my house and the most recent HA, no issues.

rjmcfadd commented 3 years ago

@rjmcfadd You got Tasmota to work with this setup? Do you mind sharing your configuration string if so?

Sorry, I wasn't getting notifications for this. I just realized that I posted in the wrong place. I'm using the Zemismart Blinds Controller Motor thehookup recommended in one of his videos that I flashed with Tasmota. When I searched my issue I found this.

binaryn3xus commented 3 years ago

Ah okay. Thanks @rjmcfadd for letting me know.

@thehookup I had to fork and change your code slightly because I couldn't get ArduinoOTA to work to save my life. I changed it to use http web server for updates. I was having some of the same issues as other people saying these open/close randomly but I have not have not been able to reproduce it lately.

ericullmann commented 3 years ago

@JoshuaGarrison27 Its is completely random but It does appear to be on reconnects as well. At least this is what I can tell. It happens at random times and random blinds as well. The strange thing is that rolling the HA code back to 0.118 resolves this but HA says they have made not changes on MQTT.

binaryn3xus commented 3 years ago

@ericullmann Mind sharing your yaml for home assistant to your blinds? I have not had any issues recently but I am running my own modifed version of this code. So if you give me your configuration, I'll try it on my blinds to see if the bug still happens with my code.

ericullmann commented 3 years ago

Sure do you want the blinds code and the home assistant yaml or just the ha yaml?

Sent from my iPhone

On Feb 2, 2021, at 2:05 PM, Joshua notifications@github.com wrote:

 @ericullmann Mind sharing your yaml for home assistant to your blinds? I have not had any issues recently but I am running my own modifed version of this code. So if you give me your configuration, I'll try it on my blinds to see if the bug still happens with my code.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

binaryn3xus commented 3 years ago

The HA Cover MQTT yaml you are using for one of your blinds.

ericullmann commented 3 years ago

@JoshuaGarrison27 Here is it

binaryn3xus commented 3 years ago

@ericullmann Thank you! I have applied these settings to one of my blinds. I want to see if it makes any kind of difference. I was using a more dumbed down version of MQTT for my blinds. I didnt care to have position and such in HA. So my early guess would be that it has something to do with the positionCommand/positionState in conjunction with retain=true. I will share if I start having some issues. My plan it to also try to record all MQTT commands related to this device id. This will hopefully give some more insights to the issue. 😄

ericullmann commented 3 years ago

I did do a test where I did retain false and only use the command topic but the result was the same.

Sent from my iPhone

On Feb 2, 2021, at 3:51 PM, Joshua notifications@github.com wrote:

 @ericullmann Thank you! I have applied these settings to one of my blinds. I want to see if it makes any kind of difference. I was using a more dumbed down version of MQTT for my blinds. I didnt care to have position and such in HA. So my early guess would be that it has something to do with the positionCommand/positionState in conjunction with retain=true. I will share if I start having some issues. My plan it to also try to record all MQTT commands related to this device id. This will hopefully give some more insights to the issue. 😄

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

thehookup commented 3 years ago

Can you try this YAML and report back?

platform: mqtt name: "Living Room Blinds" command_topic: "livingroom/positionCommand" set_position_topic: "livingroom/positionCommand" position_topic: "livingroom/positionState" state_topic: "livingroom/positionState" retain: true payload_open: "0" payload_close: "12" payload_stop: "INVALID" position_open: 0 position_closed: 12

platform: mqtt name: "Dinning Room Blinds" command_topic: "dine/positionCommand" set_position_topic: "dine/positionCommand" position_topic: "dine/positionState" state_topic: "dine/positionState" retain: true payload_open: "0" payload_close: "12" payload_stop: "INVALID" position_open: 0 position_closed: 12

ericullmann commented 3 years ago

@thehookup I have made the modification and I will report back.

ericullmann commented 3 years ago

@thehookup same result.

binaryn3xus commented 3 years ago

@ericullmann Is there anything in particular that you find makes it happen? Or was it coincidence that it happened within 20 minutes?

ericullmann commented 3 years ago

It was coincidence. The only thing I did do at the same time is tell Google to turn off a room that is not associated., The one thing I can say is in home-assistant when these events happen if I look at the history say for the dine blinds I see it was listed as "was closed" at 828 vs. what I woudl see if I did it or google did it would be service..cover.set_cover position or if I do it by the app it says closed by eric. That the only thing that is consistent when this happens.

ericullmann commented 3 years ago

I can say with the change I made this morning in particular my dinning blinds have closed over 10 times on their own today.

thehookup commented 3 years ago

I highly suspect a retain issue here. It would also fall in line with more problems after the change you just made. My guess is you have "OPEN" retained on "livingroom/blindsCommand" and HA stopped sending that command after the update and now only sends on position command, or something along those lines.

ericullmann commented 3 years ago

So how would I change this if this is the case as I didn’t modify your original code on the nodemcu so I’m thinking that where this modification would need to occur?

Sent from my iPhone

On Feb 3, 2021, at 4:13 PM, thehookup notifications@github.com wrote:

 I highly suspect a retain issue here. It would also fall in line with more problems after the change you just made. My guess is you have "OPEN" retained on "livingroom/blindsCommand" and HA stopped sending that command after the update and now only sends on position command, or something along those lines.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

binaryn3xus commented 3 years ago

@ericullmann I have run your yaml all day with no issues. All my automations ran successfully as well.

MQTT Logs for your YAML you provided me yesterday: https://pastebin.com/pzGnvfLs As you can see, most of what is happening is the checkIn periodically. However, there tends to be a random positionCommand sent from time to time. No idea why just yet. I have not touched nodered, ha, or docker since last night after setting up your YAML and this logger. I wont pretend to understand how retain works within the broker and such.

Be aware: I am using a modified version of Rob's code. So if you want to see what I have you can check out my repo. Only real difference so far is that I moved away from ArduinoOTA (because I could not get it to work) to using ESP8266HTTPUpdateServer. I also plan to add a landing page for the device so you can quickly see what the MQTT name is and such at a glance.

I know this isn't very helpful and I'm sorry. I just want to try to be as helpful as I can be.

Something you can try (if this doesnt break your workflow) is to simplify the YAML a bit and make them a little "dumber" with something like this:

platform: mqtt
name: "Kitchen Window Blinds Left"
state_topic: "Blinds001/blindsCommand"
command_topic: "Blinds001/blindsCommand"
value_template: >
    {% if value == "CLOSE" %}
    closed
    {% else %}
    open
    {% endif %}
payload_open: "OPEN"
payload_close: "CLOSE"
retain: false

This way, HA is only monitoring for the blindsCommand. And it only gets that when you actually control them. So if you are getting random positionCommand messages, then HA doesnt know about it and wont act on it. Just an idea.

ericullmann commented 3 years ago

Also I should note that it will randomly open sometimes when it is closed and when it is open it will close so I’m with you with retain being an issue but I’m not sure exactly what to fix.

Sent from my iPhone

On Feb 3, 2021, at 4:13 PM, thehookup notifications@github.com wrote:

 I highly suspect a retain issue here. It would also fall in line with more problems after the change you just made. My guess is you have "OPEN" retained on "livingroom/blindsCommand" and HA stopped sending that command after the update and now only sends on position command, or something along those lines.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

ericullmann commented 3 years ago

I just tried this abd it can open the blinds but when I try to close them it doesn’t close

Sent from my iPhone

On Feb 3, 2021, at 5:25 PM, Joshua notifications@github.com wrote:

 @ericullmann I have run your yaml all day with no issues. All my automations ran successfully as well.

MQTT Logs for your YAML you provided me yesterday: https://pastebin.com/pzGnvfLs As you can see, most of what is happening is the checkIn periodically. However, there tends to be a random positionCommand sent from time to time. No idea why just yet. I have not touched nodered, ha, or docker since last night after setting up your YAML and this logger. I wont pretend to understand how retain works within the broker and such.

Be aware: I am using a modified version of Rob's code. So if you want to see what I have you can check out my repo. Only real difference so far is that I moved away from ArduinoOTA (because I could not get it to work) to using ESP8266HTTPUpdateServer. I also plan to add a landing page for the device so you can quickly see what the MQTT name is and such at a glance.

I know this isn't very helpful and I'm sorry. I just want to try to be as helpful as I can be.

Something you can try (if this doesnt break your workflow) is to simplify the YAML a bit and make them a little "dumber" with something like this:

platform: mqtt name: "Kitchen Window Blinds Left" state_topic: "Blinds001/blindsCommand" command_topic: "Blinds001/blindsCommand" value_template: > {% if value == "CLOSE" %} closed {% else %} open {% endif %} payload_open: "OPEN" payload_close: "CLOSE" retain: false This way, HA is only monitoring for the blindsCommand. And it only gets that when you actually control them. So if you are getting random positionCommand messages, then HA doesnt know about it and wont act on it. Just an idea.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

ericullmann commented 3 years ago

@JoshuaGarrison27 So I got your yaml to work by slightly modfying the open and close payload to 0 and 12 respectively. It appears to be working but I need to watch this further. However, the status in HA always shows "open" it doesnt update when I close to a closed state.

ericullmann commented 3 years ago

@JoshuaGarrison27 @thehookup I tried your code and they did close on their own as well. I think this is with the reconnect and the code itself on the nodemcu. I am thinking it is with the checkin but I cant seem to find exactly what is causing it.

binaryn3xus commented 3 years ago

This is so bazaar. Mine has been working flawlessly. Can you give us some more information on your setup? Such as for me, I run HA, NodeRed, and Mosquito MQTT all in separate docker containers.

ericullmann commented 3 years ago

Sure I run mosquito mqtt on a raspberry pi. I run ha on another raspberry pi in a docker container. Then I have 10 nodemcu that are running my blinds and another 3 nodemcu running temperature sensors abd sending data to mosquito.

Thanks Eric

Sent from my iPhone

On Feb 4, 2021, at 10:35 AM, Joshua notifications@github.com wrote:

 This is so bazaar. Mine has been working flawlessly. Can you give us some more information on your setup? Such as for me, I run HA, NodeRed, and Mosquito MQTT all in separate docker containers.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

ericullmann commented 3 years ago

I may have found the issue and will do some more testing. I will report back tomorrow with the results.

ericullmann commented 3 years ago

@JoshuaGarrison27 @thehookup Thank you both for your help. I appreciate it. I was able to solve the problem by upgrading my MQTT broker and everything has been stable for two days now so I think we are good.

binaryn3xus commented 3 years ago

@ericullmann Awesome. Glad it was something simple. My mqtt container got updated to 2.x yesterday and my whole mqtt network went down. So be aware if you are using the mosquitto MQTT container.

craigdthom commented 3 years ago

posted this earlier ... I was having a similar issue

I have noticed different behaviors of the NodeMCUs - https://imgur.com/8FNR8mx

When power to the NodeMCU is lost .... some of the NodeMCUs reset( Change state - Open/Close) and others do not
When my Home assistance server is restarted .... some of the NodeMCUs reset( Change state - Open/Close) and others do not
When WiFi coverage changes or drop(Mesh WiFi was a headache) ... some of the NodeMCUs reset( Change state - Open/Close) and others do not

I 'm very stable now with just the two routers - 1 upstairs and one downstairs ( I am controlling 25 blinds without any issues )

-Craig

petereit commented 2 years ago

@ericullmann What broker/version are you using? I'm Mosquitto broker (6.1.2) and am still experiencing the issue.