adamoutler/anycubic-python

Sensor not updating

kcam01 opened this issue · 3 comments

Getting this error in logs.

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 535, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 744, in async_device_update
    raise exc
  File "/config/custom_components/anycubic_wifi/sensor.py", line 113, in async_update
    self.set_attr_time(
  File "/config/custom_components/anycubic_wifi/sensor.py", line 144, in set_attr_time
    self._attr_extra_state_attributes[key] = int(value)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'time.struct_time'```

Status is not updating

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 535, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 744, in async_device_update
    raise exc
  File "/config/custom_components/anycubic_wifi/sensor.py", line 96, in async_update
    response: MonoXStatus = self.monox.getstatus()
  File "/config/custom_components/anycubic_wifi/api.py", line 21, in getstatus
    response = self.send_request("getstatus\r\n")
  File "/usr/local/lib/python3.9/site-packages/uart_wifi/communication.py", line 46, in send_request
    processed: MonoXResponseType = _do_handle(received)
  File "/usr/local/lib/python3.9/site-packages/uart_wifi/communication.py", line 160, in _do_handle
    recognized_response = __do_status(fields)
  File "/usr/local/lib/python3.9/site-packages/uart_wifi/communication.py", line 212, in __do_status
    status = MonoXStatus(fields)
  File "/usr/local/lib/python3.9/site-packages/uart_wifi/response.py", line 101, in __init__
    self.layers_remaining = message[4]
IndexError: list index out of range

new error with the intergration-0.5

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 535, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 744, in async_device_update
    raise exc
  File "/config/custom_components/anycubic_wifi/sensor.py", line 124, in async_update
    int(response.total_volume.replace("~", "", 1).replace("mL", "", 1)),
ValueError: invalid literal for int() with base 10: '11.3'

I just realized I wrote nothing here. Fixed 3-separarate issues relating to missing data and typing.