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

Error: 'b' format requires -128 <= number <= 127 #208

Closed
WallisNi opened this issue Nov 1, 2024 · 38 comments
Closed

Error: 'b' format requires -128 <= number <= 127 #208

WallisNi opened this issue Nov 1, 2024 · 38 comments

Comments

@WallisNi
Copy link

WallisNi commented Nov 1, 2024

Hi!

Firstly, thank you for all the effort put into this!

Now, since a few days, don't know when for sure, I'm getting the following error message for any attempt setting of my device, haori.

Error: 'b' format requires -128 <= number <= 127

Is there anything I can do to resolve this? Reinstall is not helping.

@WallisNi
Copy link
Author

WallisNi commented Nov 1, 2024

So, I opened the Toshiba Android app and agreed to the new terms. It seems to have resolved the issue. Will update if it reappears.

@WallisNi
Copy link
Author

WallisNi commented Nov 1, 2024

And updating again. The integration failed again. But after opening the official app and instantly returning to make changes in HA the setting changed.

@cuetus
Copy link

cuetus commented Nov 4, 2024

Same problem. Also reloading the integration solves the issue for some time, then it returns with no clear pattern.

@WallisNi
Copy link
Author

WallisNi commented Nov 4, 2024

I've been okay a couple of days now. But still unsure what caused the initial issue. Will report back if it reappears.

@cuetus
Copy link

cuetus commented Nov 10, 2024

I put integration reload to happen every morning at 3:50AM, but this morning it has failed again. This same error coming from every function, does not matter if I try to set fan speed, temperature, operating mode or what. But again, reloading the integration fixed the issue... until next time.

@cuetus
Copy link

cuetus commented Nov 10, 2024

Now it's impossible to use, it has failed again... home assistant 2024.10.4, latest integration

