Whytey / moebot-hass-integration

A HomeAssistant integration for MoeBot (and compatible) TUYA mowers.
8 stars 0 forks source link

Allow setting tinytuya version #6

Closed clau-bucur closed 12 months ago

clau-bucur commented 1 year ago

Thanks for this integration, I've just started using it!

My robot is however not coming online in the integration, even though it's alive and kicking. I can control it by using the pymoebot library.

The robot is using version 3.4 and I see the library is hardcoding 3.3. Would it be possible to make it configurable?

Whytey commented 1 year ago

Hi @clau-bucur ,

When you talk about the version being used - I assume you are referring to the TUYA protocol version? Can you confirm?

Cheers, Whytey

Whytey commented 1 year ago

Also, could you please see what error messages you might be seeing in the Home-Assistant logs and paste them here?

clau-bucur commented 1 year ago

When you talk about the version being used - I assume you are referring to the TUYA protocol version? Can you confirm?

That's correct.

Looking at the logs I see only this entry, flooding the logs: 2023-06-07 08:29:22.924 ERROR (Thread-11 (listen)) [pymoebot] Error from device: {'Error': 'Network Error: Unable to Connect', 'Err': '901', 'Payload': None}

Whytey commented 1 year ago

Hmmm, you're not the first to experience this issue - someone on Reddit had the same problem and I haven't had much chance to resolve it yet.

Just out of curiosity, what version of Python is your Home Assistant instance running in? You can find this from Settings > System > Repairs > Overflow menu (three dots) > System Information.

Should be a view like: image

clau-bucur commented 1 year ago

Here it is: image

But I have a feeling if the protocol version can be changed, this log error would go away. At least testing pymoebot locally where I could change the protocol version, did not have this issue and I could interact with the mower.

Whytey commented 1 year ago

I have a feeling if the protocol version can be changed, this log error would go away.

We could test that.

  1. On your machine running Home Assistant, go to your config directory /config.
  2. Find the Home Assistant copy of the pymoebot source in the deps folder at deps/lib/python3.10/site-packages/pymoebot
  3. Change the protocol version from 3.3 to 3.4 in the __init__() method.
  4. Restart home assistant.

Let me know how that goes. If it doesn't work, you can always revert it back.

Cheers, Whytey

clau-bucur commented 1 year ago

I'm afraid the deps folder is empty. Could it be due to I'm running HA OS installation?

Whytey commented 1 year ago

I'll have to look into where Hass OS stored them. Sorry, I'm a bit new to this and probably chose a slightly tougher nut to crack.

On Wed, 7 June 2023, 6:18 pm Claudiu Bucur, @.***> wrote:

I'm afraid the deps folder is empty. Could it be due to I'm running HA OS installation?

— Reply to this email directly, view it on GitHub https://github.com/Whytey/moebot-hass-integration/issues/6#issuecomment-1580176832, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGWATHVHQ555NIHFY33WEDXKA2L3ANCNFSM6AAAAAAY4OUPTU . You are receiving this because you commented.Message ID: @.***>

clau-bucur commented 1 year ago

I'm searching the same in the meantime. Found no trace of the pymoebot folder yet though!

clau-bucur commented 1 year ago

Found it, with the help of https://community.home-assistant.io/t/access-python-core-folder-of-raspberry-pi-ha-os/453018. It's located under /usr/local/lib/python3.10/site-packages/pymoebot.

I've changed the protocol version and voila! image

Whytey commented 1 year ago

Well, well! That is exciting.

I wonder what, if anything, if possible with the firmware version you're running (that provide TUYA 3.4) vs the firmware I have (that provides TUYA 3.3)!?

Thanks for helping. As soon as I am out of this busy work period I will ensure we update the integration and pymoebot library to address this. We should leave this issue open until then.

In the meantime, I am keen to hear if you have control working and whether your mower behaves OK while running the integration.

clau-bucur commented 1 year ago

It is exciting indeed, and you made it possible!

Not sure what you mean regarding the differences between 3.4 vs 3.3?

Will get back with feedback. First I'll create a couple of scripts for mow and park to handle transitions regardless of the current state the mower is. Only by having that, the mower can be automated. I'll add the scripts, once I have them, to #7 just for reference.

clau-bucur commented 1 year ago

Ok, I can say everything works good. By overriding the Tuya protocol version and using the scripts I added at #7 I have no problems automating the mower.

Somehow the library got overwritten and the protocol reverted to 3.3 so I had to change it again. Adding this option would be really helpful here.

Thanks.

Whytey commented 12 months ago

Closing this. The pymoebot library tries to auto-detect the protocol version. If this doesn't provide appropriate coverage in the future, we may look to rectify this.