Augmenter ou diminuer le polling

Bonjour,

Je suis sur la version béta du pluging mymobus et je n’arrive pas à faire fonctionner cette solution en code:

Suite du sujet Scénario - augmenter le polling en fonction du mode :

Il s’agit de modifier le polling d’un équipement suivant le besoin. j’ai besoin d’un rafraichissement tout les 1s quand mon store fonctionne et après plus besoin

Est ce que le code est toujours valable ?
Ou il y a une autre solution simple ?

$tags = $scenario->getTags();
$idEq = $tags['#idEq#'];
$value = $tags['#value#'];

$eqLogic = eqLogic::byId($idEq);

$pol = $eqLogic->getConfiguration('polling');
$eqLogic->setConfiguration('polling', $value)->save();
$scenario->setLog('Modification du Polling MyModbus : '.$pol.' -> '.$value);

$eqLogic->deamon_stop();
sleep(2);
$eqLogic->deamon_start();
$scenario->setLog('Daemon MyModbus redémarré pour prise en compte du nouveau polling !');

Bonjour,

le code est à adapter :

$tags = $scenario->getTags();
$idEq = $tags['#idEq#'];
$value = $tags['#value#'];

$eqLogic = eqLogic::byId($idEq);

$pol = $eqLogic->getConfiguration('eqPolling'); // <- ici
$eqLogic->setConfiguration('eqPolling', $value)->save(); // <-- et ici
$scenario->setLog('Modification du Polling MyModbus : '.$pol.' -> '.$value);

// $eqLogic->deamon_stop();
// sleep(2); 
// $eqLogic->deamon_start();
// un save fera le necessaire sans redémarrer le démon
$eqLogic->save();
$scenario->setLog('Daemon MyModbus redémarré pour prise en compte du nouveau polling !');

Ce n’est plus polling mais eqPolling en version bêta.
Un redémarrage du démon n’est pas necessaire, il suffit de sauvegarder la config de l’équipement, la nouvelle config est envoyée au démon sans redémarrage de celui-ci. De cette manière, les autres équipement MyModbus ne sont pas impactés. Chaque équipement a sa propre valeur de polling.

A+
Michel

Merci Michel pour ta réponse rapide.

J’ai fait des tests avec le nouveau code.
La valeur change bien dans la configuration de l’équipement mais le rafraichissement réel ne change pas.
Et si je fais une sauvegarde manuel sur l’équipement, le rafraichissement change.
On dirait que la fonction save ne fonctionne pas.

Une idée du pourquoi ?

Voici le log de mymodbus lors d’un changement de polling théorique:

