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

DualR3 state closing opening is not updated #917

Closed
rexopl opened this issue Jul 23, 2022 · 18 comments
Closed

DualR3 state closing opening is not updated #917

rexopl opened this issue Jul 23, 2022 · 18 comments
Assignees
Labels
bug Something isn't working

Comments

@rexopl
Copy link

rexopl commented Jul 23, 2022

Hi, since about month sonoff addon stopped updating DualR3 status.
Calling services open_cover and close_cover works fine, but status of device is not changing.
So no option to detect state and revert button (close/open) function.
It doesn't matter what last status was saved - it does not refresh at all.
While checking logs and trying find problem i discovered that - state is updated only once when i click reload on SonOff component in settings, than it is not updating again.

Is stopped working after some updates.
I have full official and up-to-date hassio and HACS plugins.
Tried restarting few times. No logs related to this problem found.

@20bart
Copy link

20bart commented Jul 25, 2022

Hi, I have the same problem. I think since version 3. In the ewelink app it's working fine though.
When I switch the mode (auto/cloud/local) it updates once but after that it doesn't sync anymore.

@rexopl
Copy link
Author

rexopl commented Jul 25, 2022

I created temporary solution:
Created pyscript (requires pyscript installed via HACS):

@service
def set_state(entity_id, value: str):
    state.set(entity_id, value)

And added extra action for button in switches section config 😅:

      turn_on:
          - service: cover.open_cover
            target:
              entity_id: cover.sonoff_100127439b
          - service: pyscript.set_state
            data:
                entity_id: cover.sonoff_100127439b
                value: opening

But waiting for solution of this problem ... 😃

@AlexxIT AlexxIT added the bug Something isn't working label Jul 25, 2022
@AlexxIT
Copy link
Owner

AlexxIT commented Jul 25, 2022

You need to collect debug logs while using DualR3 in cover mode.
I have DualR3, but don't have cover for it. And can't test this mode.

@20bart
Copy link

20bart commented Jul 25, 2022

Debug logs.txt
System Health.txt
sonoff-138930c8454f4a2a5a40a24d8c8e293e-Rolluik-f2357000b9b967b5b55814298a1405ea.json.txt
Hope it helps. If you need anything else, let me know.

FYI: I did a restart just before these logs, it was recognized in the open state at startup correctly. I then closed and opened the cover. But the state or position didn't change.

Thanks

@rexopl
Copy link
Author

rexopl commented Jul 25, 2022

If you would like to switch to cover mode, you need to set in ewelink mode to motor.
It assures that only one output is available (when you enable output 2 and output 1 is already enabled, first it disable output 1, and same other way.
Personally I use it for 2 speed fans (rooms air condition/ventilation).
In this case both outputs enabled might burn out motor - so it is super useful :).

@20bart
Copy link

20bart commented Jul 25, 2022

Yes, I have it set to motor mode in ewelink app. Maybe important that I mentioned this as well.

@BenoitRullez
Copy link

BenoitRullez commented Aug 8, 2022

Hello all. I have the same problem, but please allow me to rephrase it with my own words and understanding.

DualR3 has 3 modes: switch / motor / energy metering. I use mine in motor mode to manage an awning. (I guess that what everybody here is calling the cover mode is the motor mode on the Sonoff documentation).
In motor mode, DualR3 calculates the position of the awning or shutter. Position is a percentage, ranging from 0% = full in = fully retracted, to 100% = full out = fully extended. DualR3 is able to calculate it after a bit of self-learning.
The position is continuously updated and accurate in eWelink, but not at all in HA: that is our problem here.
However, useful to note that position command sent from HA ("hey, DualR3, move to 40%") works well. Even if the awning is fully open, and HA thinks it is fully closed, when you send a 40% request it actually retracts to 40%. I guess the command sent by HA is "go to 40%" rather than "extand to 40%", and the DualR3 knows where he is and which direction it should go to get to the target. (would need to check if position is calculated by DualR3 or by eWelink, but I guess the former; I can check if needed)

In HA, the position is managed as a secondary information of the device, and not one of the sensors of the device.
The sensors i see in HA for the DualR3 are, for each of the 2 channels: voltage, power, ... And they are probably the same in swtich mode.
I haven't found yet how to call the position in the scripts, nor how to display it in the dashboard except as a secondary information of the device.

So I guess the solution should start with:

  • get HA to know if the DualR3 is used in switch mode, motor mode, or mettering mode.
  • if motor mode, then add a "sensor" in HA with the position information calculated by Dual3.

@BenoitRullez
Copy link

Mmm, very strange today, at the same time I added one new MINI to my sonoff integration, the DUALR3 that is managing my awning became unvailable.
It is still available and working correctly from eWelink.
In the logs I found this below.
Absolultly no idea if this is related to the issue of lack of awning position reporting. Probably not.

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/connection.py:102
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 8 août 2022 à 13:00:54 (4 occurrences)
Last logged: 12:36:12

[3774634448] Error handling message: Unauthorized (unauthorized)
[4005302384] Error handling message: Unauthorized (unauthorized)
[3734876896] Error handling message: Unauthorized (unauthorized)
[3717429376] Error handling message: Unauthorized (unauthorized)

@BenoitRullez
Copy link

BenoitRullez commented Aug 11, 2022

While we are on DUALR3 cover mode...

On the dashboard, the following code:

type: entities
entities:
  - entity: cover.sonoff_10014366de
    secondary_info: position

gives us 3 buttons: open, stop, and close.
All the 3 buttons, including the stop button, give the exepected result with DUALR3 and cover. It means HA and Sonoff LAN integration can handle those 3 actions properly.

However, in the automation editor, using the user interface, the only action available in the drop list for this device is to "set position".
In the YAML editor this action looks like that:

domain: cover
entity_id: cover.sonoff_10014366de
type: set_position
position: 0

Would it be possible to arrange the drop list to also propose Open, Stop, and Close actions, on top of the Set_position action?
Maybe open and close are not the best words, extend and retract would be better for an awning, or up and down for a shutter.

Thanks a lot.

@sipimokus
Copy link
Contributor

sipimokus commented Aug 29, 2022

I think caught a potential bug in DualR3 in cover mode, maybe related for this issue:

if uiid in (126, 165) and device["params"].get("workMode") == 2:

I tried copy this solution for NSPanel #919 fix, but I got this error message:

 Traceback (most recent call last):
   File "/config/custom_components/sonoff/core/ewelink/__init__.py", line 51, in setup_devices
     entities += [cls(self, device) for cls in get_spec(device)]
   File "/config/custom_components/sonoff/core/devices.py", line 240, in get_spec
     # NSPanel Climate disable without switch configuration
 TypeError: argument of type 'int' is not iterable

The line number is "lie", if I use [] instead of () on line 235, don't get this error message.

PR: #964

sipimokus added a commit to sipimokus/SonoffLAN that referenced this issue Aug 29, 2022
@20bart
Copy link

20bart commented Sep 1, 2022

Thanks for the feedback, but I have tried this solution by adjusting it manually and it doesn't resolve the issue for not updating the position.

@FelisucoVFR
Copy link

FelisucoVFR commented Sep 14, 2022

Hi, I am using the R3 as a dual switch and I am getting the same lack of status update.
I have checked that disconnecting LAN mode inside the eWeLink app the device stopped working (only by hand switch works of course). It seems any of my R3 are connecting to the cloud.
If I change to LAN at the integration, Any SonOff is detected, but in Cloud any of them refresh the status.
EDIT: I have reboot the power supply at all my home and all devices are working back again.

@antrema
Copy link

antrema commented Sep 15, 2022

Hi, same status for me
No status update, position doesn't change in HA while I manipulate the covers
But covers work well with eWelink app

@ArekARCODE
Copy link

hi, i had this problem when dual R3 did not have internet connection, fixed internet connection of dual R3 and it works. looks like duals still need internet connection to report position to home assistant

@AlexxIT
Copy link
Owner

AlexxIT commented Sep 24, 2022

@20bart thanks for logs. This is same problem as #839
Fix already in master version. Will be in next release

@AlexxIT AlexxIT added this to the v3.3.0 milestone Sep 24, 2022
@AlexxIT AlexxIT self-assigned this Sep 25, 2022
@eddymar42
Copy link

It appears this issue has re-appeared in V3.3.1

@AlexxIT AlexxIT modified the milestones: v3.3.0, next Feb 6, 2023
@AlexxIT
Copy link
Owner

AlexxIT commented Mar 31, 2023

Please reopen the issue if it is still relevant

@AlexxIT AlexxIT closed this as completed Mar 31, 2023
@AlexxIT AlexxIT removed this from the todo milestone Mar 31, 2023
@FassRoller
Copy link

I have the same problem with Sonoff DW2….

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants