diff --git a/setup.py b/setup.py index ad8cd83..70f32cf 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,8 @@ setuptools.setup( 'pyamaha @ git+https://github.com/nduhamel/pyamaha.git@citadel#egg=pyamaha', 'citadel.mqtt @ git+https://git.quimbo.fr/citadel/mqtt.git@master#egg=citadel.mqtt', 'systemd-python==234', - 'typer==0.3.2' + 'typer==0.3.2', + 'tenacity==8.0.1' ] ) diff --git a/src/yamaha2mqtt/app.py b/src/yamaha2mqtt/app.py index 39054d0..4cd1e28 100644 --- a/src/yamaha2mqtt/app.py +++ b/src/yamaha2mqtt/app.py @@ -2,6 +2,8 @@ import logging import json import requests +from tenacity import retry, stop_after_attempt, wait_fixed + from pyamaha import Device, System, Zone from citadel.mqtt import Client @@ -39,6 +41,7 @@ class Yamaha: for action in senario.deactivate: self.request(action) + @retry(stop=stop_after_attempt(3), wait=wait_fixed(1), reraise=True) def request(self, request): try: r = self._device.request(request)