[2024-08-01 15:37:57][DEBUG] : send: 0x1 0x3 0x0 0x0 0x0 0x1 0x84 0xa
[2024-08-01 15:37:57][DEBUG] : Adding transaction 1
[2024-08-01 15:37:57][DEBUG] : recv: 0x1 0x3 0x2 0x71 0xfd 0x5d 0x95
[2024-08-01 15:37:57][DEBUG] : Getting Frame - 0x3 0x2 0x71 0xfd
[2024-08-01 15:37:57][DEBUG] : Factory Response[ReadHoldingRegistersResponse': 3]
[2024-08-01 15:37:57][DEBUG] : Frame advanced, resetting header!!
[2024-08-01 15:37:57][DEBUG] : Getting transaction 1
[2024-08-01 15:37:57][DEBUG] : Frame - [b'\x01\x03\x02q\xfd]\x95'] not ready
[2024-08-01 15:37:57][DEBUG] : [29181]
[2024-08-01 15:37:57][DEBUG] : PyModbusClient: *Position store* read value for postion store (command id 1905): 29181
[2024-08-01 15:37:57][INFO] : Send to jeedom :  {'eqId': '177', 'values': {'1905': 29181}}
[2024-08-01 15:37:57][DEBUG] : Starting new HTTP connection (1): localhost:80
[2024-08-01 15:37:57][DEBUG] : jeemymodbus.php: $result *{"eqId":"177","values":{"1905":29181}}* type: array
[2024-08-01 15:37:57][DEBUG] : jeemodbus.php: Mise à jour cmd postion store -> new value: 29181
[2024-08-01 15:37:57][INFO] : jeemodbus.php: Mise à jour des commandes info : 'postion store'
[2024-08-01 15:37:57][DEBUG] : http://localhost:80 "POST /plugins/mymodbus/core/php/jeemymodbus.php?apikey=il7ubyGDMX3G154akaznXkHlvymwJypLESPr5TeYIzG8CT8cONljcmfnJGWQdnYF HTTP/11" 200 0
[2024-08-01 15:37:59][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:37:59][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:37:59][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:37:59][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:37:59][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:37:59][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:38:04][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:38:04][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:38:04][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:38:04][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:38:04][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:38:04][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:38:24][DEBUG] : mymodbus::supportedProtocols
[2024-08-01 15:38:27][DEBUG] : mymodbus::getTtyInterfaces
[2024-08-01 15:38:39][DEBUG] : mymodbus::preSave
[2024-08-01 15:38:39][DEBUG] : mymodbus::supportedProtocols
[2024-08-01 15:38:39][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:38:39][DEBUG] : mymodbus::preSave
[2024-08-01 15:38:39][DEBUG] : mymodbus::supportedProtocols
[2024-08-01 15:38:39][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:38:46][DEBUG] : mymodbus::getTtyInterfaces
[2024-08-01 15:38:46][DEBUG] : mymodbus::getTtyInterfaces
[2024-08-01 15:38:54][INFO] : Send to jeedom :  {'heartbeat_request': 1722519534}
[2024-08-01 15:38:54][DEBUG] : Starting new HTTP connection (1): localhost:80
[2024-08-01 15:38:54][DEBUG] : jeemymodbus.php: $result *{"heartbeat_request":1722519534}* type: array
[2024-08-01 15:38:54][DEBUG] : mymodbus::sendToDaemon * params = array (   'CMD' => 'heartbeat_answer',   'answer' => 1722519534, )
[2024-08-01 15:38:54][DEBUG] : mymodbusd: Received message: {'CMD': 'heartbeat_answer', 'answer': 1722519534, 'apikey': 'il7ubyGDMX3G154akaznXkHlvymwJypLESPr5TeYIzG8CT8cONljcmfnJGWQdnYF', 'dt': '2024-08-01T15:38:54+02:00'}
[2024-08-01 15:38:54][DEBUG] : http://localhost:80 "POST /plugins/mymodbus/core/php/jeemymodbus.php?apikey=il7ubyGDMX3G154akaznXkHlvymwJypLESPr5TeYIzG8CT8cONljcmfnJGWQdnYF HTTP/11" 200 0
[2024-08-01 15:38:57][DEBUG] : send: 0x1 0x3 0x0 0x0 0x0 0x1 0x84 0xa
[2024-08-01 15:38:57][DEBUG] : Adding transaction 1
[2024-08-01 15:38:57][DEBUG] : recv: 0x1 0x3 0x2 0x40 0x14 0x89 0x8b
[2024-08-01 15:38:57][DEBUG] : Getting Frame - 0x3 0x2 0x40 0x14
[2024-08-01 15:38:57][DEBUG] : Factory Response[ReadHoldingRegistersResponse': 3]
[2024-08-01 15:38:57][DEBUG] : Frame advanced, resetting header!!
[2024-08-01 15:38:57][DEBUG] : Getting transaction 1
[2024-08-01 15:38:57][DEBUG] : Frame - [b'\x01\x03\x02@\x14\x89\x8b'] not ready
[2024-08-01 15:38:57][DEBUG] : [16404]
[2024-08-01 15:38:57][DEBUG] : PyModbusClient: *Position store* read value for postion store (command id 1905): 16404
[2024-08-01 15:38:57][INFO] : Send to jeedom :  {'eqId': '177', 'values': {'1905': 16404}}
[2024-08-01 15:38:57][DEBUG] : Starting new HTTP connection (1): localhost:80
[2024-08-01 15:38:57][DEBUG] : jeemymodbus.php: $result *{"eqId":"177","values":{"1905":16404}}* type: array
[2024-08-01 15:38:57][DEBUG] : jeemodbus.php: Mise à jour cmd postion store -> new value: 16404
[2024-08-01 15:38:57][INFO] : jeemodbus.php: Mise à jour des commandes info : 'postion store'
[2024-08-01 15:38:57][DEBUG] : http://localhost:80 "POST /plugins/mymodbus/core/php/jeemymodbus.php?apikey=il7ubyGDMX3G154akaznXkHlvymwJypLESPr5TeYIzG8CT8cONljcmfnJGWQdnYF HTTP/11" 200 0
[2024-08-01 15:39:16][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:39:16][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:39:16][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:39:16][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:39:16][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:39:16][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:39:16][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:39:16][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:39:16][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:39:16][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:39:16][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:39:16][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:39:21][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:39:21][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:39:21][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:39:21][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:39:21][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:39:21][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:39:26][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:39:26][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:39:26][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:39:26][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:39:26][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:39:26][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:39:31][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:39:32][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:39:32][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:39:32][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:39:32][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:39:32][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:39:37][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:39:37][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:39:37][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:39:37][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:39:37][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:39:37][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:39:42][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:39:42][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:39:42][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:39:42][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:39:42][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:39:42][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:39:47][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:39:47][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:39:47][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:39:47][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:39:47][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:39:47][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:39:52][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:39:52][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:39:52][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:39:52][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:39:52][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:39:52][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:39:54][INFO] : Send to jeedom :  {'heartbeat_request': 1722519594}
[2024-08-01 15:39:54][DEBUG] : Starting new HTTP connection (1): localhost:80
[2024-08-01 15:39:54][DEBUG] : jeemymodbus.php: $result *{"heartbeat_request":1722519594}* type: array
[2024-08-01 15:39:54][DEBUG] : mymodbus::sendToDaemon * params = array (   'CMD' => 'heartbeat_answer',   'answer' => 1722519594, )
[2024-08-01 15:39:54][DEBUG] : mymodbusd: Received message: {'CMD': 'heartbeat_answer', 'answer': 1722519594, 'apikey': 'il7ubyGDMX3G154akaznXkHlvymwJypLESPr5TeYIzG8CT8cONljcmfnJGWQdnYF', 'dt': '2024-08-01T15:39:54+02:00'}
[2024-08-01 15:39:54][DEBUG] : http://localhost:80 "POST /plugins/mymodbus/core/php/jeemymodbus.php?apikey=il7ubyGDMX3G154akaznXkHlvymwJypLESPr5TeYIzG8CT8cONljcmfnJGWQdnYF HTTP/11" 200 0
[2024-08-01 15:39:57][DEBUG] : send: 0x1 0x3 0x0 0x0 0x0 0x1 0x84 0xa
[2024-08-01 15:39:57][DEBUG] : Adding transaction 1
[2024-08-01 15:39:57][DEBUG] : recv: 0x1 0x3 0x2 0x26 0x76 0x23 0xc2
[2024-08-01 15:39:57][DEBUG] : Getting Frame - 0x3 0x2 0x26 0x76
[2024-08-01 15:39:57][DEBUG] : Factory Response[ReadHoldingRegistersResponse': 3]
[2024-08-01 15:39:57][DEBUG] : Frame advanced, resetting header!!
[2024-08-01 15:39:57][DEBUG] : Getting transaction 1
[2024-08-01 15:39:57][DEBUG] : Frame - [b'\x01\x03\x02&v#\xc2'] not ready
[2024-08-01 15:39:57][DEBUG] : [9846]
[2024-08-01 15:39:57][DEBUG] : PyModbusClient: *Position store* read value for postion store (command id 1905): 9846
[2024-08-01 15:39:57][INFO] : Send to jeedom :  {'eqId': '177', 'values': {'1905': 9846, 'cycle_time': 60.045542049407956}}
[2024-08-01 15:39:57][DEBUG] : Starting new HTTP connection (1): localhost:80
[2024-08-01 15:39:57][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:39:57][DEBUG] : jeemymodbus.php: $result *{"eqId":"177","values":{"1905":9846,"cycle_time":60.045542049407956}}* type: array
[2024-08-01 15:39:57][DEBUG] : jeemodbus.php: Mise à jour cmd postion store -> new value: 9846
[2024-08-01 15:39:57][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:39:57][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:39:57][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:39:57][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:39:57][DEBUG] : jeemodbus.php: Mise à jour cmd Temps de rafraîchissement -> new value: 60.046
[2024-08-01 15:39:57][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:39:57][INFO] : jeemodbus.php: Mise à jour des commandes info : 'postion store' 'Temps de rafraîchissement'
[2024-08-01 15:39:57][DEBUG] : http://localhost:80 "POST /plugins/mymodbus/core/php/jeemymodbus.php?apikey=il7ubyGDMX3G154akaznXkHlvymwJypLESPr5TeYIzG8CT8cONljcmfnJGWQdnYF HTTP/11" 200 0
[2024-08-01 15:40:02][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:40:03][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:40:03][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:40:03][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:40:03][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:40:03][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:40:04][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:40:04][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:40:04][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:40:04][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:40:04][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:40:04][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:40:08][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:40:08][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:40:08][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:40:08][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:40:08][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:40:08][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:40:13][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:40:13][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:40:13][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:40:13][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:40:13][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:40:13][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:40:18][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:40:18][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:40:18][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:40:18][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:40:18][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:40:18][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:40:23][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:40:23][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:40:23][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:40:23][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:40:23][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:40:23][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:40:28][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:40:28][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:40:28][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:40:28][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:40:28][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:40:28][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:40:33][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:40:33][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:40:33][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:40:33][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:40:33][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:40:34][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:40:39][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:40:39][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:40:39][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:40:39][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:40:39][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:40:39][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:40:44][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:40:44][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:40:44][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:40:44][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:40:44][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:40:44][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:40:49][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:40:49][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:40:49][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:40:49][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:40:49][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:40:49][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:40:54][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:40:54][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:40:54][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:40:54][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:40:54][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:40:54][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:40:54][INFO] : Send to jeedom :  {'heartbeat_request': 1722519654}
[2024-08-01 15:40:54][DEBUG] : Starting new HTTP connection (1): localhost:80
[2024-08-01 15:40:54][DEBUG] : jeemymodbus.php: $result *{"heartbeat_request":1722519654}* type: array
[2024-08-01 15:40:54][DEBUG] : mymodbus::sendToDaemon * params = array (   'CMD' => 'heartbeat_answer',   'answer' => 1722519654, )
[2024-08-01 15:40:54][DEBUG] : mymodbusd: Received message: {'CMD': 'heartbeat_answer', 'answer': 1722519654, 'apikey': 'il7ubyGDMX3G154akaznXkHlvymwJypLESPr5TeYIzG8CT8cONljcmfnJGWQdnYF', 'dt': '2024-08-01T15:40:54+02:00'}
[2024-08-01 15:40:54][DEBUG] : http://localhost:80 "POST /plugins/mymodbus/core/php/jeemymodbus.php?apikey=il7ubyGDMX3G154akaznXkHlvymwJypLESPr5TeYIzG8CT8cONljcmfnJGWQdnYF HTTP/11" 200 0
[2024-08-01 15:40:57][DEBUG] : send: 0x1 0x3 0x0 0x0 0x0 0x1 0x84 0xa
[2024-08-01 15:40:57][DEBUG] : Adding transaction 1
[2024-08-01 15:40:57][DEBUG] : recv: 0x1 0x3 0x2 0x26 0x76 0x23 0xc2
[2024-08-01 15:40:57][DEBUG] : Getting Frame - 0x3 0x2 0x26 0x76
[2024-08-01 15:40:57][DEBUG] : Factory Response[ReadHoldingRegistersResponse': 3]
[2024-08-01 15:40:57][DEBUG] : Frame advanced, resetting header!!
[2024-08-01 15:40:57][DEBUG] : Getting transaction 1
[2024-08-01 15:40:57][DEBUG] : Frame - [b'\x01\x03\x02&v#\xc2'] not ready
[2024-08-01 15:40:57][DEBUG] : [9846]
[2024-08-01 15:40:59][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:40:59][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:40:59][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:40:59][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:40:59][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:40:59][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:41:04][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:41:04][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:41:04][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:41:04][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:41:04][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:41:04][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:41:09][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:41:09][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:41:09][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:41:09][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:41:09][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:41:10][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:41:15][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:41:15][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:41:15][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:41:15][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:41:15][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:41:15][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:41:20][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:41:20][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:41:20][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:41:20][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:41:20][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:41:20][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:41:25][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:41:25][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:41:25][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:41:25][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:41:25][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:41:25][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:41:30][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:41:30][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:41:30][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:41:30][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:41:30][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:41:30][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:41:35][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:41:35][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:41:35][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:41:35][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:41:35][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:41:35][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:41:40][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:41:40][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:41:40][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:41:40][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:41:40][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:41:40][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:41:45][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:41:45][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:41:45][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:41:45][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:41:45][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:41:46][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:41:51][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:41:51][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:41:51][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:41:51][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:41:51][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:41:51][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:41:54][INFO] : Send to jeedom :  {'heartbeat_request': 1722519714}
[2024-08-01 15:41:54][DEBUG] : Starting new HTTP connection (1): localhost:80
[2024-08-01 15:41:54][DEBUG] : jeemymodbus.php: $result *{"heartbeat_request":1722519714}* type: array
[2024-08-01 15:41:54][DEBUG] : mymodbus::sendToDaemon * params = array (   'CMD' => 'heartbeat_answer',   'answer' => 1722519714, )
[2024-08-01 15:41:54][DEBUG] : mymodbusd: Received message: {'CMD': 'heartbeat_answer', 'answer': 1722519714, 'apikey': 'il7ubyGDMX3G154akaznXkHlvymwJypLESPr5TeYIzG8CT8cONljcmfnJGWQdnYF', 'dt': '2024-08-01T15:41:54+02:00'}
[2024-08-01 15:41:54][DEBUG] : http://localhost:80 "POST /plugins/mymodbus/core/php/jeemymodbus.php?apikey=il7ubyGDMX3G154akaznXkHlvymwJypLESPr5TeYIzG8CT8cONljcmfnJGWQdnYF HTTP/11" 200 0
[2024-08-01 15:41:56][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:41:56][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:41:56][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:41:56][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:41:56][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:41:56][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:41:57][DEBUG] : send: 0x1 0x3 0x0 0x0 0x0 0x1 0x84 0xa
[2024-08-01 15:41:57][DEBUG] : Adding transaction 1
[2024-08-01 15:41:57][DEBUG] : recv: 0x1 0x3 0x2 0x26 0x76 0x23 0xc2
[2024-08-01 15:41:57][DEBUG] : Getting Frame - 0x3 0x2 0x26 0x76
[2024-08-01 15:41:57][DEBUG] : Factory Response[ReadHoldingRegistersResponse': 3]
[2024-08-01 15:41:57][DEBUG] : Frame advanced, resetting header!!
[2024-08-01 15:41:57][DEBUG] : Getting transaction 1
[2024-08-01 15:41:57][DEBUG] : Frame - [b'\x01\x03\x02&v#\xc2'] not ready
[2024-08-01 15:41:57][DEBUG] : [9846]
[2024-08-01 15:42:01][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:42:01][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:42:01][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:42:01][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:42:01][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:42:01][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:42:06][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:42:06][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:42:06][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:42:06][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:42:06][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:42:06][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:42:11][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:42:11][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:42:11][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:42:11][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:42:11][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:42:11][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:42:16][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:42:16][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:42:16][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:42:16][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:42:16][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:42:16][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:42:21][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:42:22][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:42:22][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:42:22][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:42:22][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:42:22][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'
[2024-08-01 15:42:27][DEBUG] : mymodbus::deamon_info
[2024-08-01 15:42:27][DEBUG] : mymodbus::getDeamonLaunchable
[2024-08-01 15:42:27][DEBUG] : mymodbus::getCompleteConfiguration
[2024-08-01 15:42:27][DEBUG] : mymodbus::getEqConfiguration
[2024-08-01 15:42:27][DEBUG] : mymodbus::check_pyenv
[2024-08-01 15:42:27][DEBUG] : mymodbus::deamon_info * daemon_info = '{"state":"ok","launchable":"ok"}'

Dans la partie de log que tu as postée, soit près de 5 minutes, il n’y a pas d’envoi de configuration. Il s’agit d’une ligne avec mymodbus::sendToDaemon suivi d’un long array.
On voit bien 2 preSave qui sont lancés avant la sauvegarde. L’envoi de la configuration est fait dans le postAjax.

Essai ceci (pour essayer, c’est sans garantie) :

$tags = $scenario->getTags();
$idEq = $tags['#idEq#'];
$value = $tags['#value#'];

$eqLogic = eqLogic::byId($idEq);

$pol = $eqLogic->getConfiguration('eqPolling');
$eqLogic->setConfiguration('eqPolling', $value)->save();
$scenario->setLog('Modification du Polling MyModbus : '.$pol.' -> '.$value);

$eqLogic::sendNewConfig();
$scenario->setLog('Daemon MyModbus mis à jour avec le nouveau polling !');

Le 2ème save n’est pas nécessaire puisqu’il est fait à la même ligne que setConfiguration, c’est pour ça qu’il y a 2 preSave lancés (cf log lignes 31 et 34)

Cette fois ci ça marche niquel. la modification est bien prise en compte en réel.

Merci beaucoup pour le temps que tu m’as consacré !

Bonne soirée.
Jérémy

1 « J'aime »

Ce sujet a été automatiquement fermé après 24 heures suivant le dernier commentaire. Aucune réponse n’est permise dorénavant.