lazdavila / pescea Goto Github PK
View Code? Open in Web Editor NEWpescea - python interface to Escea fireplaces
License: GNU General Public License v3.0
pescea - python interface to Escea fireplaces
License: GNU General Public License v3.0
It would be very helpful if you could tag releases as well again. This would enable distributions to fetch the source from GitHub instead of PyPI.
Thanks
On Python 3.10 the tests don't pass due to the the removal of loop
.
Executing pytestCheckPhase
============================= test session starts ==============================
platform linux -- Python 3.10.4, pytest-7.1.1, pluggy-1.0.0
rootdir: /build/source
plugins: asyncio-0.18.3, mock-3.7.0
asyncio: mode=legacy
collected 26 items / 2 deselected / 24 selected
tests/test_controller.py FFFFF [ 20%]
tests/test_datagram.py FFF [ 33%]
tests/test_discovery.py FFFF [ 50%]
tests/test_fullstack.py FF [ 58%]
tests/test_live_fireplace.py s [ 62%]
tests/test_message.py ...... [ 87%]
tests/test_simple_udp.py ... [100%]
=================================== FAILURES ===================================
____________________________ test_controller_basics ____________________________
mocker = <pytest_mock.plugin.MockerFixture object at 0x7ffff632b1c0>
@mark.asyncio
async def test_controller_basics(mocker):
mocker.patch(
"pescea.udp_endpoints.open_datagram_endpoint", patched_open_datagram_endpoint
)
mocker.patch("pescea.controller.ON_OFF_BUSY_WAIT_TIME", 0.2)
mocker.patch("pescea.controller.REFRESH_INTERVAL", 0.1)
mocker.patch("pescea.controller.RETRY_INTERVAL", 0.1)
mocker.patch("pescea.controller.RETRY_TIMEOUT", 0.3)
mocker.patch("pescea.controller.DISCONNECTED_INTERVAL", 0.5)
> discovery = DiscoveryService()
tests/test_controller.py:25:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pescea/discovery.py:151: in __init__
self.sending_lock = Lock(loop=self.loop)
/nix/store/l2pcq9csf136rc04r5sw96nmm5pv0l7h-python3-3.10.4/lib/python3.10/asyncio/locks.py:78: in __init__
super().__init__(loop=loop)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <[AttributeError("'Lock' object has no attribute '_locked'") raised in repr()] Lock object at 0x7ffff632a470>
def __init__(self, *, loop=_marker):
if loop is not _marker:
> raise TypeError(
f'As of 3.10, the *loop* parameter was removed from '
f'{type(self).__name__}() since it is no longer necessary'
)
E TypeError: As of 3.10, the *loop* parameter was removed from Lock() since it is no longer necessary
/nix/store/l2pcq9csf136rc04r5sw96nmm5pv0l7h-python3-3.10.4/lib/python3.10/asyncio/mixins.py:17: TypeError
________________________ test_controller_change_address ________________________
mocker = <pytest_mock.plugin.MockerFixture object at 0x7ffff68b7b20>
@mark.asyncio
async def test_controller_change_address(mocker):
mocker.patch(
"pescea.udp_endpoints.open_datagram_endpoint", patched_open_datagram_endpoint
)
mocker.patch("pescea.controller.ON_OFF_BUSY_WAIT_TIME", 0.2)
mocker.patch("pescea.controller.REFRESH_INTERVAL", 0.1)
mocker.patch("pescea.controller.RETRY_INTERVAL", 0.1)
mocker.patch("pescea.controller.RETRY_TIMEOUT", 0.3)
mocker.patch("pescea.controller.DISCONNECTED_INTERVAL", 0.5)
mocker.patch("pescea.datagram.REQUEST_TIMEOUT", 0.3)
> discovery = DiscoveryService()
[...]
Current implementation defaults to discovery on 255.255.255.255
Unfortunately this doesn't work when there is more than 1 network interface: messages sent to 255.255.255.255 will just get routed to whatever interface based on routing table - likely the default route. If the Escea fireplace is not on the same network, it won't be discovered.
Suggested approach: iterate over each network interface, find the broadcast addresses for each, and send a discovery message to each broadcast address. (eg. if eth0 has address 192.168.1.2/24 and eth1 has adress 192.168.2.50/24, then a message should be sent to each of 192.168.1.255 and 192.168.2.255)
This is the approach taken by pizone which similarly uses UDP broadcasts for controller discovery:
https://github.com/Swamp-Ig/pizone/blob/ef2eeb2ae22dd4435c0c5bb4e1fe365d45af8c1a/pizone/discovery.py#L268-L281
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.