Title: Local Node Slave not starting heartbeat · Issue #620 · canopen-python/canopen · GitHub
Open Graph Title: Local Node Slave not starting heartbeat · Issue #620 · canopen-python/canopen
X Title: Local Node Slave not starting heartbeat · Issue #620 · canopen-python/canopen
Description: Hello, I am finding an issue, where, my master, on the startup, creates the network, adds the node, etc. and then, when I pass from INITIALIZING, to PRE-OPERATIONAL state, the slave, doesnt begin the heartbeat. I've checked the nmt modul...
Open Graph Description: Hello, I am finding an issue, where, my master, on the startup, creates the network, adds the node, etc. and then, when I pass from INITIALIZING, to PRE-OPERATIONAL state, the slave, doesnt begin t...
X Description: Hello, I am finding an issue, where, my master, on the startup, creates the network, adds the node, etc. and then, when I pass from INITIALIZING, to PRE-OPERATIONAL state, the slave, doesnt begin t...
Opengraph URL: https://github.com/canopen-python/canopen/issues/620
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Local Node Slave not starting heartbeat","articleBody":"Hello,\n\nI am finding an issue, where, my master, on the startup, creates the network, adds the node, etc. and then, when I pass from INITIALIZING, to PRE-OPERATIONAL state, the slave, doesnt begin the heartbeat. I've checked the nmt module, and it should do It, but the thing is that It does not.\n\n```\n def _startup(self, bms) -\u003e None:\n bms.nmt.state = 'PRE-OPERATIONAL'\n time.sleep(1)\n bms.nmt.state = 'OPERATIONAL'\n time.sleep(1)\n```\nHere, i set the bms (slave), state to pre-operational. The sleep is because if not, or it does not set it, or im not able to print it on the slave. Adding the sleep, I can see that it sets it to PRE-OPERATIONAL. In fact, I see that it goes from initialized, to pre-operational, to operational. \n\nHowever, the thing is that when I check if I recieve the heartbeat, in the next code snippet, well, i don't receive It. Seems like the start_heartbeat method doesn't launch.\n```\n\n def nmt_manager(self, bms) -\u003e None:\n \"\"\"Monitoriza el estado del BMS mediante heartbeats.\"\"\"\n logger.info(\"Iniciando monitorización de NMT (Heartbeat)...\")\n while True:\n try:\n # Esperar heartbeat (timeout un poco mayor que el intervalo esperado de 1s)\n bms.nmt.wait_for_heartbeat(timeout=2.0)\n logger.info(f\"Heartbeat recibido. Estado BMS: {bms.nmt.state}\")\n except Exception as e:\n logger.warning(f\"No se ha recibido heartbeat del BMS: {e}\")\n\n```\n\nAlso, the heartbeat doesn't start, if, when starting the slave (a bms simulator, on the same machine), I do this:\n\n```\n self.node = canopen.LocalNode(self.BMS_NODE_ID, self.DICT_EDS)\n # Forzar el intervalo de heartbeat a 1000ms (1s) directamente\n self.set_value(0x1017, 1, 500, \"Intervalo de heartbeat\")\n self.network.add_node(self.node)\n```\n \n\nI know, that the start_hearbeat method is launched, either on passing from INITIALIZED from PRE-OPERATIONAL, or, via writing the producer heartbeat time(1017h). And i know that the write is a callback, but, doesn't work if the writing it's made before the node added to the network?\n\nTo make the heartbeat work, I had to do this:\n\n```\n def _startup(self, bms) -\u003e None:\n bms.nmt.state = 'PRE-OPERATIONAL'\n time.sleep(1)\n bms.sdo[0x1017].raw = 500\n bms.nmt.state = 'OPERATIONAL'\n time.sleep(1)\n```\n\nAdding the writing of the record 1017 on startup.\n\nMy setup is local, using vcan on my own linux. But can virtual channel seems to work perfectly fine.\n\nWriting this because I don't know if it's a bug, or I am wrong somewhere. ","author":{"url":"https://github.com/jfernandezbzigor","@type":"Person","name":"jfernandezbzigor"},"datePublished":"2025-12-04T10:17:41.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/620/canopen/issues/620"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f3223212-c9f5-6f82-efad-af1122dad65b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A7FA:210405:66ACD24:87265AC:6A5DD3FA |
| html-safe-nonce | a2bdf36f828bd83fddff988dafc6242cae1ddd61df0860254d0e1f159f6617db |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBN0ZBOjIxMDQwNTo2NkFDRDI0Ojg3MjY1QUM6NkE1REQzRkEiLCJ2aXNpdG9yX2lkIjoiMTc4OTgxNTMyNTA1ODU0OTcwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | fb87c2c2c073951475896d192e5782da7702c5290f42e7a36a53c9910e56d4bb |
| hovercard-subject-tag | issue:3693881456 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/canopen-python/canopen/620/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c773efd4b12f5e75b5c614598beee1aeadc111d35cedc7c5e622d5c13d7c7081/canopen-python/canopen/issues/620 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c773efd4b12f5e75b5c614598beee1aeadc111d35cedc7c5e622d5c13d7c7081/canopen-python/canopen/issues/620 |
| og:image:alt | Hello, I am finding an issue, where, my master, on the startup, creates the network, adds the node, etc. and then, when I pass from INITIALIZING, to PRE-OPERATIONAL state, the slave, doesnt begin t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jfernandezbzigor |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/canopen-python/canopen git https://github.com/canopen-python/canopen.git |
| octolytics-dimension-user_id | 200581454 |
| octolytics-dimension-user_login | canopen-python |
| octolytics-dimension-repository_id | 68737600 |
| octolytics-dimension-repository_nwo | canopen-python/canopen |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 68737600 |
| octolytics-dimension-repository_network_root_nwo | canopen-python/canopen |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width