├── .gitignore
├── doc
├── images
│ └── sigri_linky_icon.png
└── fr_FR
│ ├── index.asciidoc
│ ├── presentation.asciidoc
│ └── configuration.asciidoc
├── plugin_info
├── info.json
├── configuration.php
└── install.php
├── README.md
├── desktop
├── js
│ └── sigri_linky.js
└── php
│ └── sigri_linky.php
├── LICENSE
└── core
└── class
└── sigri_linky.class.php
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 |
--------------------------------------------------------------------------------
/doc/images/sigri_linky_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Sigri44/sigri_linky/HEAD/doc/images/sigri_linky_icon.png
--------------------------------------------------------------------------------
/doc/fr_FR/index.asciidoc:
--------------------------------------------------------------------------------
1 | == Presentation
2 | include::presentation.asciidoc[]
3 |
4 | '''
5 | == Configuration
6 | include::configuration.asciidoc[]
7 |
--------------------------------------------------------------------------------
/doc/fr_FR/presentation.asciidoc:
--------------------------------------------------------------------------------
1 | === Sigri Linky
2 |
3 | Ce plugin utilise le site Enedis pour obtenir les informations de votre consommation depuis votre compteur Linky
--------------------------------------------------------------------------------
/plugin_info/info.json:
--------------------------------------------------------------------------------
1 | {
2 | "id" : "sigri_linky",
3 | "name" : "Sigri Linky",
4 | "licence" : "AGPL",
5 | "author" : "Sigri44",
6 | "require" : "3.0",
7 | "version": "1.0",
8 | "category" : "energy",
9 | "hasDependency" : false,
10 | "hasOwnDeamon" : false,
11 | "maxDependancyInstallTime" : 0,
12 | "documentation": "https://github.com/Sigri44/sigri_linky",
13 | "changelog": "https://github.com/Sigri44/sigri_linky"
14 | }
--------------------------------------------------------------------------------
/doc/fr_FR/configuration.asciidoc:
--------------------------------------------------------------------------------
1 | === Configuration du plugin
2 |
3 | Si vous n'avez pas encore de compte Enedis, vous pouvez l'ouvrir sur l'URL ci-après :
4 | https://espace-client-particuliers.enedis.fr/web/espace-particuliers/creation-de-compte
5 |
6 | Ce plugin historise vos donnees, vous devez avoir donc un equipement non visible pour ne pas l'avoir en dashboard.
7 | Pour acceder aux donnees : creer une vue, un design pour charger le graphique, ou consulter l'historique.
8 |
9 | Vos données seront recupere une fois par heure
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Jeedom_SigriLinky
2 | Ce plugin utilise le site Enedis pour obtenir les informations de votre consommation depuis votre compteur Linky.
3 |
4 | *Librement inspiré du module d'Edouard Marchand, sous license AGPL.
5 |
6 | # EDIT 04/03/2020 :
7 | ### Comme prévu depuis plusieurs mois, Enedis a entièrement mis à jour son interface en intégrant un Captcha. C'est donc désormais impossible de crawler le site, je suis donc toujours en attente d'un système pour pouvoir interroger leur API.
8 |
9 | # Next Features
10 |
11 | - Correction du bug J-1
12 | - Ajout d'une option pour importer jusqu'à J-30
13 | - Ajout d'un mode "Production", pour récupérer l'énergie que gagne un producteur d'électricité
14 |
--------------------------------------------------------------------------------
/plugin_info/configuration.php:
--------------------------------------------------------------------------------
1 | .
16 | */
17 |
18 | require_once dirname(__FILE__) . '/../../../core/php/core.inc.php';
19 | include_file('core', 'authentification', 'php');
20 | if (!isConnect()) {
21 | include_file('desktop', '404', 'php');
22 | die();
23 | }
24 | ?>
25 |
--------------------------------------------------------------------------------
/plugin_info/install.php:
--------------------------------------------------------------------------------
1 | .
16 | */
17 |
18 | require_once dirname(__FILE__) . '/../../../core/php/core.inc.php';
19 |
20 | function sigri_linky_install() {
21 | $random_minutes = rand(1, 59);
22 | $crontab_schedule = $random_minutes." 5-23/5 * * *";
23 | $cron = cron::byClassAndFunction('sigri_linky', 'launch_sigri_linky');
24 | if (!is_object($cron)) {
25 | $cron = new cron();
26 | $cron->setClass('sigri_linky');
27 | $cron->setFunction('launch_sigri_linky');
28 | $cron->setEnable(1);
29 | $cron->setDeamon(0);
30 | $cron->setSchedule($crontab_schedule);
31 | $cron->save();
32 | }
33 | }
34 |
35 | function sigri_linky_update() {
36 | $random_minutes = rand(1, 59);
37 | $crontab_schedule = $random_minutes." 5-23/5 * * *";
38 | $cron = cron::byClassAndFunction('sigri_linky', 'launch_sigri_linky');
39 | if (!is_object($cron)) {
40 | $cron = new cron();
41 | $cron->setClass('sigri_linky');
42 | $cron->setFunction('launch_sigri_linky');
43 | $cron->setEnable(1);
44 | $cron->setDeamon(0);
45 | $cron->setSchedule($crontab_schedule);
46 | $cron->save();
47 | }
48 | $cron->setSchedule($crontab_schedule);
49 | $cron->save();
50 | $cron->stop();
51 | }
52 |
53 | function sigri_linky_remove() {
54 | $cron = cron::byClassAndFunction('sigri_linky', 'launch_sigri_linky');
55 | if (is_object($cron)) {
56 | $cron->stop();
57 | $cron->remove();
58 | }
59 | }
60 | ?>
--------------------------------------------------------------------------------
/desktop/js/sigri_linky.js:
--------------------------------------------------------------------------------
1 |
2 | /* This file is part of Jeedom.
3 | *
4 | * Jeedom is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 3 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * Jeedom is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with Jeedom. If not, see .
16 | */
17 |
18 |
19 | $("#table_cmd").sortable({axis: "y", cursor: "move", items: ".cmd", placeholder: "ui-state-highlight", tolerance: "intersect", forcePlaceholderSize: true});
20 | /*
21 | * Fonction pour l'ajout de commande, appellé automatiquement par plugin.template
22 | */
23 | function addCmdToTable(_cmd) {
24 | if (!isset(_cmd)) {
25 | var _cmd = {configuration: {}};
26 | }
27 | if (!isset(_cmd.configuration)) {
28 | _cmd.configuration = {};
29 | }
30 | var tr = '
126 |
127 |
128 |
129 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 | {description}
294 | Copyright (C) {year} {fullname}
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | {signature of Ty Coon}, 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
340 |
341 |
--------------------------------------------------------------------------------
/core/class/sigri_linky.class.php:
--------------------------------------------------------------------------------
1 | .
17 | */
18 |
19 | /* * ***************************Includes********************************* */
20 | require_once __DIR__ . '/../../../../core/php/core.inc.php';
21 |
22 | class sigri_linky extends eqLogic
23 | {
24 | /* * *************************Attributs****************************** */
25 |
26 | /* * ***********************Methode static*************************** */
27 |
28 | /*
29 | * Fonction exécutée automatiquement toutes les minutes par Jeedom
30 | public static function cron() {
31 |
32 | }
33 | */
34 |
35 | /* Fonction exécutée automatiquement toutes les 5 minutes par Jeedom
36 | public static function cron5() {
37 |
38 | }
39 | */
40 |
41 | /*
42 | * Fonction exécutée automatiquement tous les jours par Jeedom
43 | public static function cronDayly() {
44 |
45 | }
46 | */
47 |
48 | /* * *********************Méthodes d'instance************************* */
49 |
50 | /*public function preInsert() {
51 |
52 | }
53 |
54 | public function postInsert() {
55 |
56 | }
57 |
58 | public function preSave() {
59 |
60 | }
61 |
62 | public function postSave() {
63 |
64 | }*/
65 |
66 | public function preUpdate()
67 | {
68 | if (empty($this->getConfiguration('identifiant'))) {
69 | throw new Exception(__('L\'identifiant ne peut pas être vide',__FILE__));
70 | }
71 |
72 | if (empty($this->getConfiguration('password'))) {
73 | throw new Exception(__('Le mot de passe ne peut etre vide',__FILE__));
74 | }
75 | }
76 |
77 | public function postUpdate()
78 | {
79 | if ( $this->getIsEnable() ){
80 | $cmd = $this->getCmd(null, 'consoheure');
81 | if ( ! is_object($cmd)) {
82 | $cmd = new sigri_linkyCmd();
83 | $cmd->setName('Consommation Horaire');
84 | $cmd->setEqLogic_id($this->getId());
85 | $cmd->setLogicalId('consoheure');
86 | $cmd->setUnite('kW');
87 | $cmd->setType('info');
88 | $cmd->setSubType('numeric');
89 | $cmd->setIsHistorized(1);
90 | $cmd->setEventOnly(1);
91 | $cmd->save();
92 | }
93 |
94 | $cmd = $this->getCmd(null, 'consojour');
95 | if ( ! is_object($cmd)) {
96 | $cmd = new sigri_linkyCmd();
97 | $cmd->setName('Consommation journalière');
98 | $cmd->setEqLogic_id($this->getId());
99 | $cmd->setLogicalId('consojour');
100 | $cmd->setUnite('kWh');
101 | $cmd->setType('info');
102 | $cmd->setSubType('numeric');
103 | $cmd->setIsHistorized(1);
104 | $cmd->setEventOnly(1);
105 | $cmd->save();
106 | }
107 | $cmd = $this->getCmd(null, 'consomois');
108 | if ( ! is_object($cmd)) {
109 | $cmd = new sigri_linkyCmd();
110 | $cmd->setName('Consommation Mensuelle');
111 | $cmd->setEqLogic_id($this->getId());
112 | $cmd->setLogicalId('consomois');
113 | $cmd->setUnite('kWh');
114 | $cmd->setType('info');
115 | $cmd->setSubType('numeric');
116 | $cmd->setIsHistorized(1);
117 | $cmd->setEventOnly(1);
118 | $cmd->save();
119 | }
120 |
121 | $cmd = $this->getCmd(null, 'consoan');
122 | if ( ! is_object($cmd)) {
123 | $cmd = new sigri_linkyCmd();
124 | $cmd->setName('Consommation annuelle');
125 | $cmd->setEqLogic_id($this->getId());
126 | $cmd->setLogicalId('consoan');
127 | $cmd->setUnite('kWh');
128 | $cmd->setType('info');
129 | $cmd->setSubType('numeric');
130 | $cmd->setIsHistorized(1);
131 | $cmd->setEventOnly(1);
132 | $cmd->save();
133 | }
134 | }
135 | }
136 |
137 | public function preRemove() {
138 |
139 | }
140 |
141 | public function postRemove() {
142 |
143 | }
144 |
145 | /*
146 | // Non obligatoire mais permet de modifier l'affichage du widget si vous en avez besoin
147 | public function toHtml($_version = 'dashboard') {
148 | }
149 | */
150 |
151 | /** **********************Getteur Setteur*************************** */
152 |
153 | public static function launch_sigri_linky()
154 | {
155 | foreach (eqLogic::byType('sigri_linky', true) as $sigri_linky) {
156 |
157 | log::add('sigri_linky', 'info', 'Debut d\'interrogration Enedis');
158 | if ($sigri_linky->getIsEnable() == 1) {
159 | if (!empty($sigri_linky->getConfiguration('identifiant')) && !empty($sigri_linky->getConfiguration('password'))) {
160 |
161 | $cmd_date = $sigri_linky->getCmd(null, 'consojour');
162 | if (is_object($cmd_date)) {
163 | $value = $cmd_date->execCmd();
164 | $collectDate = $cmd_date->getCollectDate();
165 | $command_date = new DateTime($collectDate);
166 | $start_date = new DateTime();
167 | $start_date->sub(new DateInterval('P1D'));
168 | if(date_format($command_date, 'Y-m-d') == date_format($start_date, 'Y-m-d')) {
169 | log::add('sigri_linky', 'debug', 'Donnees deja presentes pour aujourd\'hui');
170 | } else {
171 | $Useragent = $sigri_linky->GetUserAgent();
172 | log::add('sigri_linky', 'debug', 'UserAgent pour ce lancement : '.$Useragent);
173 | $API_cookies = $sigri_linky->Login_Enedis_API($Useragent);
174 |
175 | $cmd = $sigri_linky->getCmd(null, 'consoheure');
176 | if (is_object($cmd)) {
177 | $end_date = new DateTime();
178 | $start_date = (new DateTime())->setTime(0,0);
179 | $start_date->sub(new DateInterval('P7D'));
180 | $sigri_linky->Call_Enedis_API($API_cookies, $Useragent, "urlCdcHeure", $start_date, $end_date);
181 | }
182 |
183 | $cmd = $sigri_linky->getCmd(null, 'consojour');
184 | if (is_object($cmd)) {
185 | $end_date = new DateTime();
186 | $start_date = new DateTime();
187 | $start_date->sub(new DateInterval('P30D'));
188 | $sigri_linky->Call_Enedis_API($API_cookies, $Useragent, "urlCdcJour", $start_date, $end_date);
189 | }
190 |
191 | $cmd = $sigri_linky->getCmd(null, 'consomois');
192 | if (is_object($cmd)) {
193 | $end_date = new DateTime();
194 | $start_date = new DateTime('first day of this month');
195 | $start_date->sub(new DateInterval('P12M'));
196 | $sigri_linky->Call_Enedis_API($API_cookies, $Useragent, "urlCdcMois", $start_date, $end_date);
197 | }
198 |
199 | $cmd = $sigri_linky->getCmd(null, 'consoan');
200 | if (is_object($cmd)) {
201 | $end_date = new DateTime('first day of January');
202 | $start_date = new DateTime('first day of January');
203 | $start_date->sub(new DateInterval('P5Y'));
204 | $sigri_linky->Call_Enedis_API($API_cookies, $Useragent, "urlCdcAn", $start_date, $end_date);
205 | }
206 | }
207 | }
208 | log::add('sigri_linky', 'info', 'Fin d\'interrogration Enedis');
209 | } else {
210 | log::add('sigri_linky', 'error', 'Identifiants requis');
211 | }
212 | }
213 | }
214 | }
215 |
216 | public function Login_Enedis_API($Useragent)
217 | {
218 | log::add('sigri_linky', 'debug', 'Tentative d\'authentification sur Enedis');
219 |
220 | $URL_LOGIN = "https://espace-client-connexion.enedis.fr/auth/UI/Login";
221 | $URL_ACCUEIL = "https://espace-client-particuliers.enedis.fr/group/espace-particuliers/accueil";
222 |
223 | $data = array(
224 | "IDToken1=".urlencode($this->getConfiguration('identifiant')),
225 | "IDToken2=".urlencode($this->getConfiguration('password')),
226 | "SunQueryParamsString=".base64_encode('realm=particuliers'),
227 | "encoded=true",
228 | "gx_charset=UTF-8",
229 | );
230 |
231 | for ($login_phase1_attemps = 1; $login_phase1_attemps <= 11; $login_phase1_attemps++) {
232 |
233 | if ($login_phase1_attemps == 11) {
234 | log::add('sigri_linky', 'error', 'Erreur de connexion au site Enedis (Phase 1)');
235 | exit(1);
236 | }
237 | log::add('sigri_linky', 'debug', 'Connexion au site Enedis Phase 1 : Tentative '.$login_phase1_attemps.'/10');
238 | $ch = curl_init();
239 | curl_setopt($ch, CURLOPT_POST, 1);
240 | curl_setopt($ch, CURLOPT_POSTFIELDS, implode('&', $data));
241 | curl_setopt($ch, CURLOPT_URL, $URL_LOGIN);
242 | curl_setopt($ch, CURLOPT_HEADER ,1);
243 | curl_setopt($ch, CURLOPT_RETURNTRANSFER ,1);
244 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,0);
245 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
246 | $content = curl_exec($ch);
247 | $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
248 | curl_close($ch);
249 |
250 | if ($http_status == "302") {
251 | preg_match_all('|Set-Cookie: (.*);|U', $content, $cookiesheader);
252 | $ResponseCookie = $cookiesheader[1];
253 | foreach($ResponseCookie as $key => $val) {
254 | $cookie_explode = explode('=', $val);
255 | $cookies[$cookie_explode[0]]=$cookie_explode[1];
256 | }
257 | $cookie_iPlanetDirectoryPro = $cookies['iPlanetDirectoryPro'];
258 | if($cookie_iPlanetDirectoryPro === "LOGOUT") {
259 | log::add('sigri_linky', 'error', 'Erreur d\'identification');
260 | exit(1);
261 | } else {
262 | log::add('sigri_linky', 'info', 'Connexion au site Enedis Phase 1 : OK');
263 | break;
264 | }
265 | }
266 | }
267 |
268 | $headers = array(
269 | "Cookie: iPlanetDirectoryPro=".$cookie_iPlanetDirectoryPro
270 | );
271 |
272 | for ($login_phase2_attemps = 1; $login_phase2_attemps <= 11; $login_phase2_attemps++) {
273 |
274 | if ($login_phase2_attemps == 11) {
275 | log::add('sigri_linky', 'error', 'Erreur de connexion au site Enedis (Phase 2)');
276 | exit(1);
277 | }
278 | log::add('sigri_linky', 'debug', 'Connexion au site Enedis Phase 2 : Tentative '.$login_phase2_attemps.'/10');
279 | $ch = curl_init();
280 | curl_setopt($ch, CURLOPT_URL, $URL_ACCUEIL);
281 | curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
282 | curl_setopt($ch, CURLOPT_HEADER ,1);
283 | curl_setopt($ch, CURLOPT_RETURNTRANSFER ,1);
284 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,0);
285 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
286 | curl_setopt($ch, CURLOPT_USERAGENT, $Useragent);
287 | $content = curl_exec($ch);
288 | $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
289 | curl_close($ch);
290 |
291 | if ($http_status == "302") {
292 | preg_match_all('|Set-Cookie: (.*);|U', $content, $cookiesheader);
293 | $ResponseCookie = $cookiesheader[1];
294 | foreach($ResponseCookie as $key => $val) {
295 | $cookie_explode = explode('=', $val);
296 | $cookies[$cookie_explode[0]]=$cookie_explode[1];
297 | }
298 | $cookie_JSESSIONID = $cookies['JSESSIONID'];
299 | log::add('sigri_linky', 'info', 'Connexion au site Enedis Phase 2 : OK');
300 | break;
301 | }
302 |
303 | }
304 |
305 | $API_cookies = array(
306 | "Cookie: iPlanetDirectoryPro=".$cookie_iPlanetDirectoryPro,
307 | "Cookie: JSESSIONID=".$cookie_JSESSIONID,
308 | );
309 |
310 | // TODO : Fix args (logs into cron_execution)
311 | //log::add('sigri_linky', 'debug', 'Cookies d\'authentification OK : '.print_r($API_cookies));
312 |
313 | log::add('sigri_linky', 'debug', 'Verification si demande des conditions d\'utilisation');
314 | $ch = curl_init();
315 | curl_setopt($ch, CURLOPT_URL, $URL_ACCUEIL);
316 | curl_setopt($ch, CURLOPT_HTTPHEADER, $API_cookies);
317 | curl_setopt($ch, CURLOPT_HEADER ,1);
318 | curl_setopt($ch, CURLOPT_RETURNTRANSFER ,1);
319 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1);
320 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
321 | curl_setopt($ch, CURLOPT_USERAGENT, $Useragent);
322 | $content = curl_exec($ch);
323 | $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
324 | curl_close($ch);
325 |
326 | if ($http_status == "200") {
327 | preg_match("/\(.*)\<\/title\>/isU", $content, $matches);
328 | if (strpos($matches[1], "Conditions d'utilisation") !== false) {
329 | log::add('sigri_linky', 'error', 'Enedis vous demande de reconfirmer les conditions d\'utilisation, merci de vous reconnecter via leur site web');
330 | exit(1);
331 | } else {
332 | log::add('sigri_linky', 'debug', 'Pas de demande de conditions d\'utilisation : OK');
333 | }
334 | }
335 | return $API_cookies;
336 | }
337 |
338 | public function Call_Enedis_API($cookies, $Useragent, $resource_id, $start_datetime=None, $end_datetime=None)
339 | {
340 | $URL_CONSO = "https://espace-client-particuliers.enedis.fr/group/espace-particuliers/suivi-de-consommation";
341 |
342 | $prefix = '_lincspartdisplaycdc_WAR_lincspartcdcportlet_';
343 |
344 | $start_date = $start_datetime->format('d/m/Y');
345 | $end_date = $end_datetime->format('d/m/Y');
346 |
347 | $data = array(
348 | $prefix."dateDebut"."=".$start_date,
349 | $prefix."dateFin"."=".$end_date
350 | );
351 |
352 | $param = array(
353 | "p_p_id=lincspartdisplaycdc_WAR_lincspartcdcportlet",
354 | "p_p_lifecycle=2",
355 | "p_p_state=normal",
356 | "p_p_mode=view",
357 | "p_p_resource_id=".$resource_id,
358 | "p_p_cacheability=cacheLevelPage",
359 | "p_p_col_id=column-1",
360 | "p_p_col_pos=1",
361 | "p_p_col_count=3"
362 | );
363 |
364 | for ($retreive_attemps = 1; $retreive_attemps <= 11; $retreive_attemps++) {
365 |
366 | if ($retreive_attemps == 11) {
367 | log::add('sigri_linky', 'error', 'Erreur lors de la récupération des données ('.$resource_id.') depuis Enedis');
368 | break;
369 | }
370 | log::add('sigri_linky', 'info', 'Recupération des données ('.$resource_id.') depuis Enedis : Tentative '.$retreive_attemps.'/10');
371 | $ch = curl_init();
372 | curl_setopt($ch, CURLOPT_URL, $URL_CONSO."?".implode('&', $param));
373 | curl_setopt($ch, CURLOPT_POST, 1);
374 | curl_setopt($ch, CURLOPT_POSTFIELDS, implode('&', $data));
375 | curl_setopt($ch, CURLOPT_HTTPHEADER, $cookies);
376 | curl_setopt($ch, CURLOPT_HEADER, 0);
377 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
378 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
379 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
380 | curl_setopt($ch, CURLOPT_USERAGENT, $Useragent);
381 | $content = curl_exec($ch);
382 | $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
383 | curl_close($ch);
384 |
385 | if ($http_status == "200") {
386 | $this->Enedis_Results_Jeedom($resource_id, $content, $start_datetime);
387 | log::add('sigri_linky', 'info', 'Recupération des données ('.$resource_id.') depuis Enedis : OK');
388 | break;
389 | }
390 | }
391 | }
392 |
393 | public function Enedis_Results_Jeedom($resource_id, $content, $start_datetime) {
394 | $obj = json_decode($content, true);
395 | // TODO : Fix print_r args (logs into cron_execution)
396 | //log::add('sigri_linky', 'debug',var_dump($obj));
397 |
398 | if ($obj['etat']['valeur'] == "erreur") {
399 | log::add('sigri_linky', 'error', 'Enedis renvoi une erreur sur la page '.$resource_id);
400 | if (isset($obj['etat']['erreurText'])) {
401 | log::add('sigri_linky', 'error', 'Message d\'erreur : '.$obj['etat']['erreurText']);
402 | }
403 | } else {
404 | if ($resource_id == "urlCdcHeure") {
405 | log::add('sigri_linky', 'debug', 'Traitement données heures');
406 | $cmd = $this->getCmd(null, 'consoheure');
407 | $delta = "30 minutes";
408 | $start_date = $start_datetime;
409 | $date_format = "Y-m-d H:i:00";
410 | } elseif ($resource_id == "urlCdcJour") {
411 | log::add('sigri_linky', 'debug', 'Traitement données jours');
412 | $cmd = $this->getCmd(null, 'consojour');
413 | $delta = "1 day";
414 | $start_date = $obj['graphe']['periode']['dateDebut'];
415 | $start_date = date_create_from_format('d/m/Y', $start_date);
416 | $date_format = "Y-m-d";
417 | } elseif ($resource_id == "urlCdcMois") {
418 | log::add('sigri_linky', 'debug', 'Traitement données mois');
419 | $cmd = $this->getCmd(null, 'consomois');
420 | $delta = "1 month";
421 | $start_date = $obj['graphe']['periode']['dateDebut'];
422 | $start_date = date_create_from_format('d/m/Y', $start_date);
423 | $date_format = "Y-m-d";
424 | } elseif ($resource_id == "urlCdcAn") {
425 | $cmd = $this->getCmd(null, 'consoan');
426 | log::add('sigri_linky', 'debug', 'Traitement données ans');
427 | $delta = "1 year";
428 | $start_date = $obj['graphe']['periode']['dateDebut'];
429 | $start_date = date_create_from_format('d/m/Y', $start_date);
430 | $start_date = date_create($start_date->format('Y-1-1'));
431 | $date_format = "Y-m-d";
432 | }
433 |
434 | foreach ($obj['graphe']['data'] as &$value) {
435 | $jeedom_event_date = $start_date->format($date_format);
436 | if ($value['valeur'] == "-1" OR $value['valeur'] == "-2") {
437 | log::add('sigri_linky', 'debug', 'Date : '.$jeedom_event_date.' : Valeur incorrect : '.$value['valeur']);
438 | } else {
439 | log::add('sigri_linky', 'debug', 'Date : '.$jeedom_event_date.' : Indice : '.$value['valeur'].' kWh');
440 | $cmd->event($value['valeur'], $jeedom_event_date);
441 | }
442 | date_add($start_date,date_interval_create_from_date_string($delta));
443 | }
444 | }
445 | }
446 |
447 | public function GetUserAgent() {
448 | $useragents = array(
449 | "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.53 Safari/525.19",
450 | "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.19 (KHTML, like Gecko) Chrome/1.0.154.36 Safari/525.19",
451 | "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/7.0.540.0 Safari/534.10",
452 | "Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/534.4 (KHTML, like Gecko) Chrome/6.0.481.0 Safari/534.4",
453 | "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.86 Safari/533.4",
454 | "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.2 (KHTML, like Gecko) Chrome/4.0.223.3 Safari/532.2",
455 | "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/4.0.201.1 Safari/532.0",
456 | "Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.27 Safari/532.0",
457 | "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/2.0.173.1 Safari/530.5",
458 | "Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.558.0 Safari/534.10",
459 | "Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/540.0 (KHTML,like Gecko) Chrome/9.1.0.0 Safari/540.0",
460 | "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.14 (KHTML, like Gecko) Chrome/9.0.600.0 Safari/534.14",
461 | "Mozilla/5.0 (X11; U; Windows NT 6; en-US) AppleWebKit/534.12 (KHTML, like Gecko) Chrome/9.0.587.0 Safari/534.12",
462 | "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.0 Safari/534.13",
463 | "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.11 Safari/534.16",
464 | "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/534.20 (KHTML, like Gecko) Chrome/11.0.672.2 Safari/534.20",
465 | "Mozilla/5.0 (Windows NT 6.0) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.792.0 Safari/535.1",
466 | "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.872.0 Safari/535.2",
467 | "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.36 Safari/535.7",
468 | "Mozilla/5.0 (Windows NT 6.0; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.66 Safari/535.11",
469 | "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.45 Safari/535.19",
470 | "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/535.24 (KHTML, like Gecko) Chrome/19.0.1055.1 Safari/535.24",
471 | "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1090.0 Safari/536.6",
472 | "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1",
473 | "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.15 (KHTML, like Gecko) Chrome/24.0.1295.0 Safari/537.15",
474 | "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36",
475 | "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1467.0 Safari/537.36",
476 | "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36",
477 | "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1623.0 Safari/537.36",
478 | "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36",
479 | "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.103 Safari/537.36",
480 | "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.38 Safari/537.36",
481 | "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.71 Safari/537.36",
482 | "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36",
483 | "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36",
484 | "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b3) Gecko/20090305 Firefox/3.1b3 GTB5",
485 | "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; ko; rv:1.9.1b2) Gecko/20081201 Firefox/3.1b2",
486 | "Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5",
487 | "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.12) Gecko/20080214 Firefox/2.0.0.12",
488 | "Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8",
489 | "Mozilla/5.0 (X11; U; OpenBSD i386; en-US; rv:1.8.0.5) Gecko/20060819 Firefox/1.5.0.5",
490 | "Mozilla/5.0 (Windows; U; Windows NT 5.0; es-ES; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3",
491 | "Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.7.9) Gecko/20050711 Firefox/1.0.5",
492 | "Mozilla/5.0 (Windows; Windows NT 6.1; rv:2.0b2) Gecko/20100720 Firefox/4.0b2",
493 | "Mozilla/5.0 (X11; Linux x86_64; rv:2.0b4) Gecko/20100818 Firefox/4.0b4",
494 | "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2) Gecko/20100308 Ubuntu/10.04 (lucid) Firefox/3.6 GTB7.1",
495 | "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b7) Gecko/20101111 Firefox/4.0b7",
496 | "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b8pre) Gecko/20101114 Firefox/4.0b8pre",
497 | "Mozilla/5.0 (X11; Linux x86_64; rv:2.0b9pre) Gecko/20110111 Firefox/4.0b9pre",
498 | "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.0b9pre) Gecko/20101228 Firefox/4.0b9pre",
499 | "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:2.2a1pre) Gecko/20110324 Firefox/4.2a1pre",
500 | "Mozilla/5.0 (X11; U; Linux amd64; rv:5.0) Gecko/20100101 Firefox/5.0 (Debian)",
501 | "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0a2) Gecko/20110613 Firefox/6.0a2",
502 | "Mozilla/5.0 (X11; Linux i686 on x86_64; rv:12.0) Gecko/20100101 Firefox/12.0",
503 | "Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20120716 Firefox/15.0a2",
504 | "Mozilla/5.0 (X11; Ubuntu; Linux armv7l; rv:17.0) Gecko/20100101 Firefox/17.0",
505 | "Mozilla/5.0 (Windows NT 6.1; rv:21.0) Gecko/20130328 Firefox/21.0",
506 | "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:22.0) Gecko/20130328 Firefox/22.0",
507 | "Mozilla/5.0 (Windows NT 5.1; rv:25.0) Gecko/20100101 Firefox/25.0",
508 | "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:25.0) Gecko/20100101 Firefox/25.0",
509 | "Mozilla/5.0 (Windows NT 6.1; rv:28.0) Gecko/20100101 Firefox/28.0",
510 | "Mozilla/5.0 (X11; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0",
511 | "Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0",
512 | "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0",
513 | "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0"
514 | );
515 |
516 | $rand_key = array_rand($useragents);
517 | return $useragents[$rand_key];
518 | }
519 | }
520 |
521 | class sigri_linkyCmd extends cmd {
522 | public function execute($_options = array()) {
523 | }
524 | }
525 | ?>
526 |
--------------------------------------------------------------------------------