Closed twproject closed 4 years ago
modbus documentation modbus source (message by IssueLinks)
Hey there @adamchengtkc, @janiversen, mind taking a look at this issue as its been labeled with an integration (modbus
) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)
0.111.4
0.107.6
please run with debug information as described in the modbus documentation “ Opening an issue”. https://www.home-assistant.io/integrations/modbus
please run with debug information as described in the modbus documentation “ Opening an issue”. https://www.home-assistant.io/integrations/modbus
I just add the debug mode but i see only the info that i reported
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
logger:
default: error
logs:
homeassistant.components.modbus: debug
pymodbus.client: debug
modbus:
- type: tcp
host: 192.168.x.y
port: 9000
# timeout: 5
# delay: 5
sensor:
#MODBUS
#PDC
- platform: modbus
scan_interval: 120
registers:
- name: PDC - Impianto Andata
unit_of_measurement: °C
slave: 4
register: 513
count: 1
precision: 1
scale: 0.1
I attach the full log
Seems you did not restart the server. There will be a lot of pymodbus lines in the log.
I reboot at least 5 times but the result is the same. I reboot it again from proxmox console but i see only pymodbus lines on log I attach again home-assistant.log
In that case your device is not responding. I do however find it strange that there are no “connect” lines in the log.
I presume you have changed the address (192.168.x.y) to a legal address.
Also I note that “- name” is missing a tab/indent.
In that case your device is not responding. I do however find it strange that there are no “connect” lines in the log.
I presume you have changed the address (192.168.x.y) to a legal address.
Also I note that “- name” is missing a tab/indent.
yes x.y is only to obfuscate The strange thing is on the same proxmox i have a container with an older version that works fine.
Actually I have 2 HA at latest version with the same issue (one is the production HA env and this TEST env) and 1 HA with 0.107.6 that works perfectly.
All HA are in the same network and modbus gw too
I upload the configuration.yaml (I also set info as normal debug), probably the - name is a typo copying the config due HA report it OK
Looking at your configuration the log you submitted does not correspond. Just take the number of devices each should have a send line in the log....there should also be a connect for the platform.
One problem could be that multiple servers access the same platform, which normally leads to problems as it is undefined in modbus-tcp.
I am not really able to help you, without a consistent configuration (minimal) and the corresponding log showing connect/send/recv and some problems.
tonight looking on logs of production enviroment i found this
2020-06-25 22:30:37 WARNING (MainThread) [pymodbus.client.asynchronous] Not Importing deprecated clients. Dependency Twisted is not Installed
2020-06-25 22:30:41 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] Connecting to 192.168.x.y.
2020-06-25 22:30:41 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] Connecting.
2020-06-25 22:30:42 ERROR (MainThread) [homeassistant.setup] Setup failed for hacs: No setup function defined.
2020-06-25 22:30:43 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] Client connected to modbus server
2020-06-25 22:30:43 INFO (MainThread) [pymodbus.client.asynchronous.asyncio] Protocol made connection.
2020-06-25 22:30:43 INFO (MainThread) [pymodbus.client.asynchronous.asyncio] Connected to 192.168.x.y.
2020-06-25 22:30:46 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] send: 0x0 0x1 0x0 0x0 0x0 0x6 0xb 0x3 0x0 0x7 0x0 0x1
2020-06-25 22:30:47 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] recv: 0x0 0x1 0x0 0x0 0x0 0x5 0xb 0x3 0x2 0x1 0xe
2020-06-25 22:30:49 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] send: 0x0 0x2 0x0 0x0 0x0 0x6 0xc 0x3 0x0 0x7 0x0 0x1
2020-06-25 22:30:49 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] recv: 0x0 0x2 0x0 0x0 0x0 0x5 0xc 0x3 0x2 0x0 0xe4
2020-06-25 22:30:49 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] send: 0x0 0x3 0x0 0x0 0x0 0x6 0xd 0x3 0x0 0x7 0x0 0x1
2020-06-25 22:30:51 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] recv: 0x0 0x3 0x0 0x0 0x0 0x5 0xd 0x3 0x2 0x0 0xbe
2020-06-25 22:30:51 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] send: 0x0 0x4 0x0 0x0 0x0 0x6 0xe 0x3 0x0 0x7 0x0 0x1
2020-06-25 22:30:51 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] recv: 0x0 0x4 0x0 0x0 0x0 0x5 0xe 0x3 0x2 0x1 0x19
2020-06-25 22:30:51 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] send: 0x0 0x5 0x0 0x0 0x0 0x6 0xf 0x3 0x0 0x7 0x0 0x1
2020-06-25 22:30:51 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] recv: 0x0 0x5 0x0 0x0 0x0 0x5 0xf 0x3 0x2 0x1 0x9
2020-06-25 22:30:51 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] send: 0x0 0x6 0x0 0x0 0x0 0x6 0x10 0x3 0x0 0x7 0x0 0x1
2020-06-25 22:30:52 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] recv: 0x0 0x6 0x0 0x0 0x0 0x5 0x10 0x3 0x2 0x0 0xbe
2020-06-25 22:30:52 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] send: 0x0 0x7 0x0 0x0 0x0 0x6 0xb 0x3 0x0 0x2 0x0 0x1
2020-06-25 22:30:52 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] recv: 0x0 0x7 0x0 0x0 0x0 0x5 0xb 0x3 0x2 0x1 0x13
2020-06-25 22:30:52 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] send: 0x0 0x8 0x0 0x0 0x0 0x6 0xc 0x3 0x0 0x2 0x0 0x1
2020-06-25 22:30:53 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] recv: 0x0 0x8 0x0 0x0 0x0 0x5 0xc 0x3 0x2 0x1 0x10
2020-06-25 22:30:54 ERROR (MainThread) [homeassistant.core] Error doing job: Unclosed client session
2020-06-25 22:30:54 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] send: 0x0 0x9 0x0 0x0 0x0 0x6 0xd 0x3 0x0 0x2 0x0 0x1
2020-06-25 22:30:55 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] recv: 0x0 0x9 0x0 0x0 0x0 0x5 0xd 0x3 0x2 0x1 0x15
2020-06-25 22:30:55 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] send: 0x0 0xa 0x0 0x0 0x0 0x6 0xe 0x3 0x0 0x2 0x0 0x1
2020-06-25 22:30:56 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] recv: 0x0 0xa 0x0 0x0 0x0 0x5 0xe 0x3 0x2 0x1 0x14
and then
2020-06-25 22:32:19 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] send: 0x0 0xa4 0x0 0x0 0x0 0x6 0xc 0x3 0x0 0xc 0x0 0x1
2020-06-25 22:32:19 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] recv: 0x0 0xa4 0x0 0x0 0x0 0x5 0xc 0x3 0x2 0x0 0x7
2020-06-25 22:32:19 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] send: 0x0 0xa5 0x0 0x0 0x0 0x6 0xd 0x3 0x0 0xc 0x0 0x1
2020-06-25 22:32:19 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] recv: 0x0 0xa5 0x0 0x0 0x0 0x5 0xd 0x3 0x2 0x0 0x7
2020-06-25 22:32:19 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] send: 0x0 0xa6 0x0 0x0 0x0 0x6 0xe 0x3 0x0 0xc 0x0 0x1
2020-06-25 22:32:19 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] recv: 0x0 0xa6 0x0 0x0 0x0 0x5 0xe 0x3 0x2 0x0 0x5
2020-06-25 22:32:19 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] send: 0x0 0xa7 0x0 0x0 0x0 0x6 0xf 0x3 0x0 0xc 0x0 0x1
2020-06-25 22:32:19 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] recv: 0x0 0xa7 0x0 0x0 0x0 0x5 0xf 0x3 0x2 0x0 0x5
2020-06-25 22:32:19 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] send: 0x0 0xa8 0x0 0x0 0x0 0x6 0x10 0x3 0x0 0xc 0x0 0x1
2020-06-25 22:32:19 DEBUG (MainThread) [pymodbus.client.asynchronous.asyncio] recv: 0x0 0xa8 0x0 0x0 0x0 0x5 0x10 0x3 0x2 0x0 0x5
2020-06-25 22:32:53 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.pdc_impianto_andata fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 472, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/modbus/sensor.py", line 255, in update
registers = result.registers
AttributeError: 'coroutine' object has no attribute 'registers'
your production system is using a version where modbus is known to have problems. Modbus was changed back to synchronous calls.
your production system is using a version where modbus is known to have problems. Modbus was changed back to synchronous calls.
thanks, i'm using the latest HA version Home Assistant 0.111.4
but your log tells a different story, the pymodbus async. calls was removed in 0.108
but your log tells a different story, the pymodbus async. calls was removed in 0.108
I agree with you, yesterday i created a new vm only with modbus config and all works, after that i made a snapshot of prod env and move to this new machine. I made a partial restore without HA and... It started to return me the same broken result.
I'm starting to thing that there is something broke somewhere but I don't have idea where is
Now i'm manually moving the config to another clean instance and testing.
Looks very much like it is something outside HA, so I assume you could close this issue.
Probably I found. I have my custom climate component that use modbus in async way (I switched it on 0.108 release) and probably it broke everything.
The strange thing is that i disabled it removing the climate config but something remains. Now I switched back to sync way and everything start to works. Also all modbus sensor start to works
I'm not understanding why but it works.
Thanks for patience and support, I'll close the ticket
The problem
Reading some sensor via modbus i don't receive data. The same config on a old 0.107.6 works perfectly
Environment
Problem-relevant
configuration.yaml
Traceback/Error logs
2020-06-24 11:10:26 DEBUG (SyncWorker_34) [pymodbus.client.sync] New Transaction state 'SENDING' 2020-06-24 11:10:29 DEBUG (SyncWorker_18) [pymodbus.client.sync] New Transaction state 'SENDING' 2020-06-24 11:10:32 DEBUG (SyncWorker_2) [pymodbus.client.sync] New Transaction state 'SENDING' 2020-06-24 11:10:35 DEBUG (SyncWorker_21) [pymodbus.client.sync] New Transaction state 'SENDING' 2020-06-24 11:10:35 DEBUG (SyncWorker_22) [pymodbus.client.sync] New Transaction state 'SENDING' 2020-06-24 11:10:38 DEBUG (SyncWorker_22) [pymodbus.client.sync] New Transaction state 'SENDING' 2020-06-24 11:10:41 DEBUG (SyncWorker_35) [pymodbus.client.sync] New Transaction state 'SENDING' 2020-06-24 11:10:41 DEBUG (SyncWorker_4) [pymodbus.client.sync] New Transaction state 'SENDING' 2020-06-24 11:10:44 DEBUG (SyncWorker_6) [pymodbus.client.sync] New Transaction state 'SENDING' 2020-06-24 11:10:47 DEBUG (SyncWorker_23) [pymodbus.client.sync] New Transaction state 'SENDING' 2020-06-24 11:10:50 DEBUG (SyncWorker_15) [pymodbus.client.sync] New Transaction state 'SENDING' 2020-06-24 11:10:53 DEBUG (SyncWorker_19) [pymodbus.client.sync] New Transaction state 'SENDING' 2020-06-24 11:10:53 DEBUG (SyncWorker_16) [pymodbus.client.sync] New Transaction state 'SENDING' 2020-06-24 11:10:56 DEBUG (SyncWorker_20) [pymodbus.client.sync] New Transaction state 'SENDING' 2020-06-24 11:10:59 DEBUG (SyncWorker_2) [pymodbus.client.sync] New Transaction state 'SENDING' 2020-06-24 11:11:02 DEBUG (SyncWorker_30) [pymodbus.client.sync] New Transaction state 'SENDING' 2020-06-24 11:11:02 DEBUG (SyncWorker_30) [pymodbus.client.sync] New Transaction state 'SENDING' 2020-06-24 11:11:06 DEBUG (SyncWorker_17) [pymodbus.client.sync] New Transaction state 'SENDING' 2020-06-24 11:11:09 DEBUG (SyncWorker_33) [pymodbus.client.sync] New Transaction state 'SENDING'