Repository navigation
Conversation
Jeedom now reaches the daemon through a Unix socket that only the Jeedom account can open, so the daemon no longer needs the plugin API key, a TCP port or a key check on each message. The daemon sends its values with the plugin API key on Jeedom 4.6, and through the Jeedom 5 REST API with its own token, renewed by the daemon itself. The existing helpers keep their API: - jeedom.py: jeedom_socket(path=...) for the Unix socket and jeedom_com(..., credentials=...) for Jeedom 5; - jeedom.js: Jeedom.http.config(socket) and Jeedom.com.config(apikey, callback, cycle, credentials). The template class gains the usual deamon_info/start/stop methods, sendToDaemon() over the socket and handleDaemonMessages(), called by Jeedom 5 and by the Jeedom 4 entry point core/php/jeetemplate.php. Also fixes jeedom_utils.stripped(), which failed on the bytes read from the socket under Python 3, and keys such as __proto__ in jeedom.js add_changes. Tested with demond.py and a jeedom.js daemon against a Jeedom 4.6.3 callback and a Jeedom 5 REST endpoint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GLu3j6PkiC7FxSiBPTZDfj
read_socket() no longer checks the API key, because only the Jeedom account can open the Unix socket. Without --socket, jeedom_socket() would fall back to a local TCP port with no check at all, so demond.py now exits instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GLu3j6PkiC7FxSiBPTZDfj
zoic21
requested review from
Salvialf,
Sekiro-kost,
reineabs and
tmartinez69009
November 16, 2026 15:22
deamon_info() reported the daemon running as soon as its pid was alive, so a hung daemon, or a pid reused after a crash, was never restarted. It now also asks the daemon over its Unix socket: jeedom_socket answers a "health" line with "ok" without queuing it, and jeedom.js answers GET /health with 204. The README documents the rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GLu3j6PkiC7FxSiBPTZDfj
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Le démon d'exemple du template suit le nouveau fonctionnement des démons, compatible Jeedom 4.6 et Jeedom 5 :
Jeedom → démon : socket Unix au lieu d'un port TCP avec clé API
--socket) créé en700: seul le compte de Jeedom peut l'ouvrir.psou dans le journal du démon (l'anciendemond.pyl'y écrivait).demond.pyrefuse de démarrer sans--socket, pour ne jamais retomber sur un port TCP non protégé.Démon → Jeedom
/api/v1/plugins/<plugin>/daemon/messages) avec un jeton propre au démon, qu'il renouvelle lui-même (--rest-credentials). Si Jeedom supprime l'accès, le démon s'arrête etdeamon_startlui en ouvre un nouveau au redémarrage.core/php/jeetemplate.phpavec la clé API du plugin. Ce fichier refuse tout quand le démon passe par l'API REST.template::handleDaemonMessages(array $messages).Pour les développeurs : les helpers gardent leur API
jeedom.py:jeedom_socket(path=...)pour le socket Unix ;jeedom_com(..., credentials=...)pour Jeedom 5. Le mode port TCP reste disponible pour les plugins existants.jeedom.js:Jeedom.http.config(socket)etJeedom.com.config(apikey, callback, cycle, credentials).templatecontient les méthodes classiquesdeamon_info,deamon_startetdeamon_stop. S'y ajoutentdaemonJeedomArguments()(choix entre REST et clé API),sendToDaemon()(envoi sur le socket avecsocket_create(AF_UNIX…)) ethandleDaemonMessages(). Il n'y a ni trait ni namespace.Migration d'un plugin existant :
deamon_start--socketport … --callback … --apikey …--socket <chemin>+self::daemonJeedomArguments()socket_create(AF_INET…)+ clé API dans le messagesocket_create(AF_UNIX…)sans clédemond.pyjeedom_socket(port=…)+ contrôle de la cléjeedom_socket(path=…), sans contrôledemond.pyjeedom_com(apikey, url, cycle)credentials=…jeeX.phphandleDaemonMessages(), appelée parjeeX.php(Jeedom 4) et par le Core (Jeedom 5)Important : ne retirer le contrôle de la clé API dans le démon qu'en même temps que le passage au socket Unix.
Corrections au passage
jeedom_utils.stripped()plantait sous Python 3 sur les octets lus sur le socket, doncread_socket()ne pouvait pas fonctionner. Elle garde maintenant les caractères accentués.jeedom.js:add_changessans::envoyait la clé littérale_key. Une clé__proto__venue de l'extérieur pouvait aussi modifier les objets du démon.