2024-11-02 20:00:00.254 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140464068261440] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 996, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1068, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 758, in async_handle_set_fan_mode_service
    await self.async_set_fan_mode(fan_mode)
  File "/config/custom_components/toshiba_ac/climate.py", line 211, in async_set_fan_mode
    await self._device.set_ac_fan_mode(feature_list_id)
  File "/usr/local/lib/python3.12/site-packages/toshiba_ac/device/__init__.py", line 285, in set_ac_fan_mode
    await self.send_state_to_ac(state)
  File "/usr/local/lib/python3.12/site-packages/toshiba_ac/device/__init__.py", line 147, in send_state_to_ac
    future_state = ToshibaAcFcuState.from_hex_state(self.fcu_state.encode())
                                                    ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/toshiba_ac/device/fcu_state.py", line 281, in encode
    encoded = self.ENCODING_STRUCT.pack(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
struct.error: 'b' format requires -128 <= number <= 127

@cuetus
Copy link

cuetus commented Nov 19, 2024

The way to use this now is in automations by first reloading the integration and then doing what you need to do, this same every time you want to change something. Don't know if this is specific to just Toshiba Polar 35 with adapter version 2.4.00.

@Arno-MA-73
Copy link

I have the same problem. Home Assistant 2024.11.2, adapter version 2.4.00. We have a Toshiba multi split system with two indoor units: a Premium 13+ model and a floor model.

I have used this Toshiba integration for almost a year, and the last couple of days it has become unusable.

@Arno-MA-73
Copy link

Here is the log entry I see:

Logger: homeassistant.components.automation.turn_off_heat_pump_when_warm
Source: components/automation/init.py:743
integration: Automation (documentation, issues)
First occurred: 09:49:26 (4 occurrences)
Last logged: 20:49:23

While executing automation automation.turn_off_heat_pump_when_warm
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/automation/init.py", line 743, in async_trigger
return await self.action_script.async_run(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1801, in async_run
return await asyncio.shield(create_eager_task(run.async_run()))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 464, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 528, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 558, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 526, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 781, in _async_device_step
await device_action.async_call_action_from_config(
File "/usr/src/homeassistant/homeassistant/components/device_automation/action.py", line 72, in async_call_action_from_config
await platform.async_call_action_from_config(hass, config, variables, context)
File "/usr/src/homeassistant/homeassistant/components/climate/device_action.py", line 98, in async_call_action_from_config
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 2802, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2845, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1007, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1079, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/climate/init.py", line 772, in async_handle_set_hvac_mode_service
await self.async_set_hvac_mode(hvac_mode)
File "/config/custom_components/toshiba_ac/climate.py", line 194, in async_set_hvac_mode
await self._device.set_ac_status(ToshibaAcStatus.OFF)
File "/usr/local/lib/python3.12/site-packages/toshiba_ac/device/init.py", line 246, in set_ac_status
await self.send_state_to_ac(state)
File "/usr/local/lib/python3.12/site-packages/toshiba_ac/device/init.py", line 147, in send_state_to_ac
future_state = ToshibaAcFcuState.from_hex_state(self.fcu_state.encode())
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/toshiba_ac/device/fcu_state.py", line 281, in encode
encoded = self.ENCODING_STRUCT.pack(
^^^^^^^^^^^^^^^^^^^^^^^^^^
struct.error: 'b' format requires -128 <= number <= 127

@pjylkka
Copy link

pjylkka commented Nov 21, 2024

Yes, this is becoming hurtful. Rebooting HA will fix it for sometime, but after half hour/hour or so - changing for example temperature becomes impossible and automations won't work due of:

[140061020839296] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2802, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2845, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1007, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1079, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 1029, in async_service_temperature_set
    await entity.async_set_temperature(**kwargs)
  File "/config/custom_components/toshiba_ac/climate.py", line 120, in async_set_temperature
    await self._device.set_ac_temperature(set_temperature)
  File "/usr/local/lib/python3.12/site-packages/toshiba_ac/device/__init__.py", line 275, in set_ac_temperature
    await self.send_state_to_ac(state)
  File "/usr/local/lib/python3.12/site-packages/toshiba_ac/device/__init__.py", line 147, in send_state_to_ac
    future_state = ToshibaAcFcuState.from_hex_state(self.fcu_state.encode())
                                                    ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/toshiba_ac/device/fcu_state.py", line 281, in encode
    encoded = self.ENCODING_STRUCT.pack(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
struct.error: 'b' format requires -128 <= number <= 127

@AtzeDeVries
Copy link

same issue here as well...

@wiblaa
Copy link

wiblaa commented Nov 22, 2024

Same issue here... making a change in the Toshiba app on the phone helps for a while, or until sufficient commands have been sent from HA, then it breaks again.
Edit: if I open the AC unit in the app on my phone and then try to send commands from HA, it works.

@DjLysy
Copy link

DjLysy commented Nov 22, 2024

It just happened to me after accepting new terma in Toshiba mobile app. After that, i have reloaded the HA Toshiba integration plugin and started to work again correctly

@wiblaa
Copy link

wiblaa commented Nov 22, 2024

It just happened to me after accepting new terma in Toshiba mobile app. After that, i have reloaded the HA Toshiba integration plugin and started to work again correctly

Does it work after a few hours?

@cuetus
Copy link

cuetus commented Nov 22, 2024

Screenshot 2024-11-22 at 12 25 41
No, the terms and conditions have been accepted etc but it still fails, in the screenshot 30 minutes ago the last time when the check was run. I run this like this now, using node red instead of HA automations, my automations run at every hour, so 1 minute before I get the status out, if that works I set the fan mode to whatever the status returned (=no change) and if either of these nodes fail I reload the integration. So.. that is a workaround that works for me.

@AtzeDeVries
Copy link

It just happened to me after accepting new terma in Toshiba mobile app. After that, i have reloaded the HA Toshiba integration plugin and started to work again correctly

This works only for a limited time. Reloading the integration fixes this, but for a limited time again.

@johnbrady833
Copy link

Thanks @pjylkka, I raised #211 and I think you're right, that's a duplicate of this issue.

I found that rolling back from HA 2024.11.2 to an earlier version fixed it, so I assume something has changed in 2024.11.2 that is incompatible with this integration. Someone mentioned on the other thread that there was a change in the Websocket implementation which had caused other plugins to break.

@wiblaa
Copy link

wiblaa commented Nov 22, 2024

I rolled back to:
Core 2024.10.4
Supervisor 2024.11.4
... and still see the same issue. Weirdness.

@johnbrady833
Copy link

@wiblaa I'm now seeing the same issue. After opening the Toshiba app and clicking "Agree", the integration doesn't work for me either.

@psoininen
Copy link

Same issue, probably appeared already a couple days ago with some automation acting up but only noticed the same error message trying to set fan manually now: 'b' format requires -128 <= number <= 127. Have not updated core beyond 10.4.

@WallisNi
Copy link
Author

WallisNi commented Nov 22, 2024 via email

@WallisNi
Copy link
Author

Error seems to be present att about 3/4 of commands. Can't figure out if there are other circumstances causing it. Looking into using Google assistant instead until plugin is updated. Not ideal, but at least commands seem to get sent that way.

@elsonico
Copy link

elsonico commented Nov 24, 2024

I have same issue. Even when it works little while after restart this totally breaks my automation which does not work anymore due this.

I'm running 2024.11.0 so it's not like it is only on never 2024.11 versions. I'm pretty sure all was working few weeks after upgrade and I only hit this recently so it is constantly an issue on my automation.

@cuetus
Copy link

cuetus commented Nov 25, 2024

Toshiba must be changing something. Integration has started to go 'unavailable' after a while now, need to test for that status as well instead of just catching the exceptions in the reloading health checks. Reloading the integration fixes that as well, until it breaks again.

@MickeBergman
Copy link

I also have this since some time. It comes and goes by random.
And even more confusing but might help solving is that I have 2 heat pumps and one works and the other not.
Now I tried and the "non-working" accepted commands from the Toshiba app. And HA immediately showed the changes. AND worked for one command and then back to the error.

@pbock
Copy link

pbock commented Nov 25, 2024

This seems to be an issue with the toshiba-ac package where I’ve submitted an issue. I have a suspicion that this only happens when outside temperatures are below zero, does that seem right?

@wiblaa
Copy link

wiblaa commented Nov 25, 2024

We dropped below freezing a few days ago, so that tracks...

@MickeBergman
Copy link

This actually could be. One of mine is -5 and gives the error - other +6 and works.

@WallisNi
Copy link
Author

Seems to be the case for me also. Don't have the logs to verify, but the automation traces for yesterday and today are ok, and we've been above zero during that time. Nice catch @pbock !

@Arno-MA-73
Copy link

I suspect that is correct. I was already wondering why my automations had been working correctly since Sunday. I still have occasional "state reload failed" messages, but nothing more serious.

@cuetus
Copy link

cuetus commented Nov 26, 2024

Screenshot 2024-11-26 at 14 04 01 Yep, we have been below 0 last month.

@narfotic
Copy link

narfotic commented Nov 26, 2024

Having these issues as well. Not below zero at the moment.

@Arno-MA-73
Copy link

@h4de5 could you have a look at this issue please? Temperatures will be below zero next week and I suspect that my Toshiba automations will break then again.

@h4de5
Copy link
Owner

h4de5 commented Nov 29, 2024

as you have already stated, this error is coming from the api package below. the integration here is just a shell for that. this is the same for most of the other issues here too - there is hardly anything i can change.

@stianhaugli
Copy link

stianhaugli commented Dec 5, 2024

+1 from Norway. having the same issue when outdoor temp drops below zero. it seems
pbock is quite right. kaSroka has just replied saying it'll be fixed, hopefully soon. thank you pbock (and h4de5!)

@superior99
Copy link

same issue here as well with (toshiba v[2024.9.0] and latest HA.
I get this error:
"cannot perform the action climate/set_temperature . 'b' format requires -128 <= number <= 127"

Opening Toshiba app and/or restarting HA solves the problem for a while, then it starts to give errors again shortly after that.

@pbock
Copy link

pbock commented Dec 5, 2024

Should be fixed in toshiba-ac v0.3.10 which has just been released! Any chance we could get this updated, @h4de5?

@h4de5
Copy link
Owner

h4de5 commented Dec 5, 2024

fixed in #214

@h4de5 h4de5 closed this as completed Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests