TomerFi / aioswitcher

PyPi module integrating with various Switcher devices
https://aioswitcher.tomfi.info
Apache License 2.0
27 stars 19 forks source link

Control command on breeze is stuck #781

Open ayal opened 1 month ago

ayal commented 1 month ago

What happened?

Switcher Breeze_8C01

Sending a control command is stuck on reading response

Hacky fix

After sniffing a bit with wireshark, I changed the code to this and it worked:

BREEZE_COMMAND_PACKET = (
     "fef0" + "0a010" + "3050102" + "{}0000" + "01000000" + "{}" + "000000" + "{}" + "00000000000000000000" + "f0fe" + "{}" + "008828e9111cb3f472f33bf96af2fcc8f9f07f7b11a436cff65fd6a8c9082a6c1049201a" + "3701" + "{}{}"
)
 packet = packets.BREEZE_COMMAND_PACKET.format(
                    login_resp.session_id,
                    self._device_id,
                    timestamp,
                    self._device_id,
                    command.length,
                    command.command,
                    timestamp
                )

but I had to remove packet = set_message_length(packet) and couldn't figure out how to set it correctly, so this is not yet a real bug-fix and PR ready

Module Version

3.4.4.dev

Device Type

Switcher Breeze

Firmware Version

2.20

Relevant log output

No response

TomerFi commented 1 month ago

Thank you @ayal

@thecode, @YogevBokobza, did you come across this by any chance?

YogevBokobza commented 1 month ago

I will take a look on this in between my integration od Runner S11 in the HA code

thecode commented 1 month ago

Thank you @ayal

@thecode, @YogevBokobza, did you come across this by any chance?

No, the only report I have seen was a device issue (device worked again after it was rebooted)

YogevBokobza commented 1 month ago

I wasn't able to replicate this. All my breeze devices worked right away without delay..

@ayal Can you show me the Python command you run to communicate with the device? What is the firmware of the device? (As seen in the Switcher App)

ayal commented 1 month ago

Hi @YogevBokobza thanks for looking into it

For context - my Switcer is a brand new switcher

Application version is 2.53 On the device screen it says Switcher Breeze_8C01 on the top (as mentioned above), is this the firmware version? Is there another version number listed anywhere?

Regarding Can you show me the Python command you run to communicate with the device - wdym? I run aioswitcher with only the above code changed:

You can see it here: https://github.com/ayal/switcher-hack/blob/main/src/aioswitcher/api/packets.py#L76 https://github.com/ayal/switcher-hack/blob/main/src/aioswitcher/api/__init__.py#L673 https://github.com/ayal/switcher-hack/blob/main/src/aioswitcher/api/__init__.py#L685

The rest of the commands flow seem to work fine (i.e login, discovery)

Would love to help get this fixed

ybokobza commented 1 month ago

Hi @YogevBokobza thanks for looking into it

For context - my Switcer is a brand new switcher

Application version is 2.53 On the device screen it says Switcher Breeze_8C01 on the top (as mentioned above), is this the firmware version? Is there another version number listed anywhere?

Regarding Can you show me the Python command you run to communicate with the device - wdym? I run aioswitcher with only the above code changed:

  • BREEZE_COMMAND_PACKET changed
  • removed packet = set_message_length(packet) (since it's probably embedded in the command I send already?)

You can see it here: https://github.com/ayal/switcher-hack/blob/main/src/aioswitcher/api/packets.py#L76 https://github.com/ayal/switcher-hack/blob/main/src/aioswitcher/api/__init__.py#L673 https://github.com/ayal/switcher-hack/blob/main/src/aioswitcher/api/__init__.py#L685

The rest of the commands flow seem to work fine (i.e login, discovery)

Would love to help get this fixed

Go to the Switcher App then Settings and then Firmware settings and let me know your Breeze firmware version.

How did you call the Python scripts/control_device.py? which parameters?

ayal commented 1 month ago

I am using Switcher app on the iPhone and can't find such settings option, this is what my app settings page looks like:

Can I run something in code to find it? Is it passed somehow in the discovery payload?

From the command line I used:

python scripts/control_device.py control_thermostat  -v -d DEVICE_ID -i "10.100.x.x" -r REMOTE_ID -s on -l DEVICE_KEY -m cool -f low -t 25

Would it help if I actually wrote the values for IP, DEVICE_ID, REMOTE_ID etc..?

From code I am calling control_breeze_device like this:

remote_manager = SwitcherBreezeRemoteManager()
await control_breeze_x(IP, MY_IP, DEVICE_ID, DEVICE_KEY, remote_manager, REMOTE_ID)
...
await api.control_breeze_device(
                    remote,
                    new_state,
                    ThermostatMode.COOL,
                    turn_on_temp,
                    fan_level,
                    ThermostatSwing.OFF,
                )
YogevBokobza commented 1 month ago

I am using Switcher app on the iPhone and can't find such settings option, this is what my app settings page looks like:

Can I run something in code to find it? Is it passed somehow in the discovery payload?

From the command line I used:

python scripts/control_device.py control_thermostat  -v -d DEVICE_ID -i "10.100.x.x" -r REMOTE_ID -s on -l DEVICE_KEY -m cool -f low -t 25

Would it help if I actually wrote the values for IP, DEVICE_ID, REMOTE_ID etc..?

From code I am calling control_breeze_device like this:

remote_manager = SwitcherBreezeRemoteManager()
await control_breeze_x(IP, MY_IP, DEVICE_ID, DEVICE_KEY, remote_manager, REMOTE_ID)
...
await api.control_breeze_device(
                    remote,
                    new_state,
                    ThermostatMode.COOL,
                    turn_on_temp,
                    fan_level,
                    ThermostatSwing.OFF,
                )

By the picture, those are not the device firmware.. I don't know where it is in iPhone.. You can't by the code..

Try to look for devices and there should be a firmware version per device.

YogevBokobza commented 1 month ago

I am using Switcher app on the iPhone and can't find such settings option, this is what my app settings page looks like:

Can I run something in code to find it? Is it passed somehow in the discovery payload?

From the command line I used:

python scripts/control_device.py control_thermostat  -v -d DEVICE_ID -i "10.100.x.x" -r REMOTE_ID -s on -l DEVICE_KEY -m cool -f low -t 25

Would it help if I actually wrote the values for IP, DEVICE_ID, REMOTE_ID etc..?

From code I am calling control_breeze_device like this:

remote_manager = SwitcherBreezeRemoteManager()
await control_breeze_x(IP, MY_IP, DEVICE_ID, DEVICE_KEY, remote_manager, REMOTE_ID)
...
await api.control_breeze_device(
                    remote,
                    new_state,
                    ThermostatMode.COOL,
                    turn_on_temp,
                    fan_level,
                    ThermostatSwing.OFF,
                )

I ran the same command as you plus adding -c "Switcher Breeze" as needed after the recent code update and it worked for me. I got a response immediately and the AC turned on.

Please take a look at the device version and let me know.

I have more questions:

  1. Do you have multiple Breeze devices? If yes, do they all behave the same? it's only 1 device acting slowly?
  2. The device is far away from the WIFI network? If you go with your phone there and do a speed test what you are getting?
  3. It was like this from day one or this is a new issue?
  4. The response is late but does the action eventually happen?
ayal commented 1 month ago

patched the code with my patch (i.e new BREEZE_COMMAND_PACKET and not setting length) and it immediately works

To your questions:

  1. No multiple devices, just one new Switcher Breeze
  2. I have very strong WiFi and the device is super close to it
  3. It was like this from day one
  4. The response is not late, it's just stuck on reading the response (and the command doesn't work), not throwing an error