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

RFLink refactor bug with 'wait_for_ack: false' (again) #18103

Closed
javicalle opened this issue Nov 1, 2018 · 2 comments
Closed

RFLink refactor bug with 'wait_for_ack: false' (again) #18103

javicalle opened this issue Nov 1, 2018 · 2 comments

Comments

@javicalle
Copy link
Contributor

Home Assistant release with the issue:

Home Assistant v0.81.2

Last working Home Assistant release (if known):
Before the RFLink refactor (¿v0.80.3?)

Operating environment (Hass.io/Docker/Windows/etc.):

hassio v1.4.0

Component/platform:

RFLink platform

Description of problem:
After the RFLink platform refactor bug #17875 was detected for wait_for_ack: false configuration.
Supposedly PR #17889 fixed the issue. I tested the PR myself.
Now, after updating to the v0.81.2 error raises again.
I have no idea why this worked in my tests but not after the HA update. I have tried to recreate the same scenario without success.

Also I have tried to follow the code, but my python knowledge is not enough.
Again I'm pretty sure that problem is related with this part of code (the else part):

    async def _async_send_command(self, cmd, repetitions):
        .../...
        if self._wait_ack:
            # Puts command on outgoing buffer then waits for Rflink to confirm
            # the command has been send out in the ether.
            await self._protocol.send_command_ack(self._device_id, cmd)
        else:
            # Puts command on outgoing buffer and returns straight away.
            # Rflink protocol/transport handles asynchronous writing of buffer
            # to serial/tcp device. Does not wait for command send
            # confirmation.
            self._protocol.send_command(self._device_id, cmd)
        .../...

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

# RFLink component
rflink:
  port: /dev/ttyUSB0
  wait_for_ack: false
.../...
switch:
  - platform: rflink
    devices:
      eurodomest_0c66f3_01:
        name: Aukey 01

Traceback (if applicable):

2018-11-01 20:37:14 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
AttributeError: 'NoneType' object has no attribute 'send'
2018-11-01 20:37:16 INFO (MainThread) [homeassistant.components.climate.generic_thermostat] Turning on heater switch.aukey_01
2018-11-01 20:37:16 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
AttributeError: 'NoneType' object has no attribute 'send'
2018-11-01 20:58:02 INFO (MainThread) [homeassistant.components.climate.generic_thermostat] Turning off heater switch.aukey_01
2018-11-01 20:58:02 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
AttributeError: 'NoneType' object has no attribute 'send'

Additional information:
The two methods invoked (from rflink.protocol) are the following:

send_command_ack(self._device_id, cmd) (the if part)

  @asyncio.coroutine
  def send_command_ack(self, device_id, action):
      """Send command, wait for gateway to repond with acknowledgment."""
      # serialize commands
      yield from self._ready_to_send.acquire()
      acknowledgement = None
      try:
          self._command_ack.clear()
          self.send_command(device_id, action)

          log.debug('waiting for acknowledgement')
          try:
              yield from asyncio.wait_for(self._command_ack.wait(),
                                          TIMEOUT.seconds, loop=self.loop)
              log.debug('packet acknowledged')
          except concurrent.futures._base.TimeoutError:
              acknowledgement = {'ok': False, 'message': 'timeout'}
              log.warning('acknowledge timeout')
          else:
              acknowledgement = self._last_ack.get('ok', False)
      finally:
          # allow next command
          self._ready_to_send.release()

      return acknowledgement

send_command(self._device_id, cmd) (the else part)

    def send_command(self, device_id, action):
        """Send device command to rflink gateway."""
        command = deserialize_packet_id(device_id)
        command['command'] = action
        log.debug('sending command: %s', command)
        self.send_packet(command)
@MartinHjelmare
Copy link
Member

The fix hasn't been released yet. Please wait until at least the next beta with your test. If it still doesn't work then, please report back and we can reopen.

@javicalle
Copy link
Contributor Author

The fix hasn't been released yet. Please wait until at least the next beta with your test. If it still doesn't work then, please report back and we can reopen.

I'm really sorry. I was validating against the dev branch and I was not aware.
I was convinced that it was in the last release.

I still have a lot to learn.

@home-assistant home-assistant locked and limited conversation to collaborators Feb 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants