Code : Tout sélectionner
sudo systemctl disable socat
Je tourne avec mon script depuis le début sans problème.
Tu peux voir que ça fonctionne quand le fichier ttyUSB21 existe ou bien simplement quand domoticz se met bien à jour.

Code : Tout sélectionner
sudo systemctl disable socat
Code : Tout sélectionner
[Unit]
Description=Relai pitinfo vers ttyusb21
After=network-online.target
[Service]
# pour mémoire
#sudo socat -d -d pty,link=/dev/ttyUSB21,raw,ignoreeof,echo=0 tcp:192.168.88.161:8888
User=root
Group=root
ExecStart=/usr/bin/socat -d -d pty,link=/dev/ttyUSB21,raw,ignoreeof,echo=0 tcp:192.168.88.161:8888
# Configures the time to wait before service is stopped forcefully.
TimeoutStopSec=240
Restart=on-failure
RestartSec=5
# Restart=always
[Install]
WantedBy=multi-user.target
Airvb j'ai repris l'installation en mode service expliquée ici sur le forumairvb a écrit : ↑22 nov. 2020, 12:05 Le lancement de socat-pitinfo en mode service
Code : Tout sélectionner
[Unit] Description=Relai pitinfo vers ttyusb21 After=network-online.target [Service] # pour mémoire #sudo socat -d -d pty,link=/dev/ttyUSB21,raw,ignoreeof,echo=0 tcp:192.168.88.161:8888 User=root Group=root ExecStart=/usr/bin/socat -d -d pty,link=/dev/ttyUSB21,raw,ignoreeof,echo=0 tcp:192.168.88.161:8888 # Configures the time to wait before service is stopped forcefully. TimeoutStopSec=240 Restart=on-failure RestartSec=5 # Restart=always [Install] WantedBy=multi-user.target
Code : Tout sélectionner
[Unit]
Description=Relai pitinfo vers ttyusb21
After=network-online.target
[Service]
User=root
Group=root
ExecStart=/usr/bin/socat -d -d pty,link=/dev/ttyUSB21,raw,ignoreeof,echo=0 tcp:192.168.1.215:8888
# Configures the time to wait before service is stopped forcefully.
TimeoutStopSec=240
Restart=on-failure
RestartSec=5
# Restart=always
[Install]
WantedBy=multi-user.target
Code : Tout sélectionner
2020-11-26 13:32:05.296 Error: (PiTinfo) CRC check failed on Teleinfo line 'MOTDETAT 00' using both modes 1 and 2. Line skipped.
2020-11-26 14:33:05.462 Error: (PiTinfo) CRC check failed on Teleinfo line '21681 C' using both modes 1 and 2. Line skipped.
2020-11-26 17:34:05.651 Error: (PiTinfo) CRC check failed on Teleinfo line 'OPTARIF0 B' using both modes 1 and 2. Line skipped.
2020-11-26 19:51:55.806 Error: Serial Port closed!... Error: End of file
Code : Tout sélectionner
● pitinfo_socat.service - Relai pitinfo vers ttyusb21
Loaded: loaded (/etc/systemd/system/pitinfo_socat.service; enabled; vendor pr
Active: inactive (dead) since Thu 2020-11-26 19:51:55 CET; 1 day 1h ago
Process: 706 ExecStart=/usr/bin/socat -d -d pty,link=/dev/ttyUSB21,raw,ignoree
Main PID: 706 (code=exited, status=0/SUCCESS)
Warning: Journal has been rotated since unit was started. Log output is incomple
Code : Tout sélectionner
...
#define USE_TELEINFO // Add support for Teleinfo via serial RX interface
// #define USE_TELEINFO_STANDARD // Use standard mode (9600 bps) else it's historical mode (1200 bps)
...
Code : Tout sélectionner
19:47:00 MQT: tele/TeleInfo/RESULT = { "ADCO":"***********","OPTARIF":"HC..","ISOUSC":60,"HCHC":********,"HCHP":**********,"PTEC":"HP..","IINST":6,"IMAX":90,"PAPP":1460,"HHPHC":"A","MOTDETAT":0}
Code : Tout sélectionner
[{"id":"34f140f8.a2bfa","type":"tab","label":"TeleInfo","disabled":false,"info":""},{"id":"575d538c.749d6c","type":"mqtt in","z":"34f140f8.a2bfa","name":"","topic":"tele/TeleInfo/#","qos":"2","datatype":"auto","broker":"f9ca7352.9abe8","x":90,"y":120,"wires":[["e06a0bfe.7bf398"]]},{"id":"e777bc5.9f4d44","type":"comment","z":"34f140f8.a2bfa","name":"Instructions de paramétrage pour domoticz dans l'ESP Tasmota-sensor-Teleinfo il faut activer \"SetOption108 1\"","info":"Dans domoticz:\nCréer le matériel téléinfo en USB pour créer automatiquement les capteurs de mesure\n\nModifier le matériel en dummy pour rendre les capteurs virtuels\nRelever l'IDX de chaque capteur virtuel dans domoticz\n\nDans L'ESP Tasmota:\n\nParamétrer tasmota sensor avec telefinfo et vérifier que les données du compteur sont affichées sur la page web de l'ESP\nConfiguration MQTT: Renseigner Topic= TeleInfo\n\ndans le menu Console:\n\nSaisir la commande setOption108 1\n\n_______________________________\npour info:\n0 = Teleinfo telemetry into Energy MQTT JSON (default)\n1 = Teleinfo raw data only\n_______________________________\n\nVérifier la présence de trames qui commencent par:--> MQT: tele/TeleInfo/RESULT = {...\n\nDans Node-Red:\n\nDans chaque bloc fonction \"Décode Trame...\"\"\nRenseignger l'IDX Domoticz de chaque capteur virtuel associé\nAdapter les infos et les seuils au contrat\n\nDans chaque bloc \"tele/TeleInfo\" et \"mqtt/in\"\nAdapter les paramètres au serveur domtoticz\nDéployer le Flow\n\nDans Domoticz:\n\nVérifier dans les log si les messages MQTT sont bien réceptionnés\nVérifier si les capteurs affichent les données\n","x":410,"y":40,"wires":[]},{"id":"7c350d74.193bc4","type":"switch","z":"34f140f8.a2bfa","name":"RESULT","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"tele/TeleInfo/RESULT","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":100,"y":280,"wires":[["1b669ddb.c2c732"]]},{"id":"1b669ddb.c2c732","type":"json","z":"34f140f8.a2bfa","name":"","property":"payload","action":"","pretty":false,"x":110,"y":360,"wires":[["b13a5fad.22bef","4928abc7.9f50b4","b8bae6b1.845d78","9bd3142f.05cf98","ea2010a9.53948","91aaccbd.44a7","c9b9361f.3f2328","3906e2c8.df91ce"]]},{"id":"b13a5fad.22bef","type":"debug","z":"34f140f8.a2bfa","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":470,"y":120,"wires":[]},{"id":"4928abc7.9f50b4","type":"function","z":"34f140f8.a2bfa","name":"Decode Trame Total","func":"// Récupération des données\n//Préparation requête pour Domoticz\nvar XValue\nXValue= \"\"+ msg.payload.HCHP + \";\" + msg.payload.HCHC +\";0;0;\" + msg.payload.PAPP + \";0\";\n\nmsg.payload = {};\nmsg.payload.idx = 69;\nmsg.payload.svalue = XValue;\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":500,"y":200,"wires":[["566c815d.a5a5d","4e116d.9133ce94"]]},{"id":"566c815d.a5a5d","type":"debug","z":"34f140f8.a2bfa","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":830,"y":180,"wires":[]},{"id":"e06a0bfe.7bf398","type":"throttle","z":"34f140f8.a2bfa","name":"","throttleType":"time","timeLimit":"5","timeLimitType":"seconds","countLimit":"3","blockSize":0,"locked":false,"x":110,"y":200,"wires":[["7c350d74.193bc4"]]},{"id":"4e116d.9133ce94","type":"mqtt out","z":"34f140f8.a2bfa","name":"","topic":"domoticz/in","qos":"","retain":"","broker":"9a37d1dd.66c5a","x":1090,"y":200,"wires":[]},{"id":"b8bae6b1.845d78","type":"function","z":"34f140f8.a2bfa","name":"Decode Trame KWh HC","func":"// Récupération des données\n//Préparation requête pour Domoticz\nvar XValue\nXValue= msg.payload.PAPP +\";\"+ msg.payload.HCHC;\n\nmsg.payload = {};\nmsg.payload.idx = 67;\nmsg.payload.svalue = XValue;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":510,"y":280,"wires":[["25b79187.4c9bde","4fbad9ef.4d29e8"]]},{"id":"4fbad9ef.4d29e8","type":"mqtt out","z":"34f140f8.a2bfa","name":"","topic":"domoticz/in","qos":"","retain":"","broker":"9a37d1dd.66c5a","x":1090,"y":280,"wires":[]},{"id":"a93412bc.bf78d","type":"mqtt out","z":"34f140f8.a2bfa","name":"","topic":"domoticz/in","qos":"","retain":"","broker":"9a37d1dd.66c5a","x":1090,"y":520,"wires":[]},{"id":"25b79187.4c9bde","type":"debug","z":"34f140f8.a2bfa","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":830,"y":260,"wires":[]},{"id":"9bd3142f.05cf98","type":"function","z":"34f140f8.a2bfa","name":"Decode Trame KWh HP","func":"// Récupération des données\n//Préparation requête pour Domoticz\nvar XValue\nXValue= msg.payload.PAPP +\";\"+ msg.payload.HCHP;\n\nmsg.payload = {};\nmsg.payload.idx = 68;\nmsg.payload.svalue = XValue;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":510,"y":360,"wires":[["e789ba4a.f437d8","59372fcf.4eb3b"]]},{"id":"59372fcf.4eb3b","type":"mqtt out","z":"34f140f8.a2bfa","name":"","topic":"domoticz/in","qos":"","retain":"","broker":"9a37d1dd.66c5a","x":1090,"y":360,"wires":[]},{"id":"e789ba4a.f437d8","type":"debug","z":"34f140f8.a2bfa","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":830,"y":340,"wires":[]},{"id":"ea2010a9.53948","type":"function","z":"34f140f8.a2bfa","name":"Decode Trame Charge","func":"// Récupération des données\n//Préparation requête pour Domoticz\nvar XValue\nXValue= \"\"+ Math.round((msg.payload.IINST/msg.payload.ISOUSC)*100);\n\nmsg.payload = {};\nmsg.payload.idx = 71;\nmsg.payload.svalue = XValue;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":500,"y":440,"wires":[["3b94d44c.87a34c","f45557f4.05a298"]]},{"id":"f45557f4.05a298","type":"mqtt out","z":"34f140f8.a2bfa","name":"","topic":"domoticz/in","qos":"","retain":"","broker":"9a37d1dd.66c5a","x":1090,"y":440,"wires":[]},{"id":"3b94d44c.87a34c","type":"debug","z":"34f140f8.a2bfa","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":830,"y":420,"wires":[]},{"id":"91aaccbd.44a7","type":"function","z":"34f140f8.a2bfa","name":"Decode Trame Current","func":"// Récupération des données\n//Préparation requête pour Domoticz\nvar XValue\nXValue= msg.payload.IINST+\";0;0\";\n\nmsg.payload = {};\nmsg.payload.idx = 70;\nmsg.payload.svalue = XValue;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":500,"y":520,"wires":[["72ded3b2.4e5e1c","a93412bc.bf78d"]]},{"id":"72ded3b2.4e5e1c","type":"debug","z":"34f140f8.a2bfa","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":830,"y":500,"wires":[]},{"id":"b4e3e8af.7a2818","type":"mqtt out","z":"34f140f8.a2bfa","name":"","topic":"domoticz/in","qos":"","retain":"","broker":"9a37d1dd.66c5a","x":1090,"y":600,"wires":[]},{"id":"c9b9361f.3f2328","type":"function","z":"34f140f8.a2bfa","name":"Decode Trame PTEC","func":"// Récupération des données\n//Préparation requête pour Domoticz\nvar XValue\nif (msg.payload.PTEC==\"HP..\") {\n XValue= \"(2) Heures Pleines\";\n}\nelse XValue= \"(1) Heures Creuses\";\n\nmsg.payload = {};\nmsg.payload.idx = 72;\nmsg.payload.svalue = XValue;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":500,"y":600,"wires":[["f762a514.7927c8","b4e3e8af.7a2818"]]},{"id":"f762a514.7927c8","type":"debug","z":"34f140f8.a2bfa","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":830,"y":580,"wires":[]},{"id":"aa682529.bceab8","type":"mqtt out","z":"34f140f8.a2bfa","name":"","topic":"domoticz/in","qos":"","retain":"","broker":"9a37d1dd.66c5a","x":1090,"y":680,"wires":[]},{"id":"3906e2c8.df91ce","type":"function","z":"34f140f8.a2bfa","name":"Decode Trame Gestion alerte courant","func":"// Récupération des données\n//Préparation requête pour Domoticz\nvar XValue\nif (msg.payload.IINST<48) {\n XValue= \"(1) < 80% de 60A souscrits\";\n}\nelse if (msg.payload.IINST>=48 & msg.payload.IINST<52) {\n XValue= \"(2) >80% et <90% de 60A souscrits\";\n}\nelse XValue= \"(3) >90% de 60A souscrits\";\n\nmsg.payload = {};\nmsg.payload.idx = 73;\nmsg.payload.svalue = XValue;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":550,"y":680,"wires":[["899a138.e5c52f","aa682529.bceab8"]]},{"id":"899a138.e5c52f","type":"debug","z":"34f140f8.a2bfa","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":830,"y":660,"wires":[]},{"id":"f9ca7352.9abe8","type":"mqtt-broker","z":"","name":"","broker":"192.168.1.200","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"9a37d1dd.66c5a","type":"mqtt-broker","z":"","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"15","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"{\"hwid\":\"19\",\"idx\":56,\"nvalue\":0,\"svalue\":\"959\"}","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]