Commit graph

84 commits

Author SHA1 Message Date
Sid
00ec7f11f0
Enable Ruff rule PT007 ()
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2024-03-19 09:01:07 +01:00
Sid
727581eea3
Add first batch of Ruff PT rules ()
* Add first batch of Ruff PT rules

* fix weather test

* Fix pilight test

* Update test_intent.py

* Update pilight test_init.py

* Update test_init.py
2024-03-18 13:26:14 +01:00
jan iversen
02d4bf007d
Do not allow modbus config without entities () 2024-03-15 19:49:29 +01:00
jan iversen
7cba34b2e6
Change modbus integration to use async library calls () 2024-03-14 23:19:52 +01:00
jan iversen
7696973932
Move modbus check_config to setup, to have access to hass () 2024-03-14 12:54:01 +01:00
jan iversen
59083b4e82
Remove deprecated retry_on_empty from modbus ()
Remove deprecated retry_on_empty.
2024-03-09 13:59:09 +01:00
jan iversen
797983236f
Remove deprecated CLOSE_COMM_ON_ERROR from modbus () 2024-03-09 13:24:06 +01:00
jan iversen
fca3ac9903
Update modbus test to include a dummy sensor () 2024-03-09 12:19:57 +01:00
jan iversen
ea89fa6b1e
Allow duplicate names in different modbus entities ()
Allow duplicate names in different entities.
2024-03-08 15:10:35 +01:00
Marc Mueller
1722e23df8
Add empty line after module docstring [tests l-p] () 2024-03-08 14:55:15 +01:00
jan iversen
4a1681bb4b
Allow duplicate modbus addresses on different devices () 2024-03-05 22:11:04 +01:00
Claudio Ruggeri - CR-Tech
1ded412061
Add modbus option to manage different setPoint registers ()
Co-authored-by: jan iversen <jancasacondor@gmail.com>
2024-02-17 19:48:42 +01:00
jan iversen
90ec361fc9
Centralize validation for modbus config ()
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2024-02-02 12:42:12 +01:00
jan iversen
3cc5ffaa4b
Replace modbus number_validator by HA standard () 2024-01-27 16:39:33 +01:00
CR-Tech
df9faeae6f
Add write_registers support for Fan Mode in modbus () 2024-01-24 20:48:55 +01:00
jan iversen
d8f16c14ab
Get modbus coverage back to 100% ()
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2024-01-23 21:50:25 +01:00
Cían Hughes
e051244927
Add Modbus fan speed support ()
Co-authored-by: jan iversen <jancasacondor@gmail.com>
2023-12-07 08:19:03 +01:00
jan iversen
9931f45532
Deprecate modbus parameter retry_on_empty () 2023-09-16 21:14:52 +02:00
jan iversen
568974fcc4
Modbus 100% test coverage (again) () 2023-09-16 14:00:22 +02:00
jan iversen
fd83f7d87f
Add test for modbus CONF_DEVICE_ADDR () 2023-09-15 16:12:44 +02:00
jan iversen
9eb0b844bc
Test VIRTUAL_COUNT parameter () 2023-09-15 15:02:24 +02:00
jan iversen
d4a2927ebe
Solve racing problem in modbus test ()
* Test racing problem.

* review comment.

* Revert to approved state.

This reverts commit 983d9d68e8.
2023-09-14 16:03:32 +02:00
jan iversen
71207e112e
Bring modbus naming in sync with standard () 2023-09-12 10:59:50 +02:00
jan iversen
9ef3ec3dd3
Add modbus test for configuration errors () 2023-08-30 11:34:51 +02:00
jan iversen
1c56c39897
modbus config: count and slave_count can normally not be mixed. () 2023-08-18 13:10:13 +02:00
jan iversen
59d37f65d5
Correct modbus config validator: slave/swap () 2023-08-18 10:55:39 +02:00
jan iversen
fc463e5831
modbus: remove unused constants and get 100% coverage. () 2023-08-08 16:40:16 +02:00
Johannes Wagner
c4a5373976
Handle explicit Modbus NaN values ()
Co-authored-by: jan iversen <jancasacondor@gmail.com>
2023-08-06 13:47:54 +02:00
jan iversen
48607d0586
Bump pymodbus to 3.3.1 () 2023-06-08 15:57:49 +02:00
jan iversen
cd23caff58
Correct modbus serial method parameter () 2023-03-15 12:27:45 +01:00
jan iversen
b11539fb04
Move connect method into a task ()
Move connect() into a task.
2023-02-20 08:32:47 +01:00
Franck Nijhof
1e05697080
Enable Ruff B007 ()
* Enable Ruff B007

* Adjust existing cases
2023-02-17 21:08:18 -05:00
Franck Nijhof
d3ed8de232
Update Ruff to v0.0.247 ()
* Update Ruff to v0.0.247

* Fix new found violations
2023-02-15 16:46:03 -05:00
Franck Nijhof
ed79265843
Enable Ruff PT006 ()
* Enable Ruff PT006

* Adjust existing cases

* Fix tests

