jan iversen
c268adb07e
modbus: Repair swap for slaves ( #97960 )
2023-08-18 13:23:04 +02:00
jan iversen
1c56c39897
modbus config: count and slave_count can normally not be mixed. ( #97902 )
2023-08-18 13:10:13 +02:00
jan iversen
59d37f65d5
Correct modbus config validator: slave/swap ( #97798 )
2023-08-18 10:55:39 +02:00
jan iversen
fc463e5831
modbus: remove unused constants and get 100% coverage. ( #97779 )
2023-08-08 16:40:16 +02:00
Johannes Wagner
c4a5373976
Handle explicit Modbus NaN values ( #90800 )
...
Co-authored-by: jan iversen <jancasacondor@gmail.com>
2023-08-06 13:47:54 +02:00
Bruno Enten
3ce05314e0
use write_registers also for target temp ( #97475 )
2023-08-02 13:36:05 +02:00
jan iversen
48607d0586
Bump pymodbus to 3.3.1 ( #94162 )
2023-06-08 15:57:49 +02:00
jan iversen
cd23caff58
Correct modbus serial method parameter ( #89738 )
2023-03-15 12:27:45 +01:00
jan iversen
b11539fb04
Move connect method into a task ( #88452 )
...
Move connect() into a task.
2023-02-20 08:32:47 +01:00
Franck Nijhof
1e05697080
Enable Ruff B007 ( #88356 )
...
* Enable Ruff B007
* Adjust existing cases
2023-02-17 21:08:18 -05:00
Franck Nijhof
d3ed8de232
Update Ruff to v0.0.247 ( #88210 )
...
* Update Ruff to v0.0.247
* Fix new found violations
2023-02-15 16:46:03 -05:00
Franck Nijhof
ed79265843
Enable Ruff PT006 ( #88165 )
...
* Enable Ruff PT006
* Adjust existing cases
* Fix tests
* Remove unneeded parentheses
2023-02-15 14:09:50 +01:00
Franck Nijhof
9030ca05b1
Enable Ruff SIM118 ( #87772 )
2023-02-15 12:39:12 +01:00
epenet
50cbabb2d8
Add type hints to integration tests (part 15) ( #88006 )
2023-02-15 10:00:49 +01:00
jan iversen
b9b5a279f2
Correct sensor restore entity in modbus ( #87563 )
...
* Correct sensor restore entity.
* Review comments.
2023-02-09 21:35:44 +01:00
epenet
f75ac17554
Add type hints to integration tests (j-m) ( #87704 )
2023-02-08 19:06:59 +01:00
epenet
aa00114c2f
Add return type to async tests without arguments ( #87612 )
2023-02-07 10:26:56 +01:00
epenet
810367b757
Fix `can not` typo ( #87254 )
2023-02-03 11:37:16 +01:00
GrahamJB1
8bff95014c
Add modbus min/max values ( #86131 )
...
* modbus min/max values
Co-authored-by: jan iversen <jancasacondor@gmail.com>
2023-02-02 22:29:03 +01:00
Franck Nijhof
5e81d28116
Update black to 23.1.0 ( #87188 )
2023-02-02 18:35:24 +01:00
Franck Nijhof
ef800335fb
Enable Ruff PT022 ( #86792 )
...
* Enable Ruff PT022
* Adjust found cases
2023-01-27 13:57:06 +01:00
GrahamJB1
200d3ae845
modbus slave unique ids ( #86126 )
...
modbus slave unique ids
2023-01-19 11:08:11 +01:00
jan iversen
ee85a23d19
Bring modbus back to 100% test coverage ( #85972 )
...
Co-authored-by: epenet <6771947+epenet@users.noreply.github.com>
2023-01-16 15:44:11 +01:00
Joakim Plate
c576a68d33
Upgrade pytest-aiohttp ( #82475 )
...
* 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
jan iversen
8ed4ce64c3
Solve modbus binary slave problem ( #82338 )
...
* Solve modbus binary slave problem.
2022-11-26 11:11:50 +01:00
Joakim Plate
8bd4125390
Test corrections noticed during pytest upgrade ( #82579 )
...
* 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
jan iversen
15176300e2
Add full test of wrap option ( #82308 )
...
fixes undefined
2022-11-22 09:57:04 +01:00
J. Nick Koston
077bd594eb
Fix modbus test assuming repeat listeners always fire at 0 microseconds ( #82320 )
2022-11-18 14:23:42 +01:00
Avishay
92b5721f80
Fix modbus hvac mode keys ( #81747 )
...
Change the HVAC mode register conf constants
2022-11-09 11:09:21 +01:00
Benjamin Salchow
1d633ac484
Accept input register in Modbus binary sensor ( #81352 )
...
Adds input register as valid option for modbus binary_sensor
Co-authored-by: jan iversen <jancasacondor@gmail.com>
2022-11-07 10:14:12 +01:00
Avishay
ae7eb9cef9
Add mode control for Modbus climate entities ( #73906 )
...
* Add support for Modbus HVAC control registers
2022-10-20 13:15:30 +02:00
Nippey
0e1fe4eba5
Modbus: Add support for Holding Registers to Binary Sensor ( #80460 )
...
Update handling of binary sensors to support reading from holding registers (command 0x03).
2022-10-18 10:31:08 +02:00
epenet
0d696b84b2
Cleanup root component imports in tests ( #78893 )
2022-09-21 06:57:41 -10:00
epenet
09393d6f64
Use climate enums in modbus ( #70693 )
2022-04-25 21:18:00 -10:00
epenet
831e2ace9c
Prettify yaml (tests) ( #68891 )
2022-03-30 11:26:08 +02:00
jan iversen
1a79118600
Fix modbus reload service ( #68040 )
...
* Fix modbus reload service.
* Please coverage.
* Resolve difference between local pytest and github.
2022-03-12 14:12:38 +02:00
jan iversen
d2e5c85429
Remove pragma from discover check. ( #68002 )
2022-03-11 19:58:18 +02:00
jan iversen
306498378c
Coverage 100% of Modbus climate ( #67396 )
...
* Coverage 100% of climate.py
* Allow 100% test.
2022-03-11 19:14:40 +02:00
jan iversen
a4915eb704
Handle exception in modbus slave sensor ( #67472 )
2022-03-02 09:49:57 -08:00
jan iversen
e891df0ff3
Allow multi read of Modbus sensor ( #67378 )
2022-02-28 11:07:55 -08:00
jan iversen
690223fb69
Add tests for Modbus slave binary sensors, up coverage to 100% ( #67373 )
2022-02-28 11:06:32 -08:00
jan iversen
6ec9c402b1
Remove generic data types INT, UINT, FLOAT in modbus ( #67268 )
2022-02-26 13:27:48 -08:00
jan iversen
8233278ccc
Correct tests to use data_type in Modbus ( #67246 )
2022-02-25 11:37:52 -08:00
jan iversen
c6f5633e24
Fix modbus test_delay ( #66993 )
2022-02-25 08:06:25 -08:00
jan iversen
adc4c1e33f
Secure ATTR_ and CONF_ use identical texts in Modbus ( #66901 )
2022-02-25 08:05:19 -08:00
jan iversen
9131fb39fe
Allow "slave" parameter in modbus service calls ( #66874 )
...
* Allow "slave" parameter in modbus service calls.
2022-02-24 13:35:45 +01:00
jan iversen
8741ff0684
Diferentiate between attr_name and entity_id in Modbus tests ( #66999 )
2022-02-21 14:56:31 -08:00
jan iversen
cb877adb6a
Allow multiread in modbus binary_sensor ( #59886 )
2022-02-21 10:22:50 -08:00
jan iversen
4ca339c5b1
Set slave default to 0, as already documented in Modbus ( #66921 )
2022-02-20 11:56:38 +01:00
jan iversen
6a7872fc1b
Remove async_setup_component() from tests ( #66905 )
2022-02-19 21:00:14 -08:00
Franck Nijhof
60b2cdd069
Allow binary sensor state to be None ( #60193 )
2021-12-22 12:24:29 +01:00
Dave T
e64352a7e0
Use new enums in modbus tests ( #62518 )
2021-12-22 10:03:11 +01:00
jan iversen
f2a5d92e61
Fix connect_fail test and modbus.py 100% coverage ( #57894 )
...
Co-authored-by: Joakim Sørensen <joasoe@gmail.com>
2021-10-20 15:22:24 -07:00
jan iversen
cca7da77ad
Report modbus buffer too small or too big to unpack ( #57838 )
2021-10-20 15:22:01 -07:00
jan iversen
b3117ced75
Please pylint for modbus test ( #58089 )
2021-10-20 13:38:55 +02:00
jan iversen
f92fe38bbd
Change warning to info when modbus is ready ( #57953 )
...
* Change warning to info.
* Make level info implicit.
2021-10-18 19:38:33 -07:00
jan iversen
34984d78a1
Add float32 test to modbus ( #57805 )
2021-10-15 16:06:36 -07:00
jan iversen
4417ffb407
COnvert DATA_TYPE to enum. ( #57699 )
2021-10-15 07:09:59 +02:00
Robert Hillis
488a636aec
Clean up unused loggers ( #57662 )
2021-10-14 10:03:38 -07:00
jan iversen
debcdc382f
Late review comments. ( #57654 )
2021-10-14 10:22:21 +02:00
jan iversen
2734ae17f3
Modbus baseplatform.py and Validators.py 100% coverage (activate coverage) ( #57546 )
2021-10-13 11:51:51 -07:00
jan iversen
199cf649be
Add test of lazy_error in modbus ( #57170 )
2021-10-11 12:43:05 +02:00
jan iversen
6947912fa9
Modbus entity update does not occur until after scan_interval ( #56221 )
...
* Secure update is called when integration is started.
* Review comments.
* Update homeassistant/components/modbus/base_platform.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
* Update homeassistant/components/modbus/base_platform.py
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-09-18 08:57:27 +02:00
jan iversen
aaa62dadec
Add service to stop/restart modbus ( #55599 )
...
* Add service to stop/restart modbus.
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2021-09-14 09:42:50 +02:00
jan iversen
1f997fcd58
Update pymodbus fixtures to use autospec ( #55686 )
2021-09-12 21:16:48 -07:00
jan iversen
16351ef3c2
Add shutdown test. ( #55357 )
2021-08-28 08:11:58 +02:00
jan iversen
7ac72ebf38
Add modbus name to log_error ( #55336 )
2021-08-27 09:26:57 -07:00
Matthias Alphart
cd0ae66d58
Add CONF_STATE_CLASS to `sensor/__init__.py` ( #54106 )
...
* add CONF_STATE_CLASS to const.py
* move to `sensor/__init__.py`
* move to sensor/const.py
* Revert "move to sensor/const.py"
This reverts commit 604d0d066b
.
* move it to `sensor/const.py` but import it from `sensor/__init__.py`
* add Modbus
2021-08-27 05:54:50 +02:00
jan iversen
7df8d0c973
Check for duplicate host/port and integration name in modbus ( #54664 )
...
* Check for duplicate host/port and integration name.
* Change to use set().
* Please CI.
* Add basic tests.
2021-08-25 12:29:00 +02:00
Matthias Alphart
51361fbd2b
Add configurable `state_class` to Modbus sensors ( #54103 )
...
* add configurable state_class
* Add test of new parameter.
Co-authored-by: jan Iversen <jancasacondor@gmail.com>
2021-08-25 11:50:54 +02:00
jan iversen
f91d214ba4
Break out mock of pymodbus return from mock_modbus to new fixture ( #55063 )
...
* Remove unused mock_modbus.
* Break out mock pymodbus return values.
* Review comments.
2021-08-23 23:55:57 +02:00
jan iversen
da20552cd8
Remove base_test from modbus test harness ( #55018 )
...
* Remove base_test.
* Review comments.
2021-08-22 19:59:38 +02:00
jan iversen
33f660118f
Add lazy_error_count to modbus ( #54412 )
...
* Add lazy_error_count.
* Use -=
* Review comments.
2021-08-21 15:49:50 +02:00
jan iversen
0688aaa2b6
Check for duplicate entity name/address in modbus entities ( #54669 )
...
* Check for duplicate entity name/address.
2021-08-19 09:37:31 +02:00
jan iversen
bafbbc6563
Adjust modbus constants names ( #54792 )
...
* Follow up.
2021-08-18 12:56:54 +02:00
jan iversen
71b0f6d095
set common test entity name. ( #54697 )
2021-08-17 20:43:27 +02:00
jan iversen
4ef9269790
Replace prepare_service_call with a simpler fixture in modbus ( #53975 )
...
* Convert prepare_service_call to a fixture.
2021-08-11 12:42:28 +02:00
jan iversen
e7f0768ae6
Convert base_config_test in modbus to existing Pytest.fixture ( #53836 )
...
* Convert base_config_test to pytest.fixture.
2021-08-09 12:11:54 +02:00
jan iversen
2232915ea8
Add parameter to delay sending of requests in modbus ( #54203 )
2021-08-07 21:10:08 -07:00
jan iversen
7306503756
Calculate count automatically in modbus platforms ( #53116 )
2021-07-20 22:49:54 -07:00
jan iversen
2e2b340b1e
Set modbus entity to non-available unless scan_interval=0 ( #53155 )
2021-07-20 22:48:02 -07:00
jan iversen
8c43e5c736
Correct set_temperature in modbus climate ( #52923 )
2021-07-20 20:19:26 +02:00
jan iversen
78ef02f4d9
Allow pymodbus to reconnect in running system (not startup) ( #53020 )
...
Allow pymodbus to reconnect (not during startup).
2021-07-19 13:01:50 +02:00
jan iversen
2ecfd74fa4
Add more data_types to modbus ( #52423 )
...
* Add more data_types.
* Use new struct when writing temperature.
2021-07-12 07:58:45 +02:00
jan iversen
c0751c060f
review comments. ( #52337 )
2021-06-30 14:34:33 +02:00
jan iversen
74e1600a84
Add fixture to handle mock restore state ( #52198 )
2021-06-28 22:21:04 -07:00
jan iversen
08b0ef7a5e
Use test fixture for configuration testing ( #51803 )
...
* Autospec mock_modbus and usei for configuration.
* Review comment.
2021-06-17 12:27:05 +02:00
jan iversen
3ba90776c0
Add autospec to modbus mock, in order to use getattr ( #51813 )
2021-06-17 10:57:20 +02:00
jan iversen
7ad91fdf71
Add swap to climate and change data_count -> count in modbus ( #51668 )
2021-06-16 12:11:23 +02:00
jan iversen
2a51587bc3
Remove reverse_order (replaced by generic swap) ( #51665 )
...
Remove reverse_order (replaced by generic swap).
2021-06-11 11:41:41 +02:00
jan iversen
59b5f94569
Add fix delay after send/request to allow RS485 adapter to switch in modbus ( #51417 )
2021-06-05 14:41:32 +02:00
jan iversen
b8afb7dcfe
Check initial connect() worked in modbus ( #51470 )
...
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-06-05 14:39:09 +02:00
jan iversen
5e067c2631
Allow unlimited scan_interval in modbus ( #51471 )
...
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
2021-06-04 18:06:44 +02:00
jan iversen
10dccc6734
Move pymodbus test fixtures to test_init ( #51244 )
2021-06-02 00:00:44 +02:00
jan iversen
538a189168
Adjust modbus climate to use address/input_type ( #51202 )
2021-05-28 17:57:14 +02:00
jan iversen
00507539c1
Change Cover to use address/input_type ( #51154 )
...
* Change Cover to use address/input_type.
* Flake.
2021-05-28 13:23:44 +02:00
jan iversen
e45196f9c9
Remove "old" config from modbus binary_sensor ( #51117 )
2021-05-28 12:06:46 +02:00
jan iversen
5afd16ef5d
Move modbus schema validators to validators.py ( #51121 )
2021-05-28 11:38:31 +02:00
jan iversen
47f016b340
Remove old config from cover, including tests ( #51118 )
...
* Remove old config and standardize new config.
* Add missing safeguard.
2021-05-28 11:29:37 +02:00
jan iversen
8d365e8bf5
After merge, review. ( #51139 )
2021-05-27 08:28:31 +02:00