* Remove unneeded parentheses
2023-02-15 14:09:50 +01:00
epenet
50cbabb2d8
Add type hints to integration tests (part 15) () 2023-02-15 10:00:49 +01:00
epenet
f75ac17554
Add type hints to integration tests (j-m) () 2023-02-08 19:06:59 +01:00
epenet
aa00114c2f
Add return type to async tests without arguments () 2023-02-07 10:26:56 +01:00
Franck Nijhof
5e81d28116
Update black to 23.1.0 () 2023-02-02 18:35:24 +01:00
Franck Nijhof
ef800335fb
Enable Ruff PT022 ()
* Enable Ruff PT022

* Adjust found cases
2023-01-27 13:57:06 +01:00
jan iversen
ee85a23d19
Bring modbus back to 100% test coverage ()
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-01-16 15:44:11 +01:00
Joakim Plate
c576a68d33
Upgrade pytest-aiohttp ()
* Upgrade pytest-aiohttp

* Make sure executors, tasks and timers are closed

Some test will trigger warnings on garbage collect, these warnings
spills over into next test.

Some test trigger tasks that raise errors on shutdown, these spill
over into next test.

This is to mimic older pytest-aiohttp and it's behaviour on test
cleanup.

Discussions on similar changes for pytest-aiohttp are here:
https://github.com/pytest-dev/pytest-asyncio/pull/309

* Replace loop with event_loop

* Make sure time is frozen for tests

* Make sure the ConditionType is not async

  /home-assistant/homeassistant/helpers/template.py:2082: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    def wrapper(*args, **kwargs):
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

* Increase litejet press tests with a factor 10

The times are simulated anyway, and we can't stop the normal
event from occuring.

* Use async handlers for aiohttp

tests/components/motioneye/test_camera.py::test_get_still_image_from_camera
tests/components/motioneye/test_camera.py::test_get_still_image_from_camera
tests/components/motioneye/test_camera.py::test_get_stream_from_camera
tests/components/motioneye/test_camera.py::test_get_stream_from_camera
tests/components/motioneye/test_camera.py::test_camera_option_stream_url_template
tests/components/motioneye/test_camera.py::test_camera_option_stream_url_template
  /Users/joakim/src/hass/home-assistant/venv/lib/python3.9/site-packages/aiohttp/web_urldispatcher.py:189: DeprecationWarning: Bare functions are deprecated, use async ones
    warnings.warn(

* Switch to freezegun in modbus tests

The tests allowed clock to tick in between steps

* Make sure skybell object are fully mocked

Old tests would trigger attempts to post to could services:

```
DEBUG:aioskybell:HTTP post https://cloud.myskybell.com/api/v3/login/ Request with headers: {'content-type': 'application/json', 'accept': '*/*', 'x-skybell-app-id': 'd2b542c7-a7e4-4e1e-b77d-2b76911c7c46', 'x-skybell-client-id': '1f36a3c0-6dee-4997-a6db-4e1c67338e57'}
```

* Fix sorting that broke after rebase
2022-11-29 22:36:36 +01:00
Joakim Plate
8bd4125390
Test corrections noticed during pytest upgrade ()
* Withing trigger a call to coordinator after init

* Stop discovery task on STOP event

* Stop dsmr connection task on STOP

* Use autospec in modem_serial tests

close on AioSerial is non async, and should not be mocked as a coroutine

* Make sure responder is specced correctly

tests/components/emulated_hue/test_init.py::test_setup_works
  /Users/joakim/src/hass/home-assistant/homeassistant/components/emulated_hue/__init__.py:119: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited
    protocol.close()

* Don't assume Pymodbus is the only thing logging

* Use gather instead of wait

```
homeassistant/components/homeassistant/__init__.py:208: DeprecationWarning: The explicit passing of coroutine objects to asyncio.wait() is deprecated since Python 3.8, and scheduled for removal in Python 3.11.
```

* Increase wait time for automation tests

Assuming exit within 1 seconds is unreasonable on a potentially loaded
test machine.

* Avoid changing app state after startup
2022-11-23 20:53:28 +01:00
J. Nick Koston
077bd594eb
Fix modbus test assuming repeat listeners always fire at 0 microseconds () 2022-11-18 14:23:42 +01:00
jan iversen
1a79118600
Fix modbus reload service ()
* Fix modbus reload service.

* Please coverage.

* Resolve difference between local pytest and github.
2022-03-12 14:12:38 +02:00
jan iversen
e891df0ff3
Allow multi read of Modbus sensor () 2022-02-28 11:07:55 -08:00
jan iversen
6ec9c402b1
Remove generic data types INT, UINT, FLOAT in modbus () 2022-02-26 13:27:48 -08:00
jan iversen
8233278ccc
Correct tests to use data_type in Modbus () 2022-02-25 11:37:52 -08:00
jan iversen
c6f5633e24
Fix modbus test_delay () 2022-02-25 08:06:25 -08:00
jan iversen
adc4c1e33f
Secure ATTR_ and CONF_ use identical texts in Modbus () 2022-02-25 08:05:19 -08:00
jan iversen
9131fb39fe
Allow "slave" parameter in modbus service calls ()
* Allow "slave" parameter in modbus service calls.
2022-02-24 13:35:45 +01:00