├── LICENSE ├── README.md ├── apps └── red_alerts_israel │ ├── lamas.json │ ├── lamas_data.json │ └── red_alerts_israel.py ├── cities_name.md ├── english.md ├── hacs.json ├── hebrew.md └── info.md /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Red Alerts Israel 2 | ***Not Official Pikud Ha-Oref*** 3 | 4 | > Simple rocket-alert monitoring for Home Assistant via AppDaemon 5 | 6 | Red Alerts Israel is an AppDaemon application for Home Assistant that connects to the official Israeli Home Front Command (Pikud HaOref) API. It fetches real-time "Tzeva Adom" rocket alerts and other hazards, making this information available via easy-to-use Home Assistant sensors. 7 | 8 | This script monitors various hazards signaled by PIKUD HA-OREF, including missile/rocket fire, unauthorized aircraft, seismic activity, tsunami, terrorist incursions, chemical emergencies, and more. Upon receiving an alert, the specific threat type is indicated, for example, `ירי רקטות וטילים` for rocket and missile fire. 9 | 10 | The application is designed for reliability and persistence, offering features like archiving alert details, state persistence via JSON backup, triggering Home Assistant native events, publishing messages via MQTT, and providing detailed sensor attributes for creating derived sensors and advanced automations. 11 | 12 | --- 13 | 14 | ## Key Features 15 | 16 | * **Polls** the official Israeli Home Front Command API every few seconds for live alerts. 17 | * **Creates** dedicated Home Assistant entities: main binary sensors, a text helper, a test boolean, and three detailed history sensors. 18 | * **Offers** flexible alert notification publishing via **MQTT** and native **Home Assistant events** triggered by new alert payloads. 19 | * **Saves** alert history (TXT, CSV) and the last active state (JSON) for persistence across restarts (optional). 20 | * **Generates** GeoJSON files for visualizing active and historical alert locations on the Home Assistant map (optional). 21 | * **Provides** specific binary sensors to indicate if an alert affects *your configured cities* or if it's a special "Pre-Alert" type. 22 | * **Tracks** the history of distinct alert events within a configurable time window. 23 | * **Generates** pre-formatted messages suitable for platforms like WhatsApp and Telegram based on cumulative window data. 24 | 25 | --- 26 | 27 | ## Entities Created 28 | 29 | The script creates several Home Assistant entities, using your configured `sensor_name` as the base name (default: `red_alert`): 30 | 31 | * `binary_sensor.YOUR_SENSOR_NAME`: Indicates if *any* alert is currently active *nationwide*. This sensor stays `on` for the duration of the configured `timer` after the *last detected alert activity* in a sequence. 32 | * `binary_sensor.YOUR_SENSOR_NAME_city`: Indicates if `binary_sensor.YOUR_SENSOR_NAME` is `on` *and* the alert window includes one of the specific cities/areas you configured in `city_names`. 33 | * `binary_sensor.YOUR_SENSOR_NAME_pre_alert`: Indicates if a **pre alert** is currently active *nationwide*. This sensor turns `on`. 34 | * `binary_sensor.YOUR_SENSOR_NAME_city_pre_alert`: Indicates if a **pre alert** alert is currently active *and* affects one of your configured `city_names`. This sensor turns `on` only when an pre alert is received and processed AND the alert window includes one of your configured `city_names`. 35 | * `binary_sensor.YOUR_SENSOR_NAME_active_alert`: Indicates if an alert with a **category other than pre alert** is currently active *nationwide*. This sensor turns `on`. 36 | * `binary_sensor.YOUR_SENSOR_NAME_city_active_alert`: Indicates if an alert with a **category other pre alert** is currently active *and* affects one of your configured `city_names`. This sensor turns `on` when a pre alert is received and processed AND the alert window includes one of your configured `city_names`. 37 | * `input_text.YOUR_SENSOR_NAME`: Displays a summary of the *latest alert payload* received during an active alert window. 38 | * `input_boolean.YOUR_SENSOR_NAME_test`: Allows manual triggering of a fictitious test alert sequence. 39 | 40 | Three additional history sensors track distinct alert *events* that occurred within the configured `hours_to_show` timeframe (after applying timer-based deduplication): 41 | 42 | * `sensor.YOUR_SENSOR_NAME_history_cities`: State is the count, attributes list unique cities alerted in the history window. 43 | * `sensor.YOUR_SENSOR_NAME_history_list`: State is the count, attributes list each distinct alert event entry in the history window. 44 | * `sensor.YOUR_SENSOR_NAME_history_group`: State is the count, attributes group distinct alert events by title, area, and city in the history window. 45 | 46 |
47 | Detailed Binary Sensor Logic and Attributes 48 | 49 | ### Binary Sensor States (`binary_sensor.YOUR_SENSOR_NAME`, `_city`, `_pre_alert`, `_city_pre_alert`, `_active_alert`, `_city_active_alert`) 50 | 51 | All six binary sensors are controlled by the script's polling and reset logic. 52 | 53 | * **When a new alert payload is received from the API:** 54 | * `binary_sensor.YOUR_SENSOR_NAME` turns `on` (if not already) and its internal `timer` is reset. 55 | * `binary_sensor.YOUR_SENSOR_NAME_city` turns `on` if any of the *accumulated* cities in the current alert window match your configured `city_names`, otherwise it stays `off`. 56 | * If the `cat` value in the *latest incoming alert payload* is `13`: 57 | * `binary_sensor.YOUR_SENSOR_NAME_pre_alert` turns `on`. 58 | * `binary_sensor.YOUR_SENSOR_NAME_city_pre_alert` turns `on` if the `binary_sensor.YOUR_SENSOR_NAME_city` sensor is `on` (i.e., if configured cities are affected), otherwise it turns `off`. 59 | * `binary_sensor.YOUR_SENSOR_NAME_active_alert` turns `off`. 60 | * `binary_sensor.YOUR_SENSOR_NAME_city_active_alert` turns `off`. 61 | * If the `cat` value in the *latest incoming alert payload* is *not* `13` (e.g., `cat=1` for rockets, which is the case for test alerts): 62 | * `binary_sensor.YOUR_SENSOR_NAME_pre_alert` turns `off`. 63 | * `binary_sensor.YOUR_SENSOR_NAME_city_pre_alert` turns `off`. 64 | * `binary_sensor.YOUR_SENSOR_NAME_active_alert` turns `on`. 65 | * `binary_sensor.YOUR_SENSOR_NAME_city_active_alert` turns `on` if the `binary_sensor.YOUR_SENSOR_NAME_city` sensor is `on`, otherwise it turns `off`. 66 | 67 | * **When the alert timer expires and confirms no active alerts are pending:** 68 | * All six binary sensors (`_main`, `_city`, `_pre_alert`, `_city_pre_alert`, `_active_alert`, `_city_active_alert`) are explicitly set to `off`. 69 | 70 | * **On Script Initialization/Restart:** 71 | * All six binary sensors are initialized to `off`. 72 | 73 | ### Shared Binary Sensor Attributes 74 | When any of the six binary sensors are updated, they receive the *same* set of attributes. These attributes reflect the state and accumulated information for the *current alert window* since `binary_sensor.YOUR_SENSOR_NAME` last turned `on`. When `binary_sensor.YOUR_SENSOR_NAME` is `off`, they show default/empty values or the `prev_*` values from the window that just ended, providing context about the *last* alert incident. 75 | 76 | | Attribute name | Description | Example | 77 | | :------------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------- | 78 | | `active_now` | `true` when `binary_sensor.YOUR_SENSOR_NAME` is `on`, `false` when `off`. Mirrors the main sensor state. | `false` | 79 | | `script_status` | The operational status of the AppDaemon script (`initializing`, `running`, `error`, `terminated`). Useful for monitoring the script itself. | `running` | 80 | | `id` | Unique ID of the *latest* alert payload received during the current window. | `1721993400123456` | 81 | | `cat` | Category number (0-14) of the *latest* alert payload. Corresponds to alert type (e.g., 1 for rockets, 13 for special update). | `1` | 82 | | `title` | Title/Type of the *latest* alert payload (e.g., "ירי רקטות וטילים"). | `ירי רקטות וטילים` | 83 | | `desc` | Recommended action description from the *latest* alert payload (e.g., "היכנסו למרחב המוגן ושהו בו 10 דקות"). | `היכנסו למרחב המוגן ושהו בו 10 דקות` | 84 | | `special_update` | `true` if the `cat` of the *latest* alert payload is 13, `false` otherwise. This attribute mirrors the state logic of the `*_pre_alert` sensors. | `false` | 85 | | `areas` | Comma-separated string of *all areas* affected by *any payload* within the current active window. | `גוש דן, קו העימות` | 86 | | `cities` | A sorted list of all unique original city names affected by *any payload* within the current active window. | `['אור יהודה', 'תל אביב - מרכז העיר']` | 87 | | `data` | Comma-separated string of all unique original city names affected during the current active window. May be truncated if very long. | `אור יהודה, תל אביב - מרכז העיר, חולון...` | 88 | | `data_count` | Count of unique original city names affected during the current active window. | `5` | 89 | | `duration` | Recommended duration (in seconds) to stay in a safe room, extracted from the `desc` of the *latest* alert payload. | `600` | 90 | | `icon` | MDI icon string based on the `cat` of the *latest* alert payload. | `mdi:rocket-launch` | 91 | | `emoji` | Emoji character based on the `cat` of the *latest* alert payload. | `🚀` | 92 | | `alerts_count` | The number of individual alert *payloads* received and processed by the script during the current active alert window (since the main sensor last went `on`). | `3` | 93 | | `last_changed` | ISO timestamp string (`YYYY-MM-DDTHH:MM:SS.ffffff`) when *this sensor's state or any of its attributes were last updated*. | `"2024-07-25T10:30:00.123456"` | 94 | | `my_cities` | A sorted list of the city names exactly as configured in your `apps.yaml` `city_names` list. | `['חיפה - מפרץ', 'תל אביב - מרכז העיר']` | 95 | | `alert` | One-line summary string: `[Title] - [Areas]: [Cities]`. Uses cumulative window data. | `ירי רקטות וטילים - גוש דן, קו העימות: ...` | 96 | | `alert_alt` | Multi-line summary string: `[Title]\n* [Area]: [Cities]\n* [Area]: [Cities]...`. Uses cumulative window data. | ` ירי רקטות וטילים\n* גוש דן: תל אביב...\n* קו העימות: כיסופים` | 97 | | `alert_txt` | One-line string listing Areas and Cities affected in the current window: `[Area]: [Cities], [Area]: [Cities]...`. | `גוש דן: תל אביב - מרכז העיר, אור יהודה...` | 98 | | `alert_wa` | Multi-line formatted message optimized for WhatsApp, summarizing alerts by type and area based on cumulative window data. | ![whatsapp](https://github.com/idodov/RedAlert/assets/19820046/817c72f4-70b1-4499-b831-e5daf55b6220) | 99 | | `alert_tg` | Multi-line formatted message optimized for Telegram, summarizing alerts by type and area based on cumulative window data. | | 100 | | `prev_cat` | Category number of the alert from the *previous* alert window (before the main sensor last went `off` and then `on` again). | `1` | 101 | | `prev_title` | Title of the alert from the *previous* alert window. | `ירי רקטות וטילים` | 102 | | `prev_desc` | Description from the *previous* alert window. | `היכנסו למרחב המוגן ושהו בו 10 דקות` | 103 | | `prev_areas` | Areas from the *previous* alert window. | `קו העימות` | 104 | | `prev_cities` | List of cities from the *previous* alert window. | `['שלומי']` | 105 | | `prev_data` | Comma-separated cities string from the *previous* alert window. | `שלומי` | 106 | | `prev_data_count` | City count from the *previous* alert window. | `1` | 107 | | `prev_duration` | Duration from the *previous* alert window. | `600` | 108 | | `prev_last_changed` | ISO timestamp when the *previous* alert window became active (when the main sensor state last went `on` for that window). | `"2024-07-25T10:15:05.987654"` | 109 | | `prev_alerts_count` | Sequence count from the *previous* alert window. | `2` | 110 | | `prev_special_update` | Special update flag status (`cat==13`) from the *previous* alert window. | `false` | 111 |
112 | 113 | ### `input_text.YOUR_SENSOR_NAME` 114 | * **State**: Holds a brief summary (up to 255 characters) derived from the *latest alert payload's* title, area, and cities (`input_text_state` attribute in the script). 115 | * **Use**: Primarily intended for simple dashboard displays or logbook entries. 116 | * **Important**: This sensor only updates its state when the primary binary sensor (`binary_sensor.YOUR_SENSOR_NAME`) transitions from `off` to `on`, or while it remains `on` AND the script receives a new alert payload. It goes blank or shows "אין התרעות" when the primary sensor turns `off`. Due to its character limit and update behavior, it is **not** recommended for critical automation triggers or storing the full alert details. Use the binary sensor attributes for that. 117 | 118 | ### Dedicated History Sensors (`sensor.YOUR_SENSOR_NAME_history_*`) 119 | These sensors provide structured access to a list of distinct alert *events* that occurred within the past `hours_to_show` timeframe. An "event" here is a single alert payload that is deemed unique based on its title, city, and area, and not within the `timer` duration of a previously recorded event of the same type/location. 120 | 121 | * **`sensor.YOUR_SENSOR_NAME_history_cities`**: 122 | * **State**: The count of unique city names that appeared in *any* distinct history event within the window. 123 | * **Attribute**: `cities_past_N_h` – A sorted list of the unique original city names. Includes `script_status`. 124 | * **`sensor.YOUR_SENSOR_NAME_history_list`**: 125 | * **State**: The total count of distinct alert events within the history window. 126 | * **Attribute**: `last_N_h_alerts` – A list of dictionaries, where each dictionary represents one distinct event with keys `{ title, city, area, time }`. Includes `script_status`. Note: `time` is a string formatted as 'YYYY-MM-DD HH:MM:SS'. 127 | * **`sensor.YOUR_SENSOR_NAME_history_group`**: 128 | * **State**: Same count as `sensor.YOUR_SENSOR_NAME_history_list`. 129 | * **Attribute**: `last_N_h_alerts_group` – A nested dictionary structure `{ title: { area: [ { city, time }, ... ], ... }, ... }` grouping the distinct events. Includes `script_status`. Note: `time` in this attribute is a string formatted as 'HH:MM:SS'. 130 | 131 | 132 | 133 | --- 134 | 135 | # Installation Instructions 136 | 137 | To ensure the states of your `input_text` and `input_boolean` helpers persist across Home Assistant restarts, create them manually beforehand: 138 | 1. Open your Home Assistant `configuration.yaml` file using the File Editor add-on or similar method. 139 |
140 | 2. Add Helpers and File Access to configuration.yaml 141 | 142 | Add the configuration below under `homeassistant:`, `input_text:`, and `input_boolean:`. Adjust the `sensor_name` if you plan to use a different base name than `red_alert`. 143 | 144 | ```yaml 145 | #/config/configuration.yaml 146 | 147 | homeassistant: 148 | # ... other homeassistant settings ... 149 | 150 | # Required for GeoJSON integration to access files from /config/www 151 | # Add the URL(s) Home Assistant uses to access itself locally 152 | allowlist_external_urls: 153 | - http://:8123 # Replace with your actual HA access URL(s) 154 | - http://homeassistant.local:8123 # Example using the default mDNS name 155 | 156 | # Optional: Allow File Editor or other addons to access www if needed 157 | # This entry *might* be needed if your add-on config paths are non-standard 158 | # or you have issues accessing /config/www from other add-ons. 159 | # allowlist_external_dirs: 160 | # - "/config/www" 161 | 162 | input_text: 163 | # Matches default sensor_name. Change 'red_alert' if you use a different sensor_name 164 | red_alert: 165 | name: Last Alert Summary 166 | min: 0 # Minimum length 167 | max: 255 # Maximum length for input_text state 168 | 169 | input_boolean: 170 | # Matches default sensor_name. Change 'red_alert' if you use a different sensor_name 171 | red_alert_test: 172 | name: Trigger Test Alert 173 | icon: mdi:alert-circle 174 | ``` 175 |
176 | 177 | 3. Install the **AppDaemon** addon in Home Assistant: Navigate to `Settings` > `Add-ons` > `Add-on store` > Search for "AppDaemon" and install it. 178 | 4. Once installed, configure AppDaemon: Enable **Show in sidebar**, **Auto-start**, and **Watchdog**. Apply the configuration changes. 179 | 5. **Start** the AppDaemon add-on. 180 | 6. Using a file editor (like the File Editor add-on), edit the AppDaemon configuration file. This is typically located at `/addon_configs/a0d7b954_appdaemon/appdaemon.yaml`. 181 | 182 | > [!TIP] 183 | > 184 | > If using the File Editor add-on and unable to access `/addon_configs`, you might need to disable `Enforce Basepath` in its configuration: Go to `Settings` > `Add-ons` > `File Editor` > `Configuration` and toggle the option off. Remember to re-enable it later if you prefer the security. 185 | 186 | > [!IMPORTANT] 187 | > 188 | > * The `latitude`, `longitude`, `elevation`, and `time_zone` settings here are for AppDaemon itself and affect how AppDaemon handles time-based functions. They are **not** used by the Red Alerts Israel script to determine your location for filtering cities. 189 | > * If you installed via **HACS**, ensure `app_dir: /homeassistant/appdaemon/apps/` is correctly set in your `appdaemon.yaml`. This tells AppDaemon where to find the script files downloaded by HACS. If you installed manually into `/config/appdaemon/apps`, this path might be `/config/appdaemon/apps`. Check your AppDaemon add-on documentation for the correct default if unsure. 190 | 191 |
192 | Configure appdaemon.yaml 193 | 194 | ```yaml 195 | #/addon_configs/a0d7b954_appdaemon/appdaemon.yaml 196 | --- 197 | # secrets: /homeassistant/secrets.yaml # Uncomment this line if you use secrets 198 | appdaemon: 199 | # Set app_dir to where AppDaemon finds your app files. 200 | # For HACS installs, this is typically: 201 | app_dir: /homeassistant/appdaemon/apps/ 202 | 203 | # IMPORTANT - Add your geolocation from https://www.latlong.net/ 204 | latitude: 31.9837528 205 | longitude: 34.7359077 206 | elevation: 2 207 | time_zone: Asia/Jerusalem 208 | 209 | plugins: 210 | HASS: 211 | type: hass 212 | 213 | http: 214 | timeout: 30 # Recommended timeout 215 | admin: 216 | api: 217 | hadashboard: 218 | ``` 219 |
220 | 221 | You can download the script file manually or via HACS. Using HACS is recommended as it simplifies future updates. 222 | 223 | ### Manual Download 224 | 1. Download the `red_alerts_israel.py` script file directly from the GitHub repository: [Download Script](https://raw.githubusercontent.com/idodov/RedAlert/main/apps/red_alerts_israel/red_alerts_israel.py). 225 | 2. Using the File Editor add-on or similar, create a new folder inside your AppDaemon apps directory (usually `/config/appdaemon/apps/` or `/homeassistant/appdaemon/apps/`). Name the folder `red_alerts_israel`. 226 | 3. Place the downloaded `red_alerts_israel.py` file inside the `/red_alerts_israel/` folder you just created. 227 | 4. Proceed to the final step. 228 | 229 | ### HACS Download 230 | 1. In Home Assistant: Navigate to `Settings` > `Integrations` > `HACS` > `Configure` and enable `AppDaemon apps discovery & tracking`. After enabling, return to the main HACS screen. 231 | 2. Click the `...` menu in the top right and select `Custom repositories`. 232 | 3. Add `https://github.com/idodov/RedAlert/` as the repository URL. Select `AppDaemon` as the Category. Click `Add`. 233 | 4. Go back to the main HACS page, search for `Red Alerts Israel`, and click on it. 234 | 5. Click the `Download` button on the integration page. 235 | 6. Proceed to the final step. 236 | 237 | ### Final Step: Configure `apps.yaml` 238 | In your AppDaemon applications configuration file, typically located at `/config/appdaemon/apps/apps.yaml`, add the following configuration block. 239 | 240 | > [!IMPORTANT] 241 | > **`city_names` List**: The names in the `city_names` list **must exactly match** the names defined by PIKUD HA-OREF, including spelling and special characters like hyphens or quotation marks. Consult the official list here: [PIKUD HA-OREF City Names List](https://github.com/idodov/RedAlert/blob/main/cities_name.md). Using incorrect names means the `binary_sensor.YOUR_SENSOR_NAME_city` sensor will **not** turn on for those locations. 242 | 243 |
244 | Configure apps.yaml 245 | 246 | ```yaml 247 | #/config/appdaemon/apps/apps.yaml 248 | 249 | # Make sure this entry matches your app directory name (e.g., red_alerts_israel folder name) 250 | red_alerts_israel: # This is the AppDaemon app name (used in logs) 251 | module: red_alerts_israel # Name of the Python file without the .py extension 252 | class: Red_Alerts_Israel # Name of the main class within the Python file 253 | 254 | # --- Core Settings --- 255 | interval: 5 # (Seconds) How often the script checks the Oref API. Default: 5. Shorter intervals provide faster updates. 256 | timer: 120 # (Seconds) How long binary_sensor.#sensor_name# and binary_sensor.#sensor_name#_city stay 'on' *after the last alert activity is detected* in an incident window. Default: 120. 257 | sensor_name: "red_alert" # Base name for all created Home Assistant entities (e.g., binary_sensor.red_alert). Match this in configuration.yaml if using default helpers. Default: "red_alert". 258 | 259 | # --- History & Saving --- 260 | save_2_file: True # Set to True to enable saving history (.txt, .csv), GeoJSON files (latest & 24h), and JSON state backup to the '/config/www' folder. Default: True. Requires www folder to be writeable. 261 | hours_to_show: 12 # (Hours) The duration for the dedicated history sensors (sensor.#sensor_name#_history_*). Alerts older than this are excluded from history attributes. Default: 4. 262 | 263 | # --- Optional Features --- 264 | mqtt: False # (Boolean or String) Set True to publish JSON alert payload via MQTT to 'home/[sensor_name]/event' topic when a new alert payload is received. Set to a custom topic string (e.g., "notifications/alerts") for a different topic. Default: False. 265 | event: True # (Boolean) Set True to fire a native Home Assistant event '[sensor_name]_event' with the full alert payload when a new alert payload is received. Default: True. 266 | 267 | # --- Location Specific --- 268 | city_names: # List of exact city/area names you want to monitor for binary_sensor.#sensor_name#_city. Case-sensitive. 269 | - "אזור תעשייה צפוני אשקלון" # Example: Ashkelon Industrial Zone North 270 | - "חיפה - מפרץ" # Example: Haifa Bay 271 | - "תל אביב - מרכז העיר" # Example: Tel Aviv - City Center 272 | # Add more city names here exactly as they appear in cities_name.md 273 | - "אשדוד - א,ב,ד,ה" 274 | - "כיסופים" 275 | 276 | ``` 277 | 278 | | Parameter | Description | Example | Default Value | 279 | | :-------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------ | :------------ | 280 | | `interval` | The interval in seconds at which the script polls the API. Shorter intervals mean faster updates but more frequent API calls. Must be > 1. | `3` | `5` | 281 | | `timer` | The duration, in seconds, for which the main binary sensors (`binary_sensor.YOUR_SENSOR_NAME`, `binary_sensor.YOUR_SENSOR_NAME_city`) remain `on` after the *last alert activity is detected* in a single alert window. After this time *and* confirmation of no active alerts, sensors turn `off`. | `180` | `120` | 282 | | `sensor_name` | The base name for all created Home Assistant entities (e.g., `binary_sensor.YOUR_NAME`). Choose a unique name. Ensure it matches the name used for the `input_text` and `input_boolean` helpers in `configuration.yaml`. | `"tseva_adom"` | `"red_alert"` | 283 | | `save_2_file` | Set to `True` to enable saving history files (.txt, .csv), GeoJSON files (`latest` and `history`), and a JSON state backup file to the `/config/www` directory. Requires write permissions for the AppDaemon user/container. | `True` | `True` | 284 | | `hours_to_show` | The duration, in hours, that the dedicated history sensors (`sensor.YOUR_SENSOR_NAME_history_*`) should track and display distinct past alert events. Alerts older than this window are pruned from history attributes. | `24` | `4` | 285 | | `mqtt` | Set to `True` to publish the full JSON alert payload via MQTT when a *new alert payload* is received from the API. The default topic is `home/YOUR_SENSOR_NAME/event`. Can be set to a string (e.g., `"your/custom/topic"`) for a different topic. | `True` or `"alerts/rocket"` | `False` | 286 | | `event` | Set to `True` to fire a native Home Assistant event (`YOUR_SENSOR_NAME_event`) with the full alert payload when a *new alert payload* is received from the API. | `True` | `True` | 287 | | `city_names` | A list of the exact city or area names you want to monitor for the city-specific sensor (`binary_sensor.YOUR_SENSOR_NAME_city`). Names must match the official PIKUD HA-OREF list precisely ([cities_name.md](https://github.com/idodov/RedAlert/blob/main/cities_name.md)). Can be an empty list `[]`. | `תל אביב - מרכז העיר` | `[]` | 288 | 289 |
290 | 291 | 7. Restart the AppDaemon add-on after saving `apps.yaml`. Check the AppDaemon logs (`Settings` > `Add-ons` > `AppDaemon` > `Log`) for errors during initialization. 292 | 293 | 294 | ## Home Assistant Entities Summary 295 | 296 | After successful installation and configuration, Home Assistant will expose several new entities based on your `sensor_name` (default: `red_alert`): 297 | 298 | * `binary_sensor.red_alert`: State is `on` during *any* alert nationwide, `off` otherwise (controlled by `timer`). Attributes contain latest and cumulative data for the current window. 299 | * `binary_sensor.red_alert_city`: State is `on` only if an alert includes one of your `city_names`. Attributes contain same data as the main sensor for the current window. 300 | * `input_text.red_alert`: State shows a brief summary of the *latest alert payload* when a sensor is `on`. 301 | * `input_boolean.red_alert_test`: Toggle this to `on` to manually trigger a test alert sequence. It will turn `off` automatically when the test completes. 302 | * `sensor.red_alert_history_cities`: State is the count of unique cities in the history window (`hours_to_show`). Attribute `cities_past_N_h` lists them. 303 | * `sensor.red_alert_history_list`: State is the count of distinct alert *events* in the history window. Attribute `last_N_h_alerts` lists the events. 304 | * `sensor.red_alert_history_group`: State is the count of distinct alert *events* in the history window. Attribute `last_N_h_alerts_group` provides a grouped structure. 305 | 306 | 307 | 308 | 309 | ## Attribute Reference 310 | The primary binary sensors (`binary_sensor.YOUR_SENSOR_NAME` and `binary_sensor.YOUR_SENSOR_NAME_city`) expose detailed attributes about the current alert window. You can access any attribute in automations, templates, or Lovelace cards using `state_attr('ENTITY_ID', 'attribute_name')`. For example: ```{{ state_attr('binary_sensor.red_alert', 'title') }}``` 311 | 312 |
313 | Full List of Sensor Attributes for `binary_sensor.YOUR_SENSOR_NAME` and `binary_sensor.YOUR_SENSOR_NAME_city` 314 | 315 | These attributes reflect the *current state of the alert window* since the sensor last turned `on`. When the sensor is `off`, they show default/empty values or the `prev_*` values from the window that just ended. 316 | 317 | | Attribute name | Description | Example | 318 | | :------------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------- | 319 | | `active_now` | `true` when the sensor state is `on`, `false` when `off`. Mirrors the sensor state. | `false` | 320 | | `script_status` | The operational status of the AppDaemon script (`initializing`, `running`, `error`, `terminated`). Useful for monitoring the script itself. | `running` | 321 | | `id` | Unique ID of the *latest* alert payload received during the current window. | `1721993400123456` | 322 | | `cat` | Category number (1-13) of the *latest* alert payload. Corresponds to alert type (e.g., 1 for rockets). | `1` | 323 | | `title` | Title/Type of the *latest* alert payload (e.g., "ירי רקטות וטילים"). | `ירי רקטות וטילים` | 324 | | `desc` | Recommended action description from the *latest* alert payload (e.g., "היכנסו למרחב המוגן ושהו בו 10 דקות"). | `היכנסו למרחב המוגן ושהו בו 10 דקות` | 325 | | `special_update` | `true` if the *latest* alert payload is a "special update" from Pikud HaOref, `false` otherwise. | `false` | 326 | | `areas` | Comma-separated string of *all areas* affected by *any payload* within the current active window. | `גוש דן, קו העימות` | 327 | | `cities` | A sorted list of all unique original city names affected by *any payload* within the current active window. | `['אור יהודה', 'תל אביב - מרכז העיר']` | 328 | | `data` | Comma-separated string of all unique original city names affected during the current active window. May be truncated if very long. | `אור יהודה, תל אביב - מרכז העיר, חולון...` | 329 | | `data_count` | Count of unique original city names affected during the current active window. | `5` | 330 | | `duration` | Recommended duration (in seconds) to stay in a safe room, extracted from the `desc` of the *latest* alert payload. | `600` | 331 | | `icon` | MDI icon string based on the `cat` of the *latest* alert payload. | `mdi:rocket-launch` | 332 | | `emoji` | Emoji character based on the `cat` of the *latest* alert payload. | `🚀` | 333 | | `alerts_count` | The number of individual alert *payloads* received and processed by the script during the current active alert window (since the sensor last went `on`). | `3` | 334 | | `last_changed` | ISO timestamp string (`YYYY-MM-DDTHH:MM:SS.ffffff`) when *this sensor's state or any of its attributes were last updated*. | `"2024-07-25T10:30:00.123456"` | 335 | | `my_cities` | A sorted list of the city names exactly as configured in your `apps.yaml` `city_names` list. | `['חיפה - מפרץ', 'תל אביב - מרכז העיר']` | 336 | | `alert` | One-line summary string: `[Title] - [Areas]: [Cities]`. Uses cumulative window data. | `ירי רקטות וטילים - גוש דן, קו העימות: ...` | 337 | | `alert_alt` | Multi-line summary string: `[Title]\n* [Area]: [Cities]\n* [Area]: [Cities]...`. Uses cumulative window data. | ` ירי רקטות וטילים\n* גוש דן: תל אביב...\n* קו העימות: כיסופים` | 338 | | `alert_txt` | One-line string listing Areas and Cities affected in the current window: `[Area]: [Cities], [Area]: [Cities]...`. | `גוש דן: תל אביב - מרכז העיר, אור יהודה...` | 339 | | `alert_wa` | Multi-line formatted message optimized for WhatsApp, summarizing alerts by type and area based on cumulative window data. | ![whatsapp](https://github.com/idodov/RedAlert/assets/19820046/817c72f4-70b1-4499-b831-e5daf55b6220) | 340 | | `alert_tg` | Multi-line formatted message optimized for Telegram, summarizing alerts by type and area based on cumulative window data. | | 341 | | `prev_cat` | Category number of the alert from the *previous* alert window (before the sensor last went `off` and then `on` again). | `1` | 342 | | `prev_title` | Title of the alert from the *previous* alert window. | `ירי רקטות וטילים` | 343 | | `prev_desc` | Description from the *previous* alert window. | `היכנסו למרחב המוגן ושהו בו 10 דקות` | 344 | | `prev_areas` | Areas from the *previous* alert window. | `קו העימות` | 345 | | `prev_cities` | List of cities from the *previous* alert window. | `['שלומי']` | 346 | | `prev_data` | Comma-separated cities string from the *previous* alert window. | `שלומי` | 347 | | `prev_data_count` | City count from the *previous* alert window. | `1` | 348 | | `prev_duration` | Duration from the *previous* alert window. | `600` | 349 | | `prev_last_changed` | ISO timestamp when the *previous* alert window became active (when the sensor state last went `on` for that window). | `"2024-07-25T10:15:05.987654"` | 350 | | `prev_alerts_count` | Sequence count from the *previous* alert window. | `2` | 351 | | `prev_special_update` | Special update flag status from the *previous* alert window. | `false` | 352 |
353 | 354 | --- 355 | 356 | # Usage Examples 357 | 358 | ## Creating Derived Sensors for Specific Updates 359 | 360 | The primary binary sensors (`binary_sensor.YOUR_SENSOR_NAME` and `binary_sensor.YOUR_SENSOR_NAME_city`) remain `on` for the `timer` duration *after the last alert activity* in a window. If multiple alert *payloads* arrive in quick succession during this window, the sensor's attributes update, but the state stays `on`. 361 | 362 | To trigger automations on *each new alert payload* (not just the `off` to `on` state change) or specific types of updates, you can create template binary sensors that monitor attribute changes of the primary sensors. 363 | 364 | A particularly useful attribute is `special_update`. PIKUD HA-OREF sometimes sends specific informational updates (like "Alert will trigger soon") which the script flags by setting this attribute to `true`. You can create binary sensors that turn `on` specifically when the `special_update` attribute becomes `true` on the main or city sensor: 365 | 366 | ### Lovelace Card Example 367 | 368 | You can add the entities to your dashboard using various cards. Here's a simple example using a Vertical Stack card: 369 | 370 | ![red-alerts-sensors](https://github.com/idodov/RedAlert/assets/19820046/e0e779fc-ed92-4f4e-8e36-4116324cd089) 371 |
372 | Lovelace Card YAML 373 | 374 | ```yaml 375 | type: vertical-stack 376 | cards: 377 | - type: tile 378 | entity: input_text.red_alert # Displays the main alert summary text 379 | vertical: true 380 | state_content: state # Or set to 'last-changed', 'last-updated', etc. 381 | 382 | - type: entities 383 | entities: 384 | - entity: binary_sensor.red_alert # Main sensor (any alert) 385 | state_color: true # Optional: Color icon based on state 386 | - entity: binary_sensor.red_alert_city # City-specific sensor 387 | state_color: true # Optional: Color icon based on state 388 | - entity: sensor.red_alert_history_cities # Example history sensor 389 | - entity: input_boolean.red_alert_test # Test trigger 390 | state_color: true # Applies state_color to entities unless overridden above 391 | ``` 392 |
393 | 394 | ### Map Visualization (GeoJSON) 395 | 396 | ![GeoJSON Map Example](https://github.com/user-attachments/assets/6834a827-0186-4b60-921c-f5918dc3bd1b) 397 | > [!NOTE] 398 | > If the GeoJSON integration fails to load, double-check your `allowlist_external_urls` and the exact URL you are using in the integration setup. Also verify that the files actually exist in the `/config/www` folder after an alert occurs (or after script initialization for the empty/default files). 399 | 400 |
401 | GeoJSON Setup Details 402 | 403 | If the `save_2_file` parameter is set to `True`, the script automatically generates two GeoJSON files in the Home Assistant `/config/www` directory. This directory is typically accessible via the Home Assistant frontend at the URL `/local/`. 404 | 405 | * **`YOUR_SENSOR_NAME_latest.geojson`**: Contains coordinate data for the unique cities included in the *currently active* alert window. This file is updated whenever a new payload arrives within an active window. 406 | * **`YOUR_SENSOR_NAME_24h.geojson`**: Contains coordinate data for *distinct alert events* that occurred within the last `hours_to_show` timeframe, based on the history sensor data. This file is updated every time the primary sensor state changes (on -> off, or off -> on) or when a new payload arrives during an active window. 407 | 408 | **To display these on the Home Assistant map:** 409 | 1. Ensure the `www` folder exists in your `/config` directory. 410 | 2. Ensure your `configuration.yaml` includes `allowlist_external_urls` correctly configured with the URL(s) you use to access your Home Assistant instance (as shown in the Installation steps). This allows the GeoJSON integration to fetch the files. 411 | 3. Install the GeoJSON integration in Home Assistant: Go to `Settings` > `Devices & Services` > `Add Integration`, search for "GeoJSON", and follow the prompts. 412 | 4. When prompted for the GeoJSON file URL, enter `http://YOUR_HOME_ASSISTANT_IP_OR_HOSTNAME:8123/local/YOUR_SENSOR_NAME_24h.geojson`. Replace `YOUR_HOME_ASSISTANT_IP_OR_HOSTNAME:8123` with your actual Home Assistant access address and port, and `YOUR_SENSOR_NAME` with your configured sensor base name. 413 | 5. Optionally, add a second GeoJSON integration entity pointing to `http://YOUR_HOME_ASSISTANT_IP_OR_HOSTNAME:8123/local/YOUR_SENSOR_NAME_latest.geojson` to visualize only the currently active alert locations separately. 414 | 6. After adding the integration entity/entities, you can click on the created GeoJSON entity (e.g., `geo_location.your_sensor_name_24h`). In the entity's settings, you can adjust the `Default maximum radius` (e.g., set it to 2000-3000 km to ensure all points in Israel are visible) and `Home Zone Behavior`. 415 | 416 | ![{28E29F42-3F7F-4625-859B-587381F81941}](https://github.com/user-attachments/assets/23f2f200-28a9-49c1-82c7-79a00343f23c) 417 | 418 |
419 | 420 | ### Home Assistant Events 421 | 422 | If the `event` parameter is set to `True` (default), the script fires a native Home Assistant event *each time a new alert payload is received* from the API. This is often the most responsive way to trigger automations, as it doesn't rely on polling sensor states. 423 | 424 | The event name is `YOUR_SENSOR_NAME_event`. You can see these events in Home Assistant's Developer Tools > Events section by subscribing to `YOUR_SENSOR_NAME_event`. 425 | 426 |
427 | Home Assistant Event Data Structure & Example Automation 428 | 429 | The data payload associated with the `YOUR_SENSOR_NAME_event` is a dictionary containing detailed information about the *specific alert payload* that triggered the event: 430 | 431 | | Key | Type | Description | Example Value | 432 | | :------------- | :------- | :-------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------ | 433 | | `id` | integer | Unique ID of the alert payload from the API. | `1234567890123456` | 434 | | `category` | integer | Category number of the alert (corresponds to type, 1-13). | `1` | 435 | | `title` | string | Title of the alert (e.g., "ירי רקטות וטילים"). | `"ירי רקטות וטילים"` | 436 | | `cities` | list | A list of the original city names affected by *this specific payload*. | `["אבירים", "פסוטה"]` | 437 | | `areas` | string | A comma-separated string of areas affected by *this specific payload*. | `"קו העימות"` | 438 | | `description` | string | The recommended action description (e.g., "היכנסו למרחב המוגן ושהו בו 10 דקות"). | `"היכנסו למרחב המוגן ושהו בו 10 דקות"` | 439 | | `timestamp` | string | ISO formatted timestamp when the event was processed by the script. | `"2024-07-25T10:30:00.123456"` | 440 | | `alerts_count` | integer | The sequence number of this alert *payload* within the current active alert window. This count resets when the main binary sensor goes `off`. | `1` (for the first in a window) or `3` | 441 | | `is_test` | boolean | `True` if this event was triggered by the test input_boolean, `False` for real alerts from the API. | `False` | 442 | 443 | **Example Automation Triggering on the Event:** 444 | 445 | You can set up an automation in Home Assistant that triggers whenever this event is fired: 446 | 447 | **Example event payload** 448 | ```json 449 | { 450 | "id": 1234567890123456, 451 | "category": 1, 452 | "title": "ירי רקטות וטילים", 453 | "cities": ["אבירים", "פסוטה"], 454 | "areas": "עוטף עזה", 455 | "description": "היכנסו למרחב המוגן ושהו בו 10 דקות", 456 | "timestamp": "2024-07-25T10:30:00", 457 | "alerts_count": 2, 458 | "is_test": false 459 | } 460 | ``` 461 | 462 | **Example automation added to automations.yaml or configured via the UI** 463 | ```yaml 464 | automation: 465 | - alias: Respond to Red Alert Event 466 | # Trigger when the custom event is fired 467 | trigger: 468 | platform: event 469 | event_type: red_alert_event # Use your configured sensor_name_event name 470 | action: 471 | # Example Action: Send a notification with details from the event data 472 | - service: notify.your_notification_service # Replace with your actual notification service entity ID 473 | data: 474 | title: "🔴 Red Alert!" 475 | message: > 476 | {% set data = trigger.event.data %} 477 | {{ data.title }} in {{ data.cities | join(', ') }} 478 | [{{ as_timestamp(data.timestamp) | timestamp_custom('%H:%M:%S', true) }}] 479 | {{ data.description }} 480 | 481 | # Example Action: Play a TTS message 482 | # - service: tts.speak 483 | # data: 484 | # media_player_entity_id: media_player.your_speaker # Replace with your speaker 485 | # language: he-IL # Set language if needed 486 | # message: > 487 | # {% set data = trigger.event.data %} 488 | # התרעת {{ data.title }} ב{{ data.areas }}. {{ data.description }} 489 | 490 | # Add other actions like turning on lights, etc. 491 | ``` 492 |
493 | 494 | ### MQTT Events 495 | 496 | If the `mqtt` parameter is set to `True` (or a custom topic string), the script publishes a JSON message to an MQTT topic *each time a new alert payload is received* from the API. This is useful for integrating with other systems or dashboards that consume MQTT messages. 497 | 498 | The default MQTT topic is `home/YOUR_SENSOR_NAME/event`. If you set `mqtt` to a string (e.g., `"my/alerts/topic"`), that string will be used as the topic. 499 | 500 |
501 | MQTT Payload Structure & Example Automation 502 | 503 | The payload published to the MQTT topic is a JSON string containing details about the *specific alert payload* that was received. 504 | 505 | **Example Payload (JSON string) - Note: This structure matches the specific example provided in the request:** 506 | 507 | ```json 508 | { 509 | "id": 1234567890123456, 510 | "category": 1, 511 | "title": "ירי רקטות וטילים", 512 | "data": ["אבירים", "פסוטה"], 513 | "desc": "היכנסו למרחב המוגן ושהו בו 10 דקות", 514 | "alertDate": "2024-07-25 10:30:00", 515 | } 516 | ``` 517 | 518 | #### Using the MQTT Event in Home Assistant Automations 519 | 520 | To trigger Home Assistant automations based on these MQTT messages, configure an MQTT trigger subscribing to the topic the script publishes to (`home/YOUR_SENSOR_NAME/event` by default, or your custom topic). 521 | 522 | Ensure the MQTT integration is configured in Home Assistant. 523 | 524 | ```yaml 525 | # Example automation added to automations.yaml or configured via the UI 526 | automation: 527 | - alias: Respond to MQTT Alert 528 | # Trigger when a message arrives on the specified MQTT topic 529 | trigger: 530 | platform: mqtt 531 | topic: "home/red_alert/event" # Match the script's publish topic (replace red_alert if needed) 532 | action: 533 | # Example Action: Send a notification using data from the JSON payload 534 | - service: notify.your_notification_service # Replace with your actual notification service entity ID 535 | data: 536 | title: "🚨 MQTT Alert!" 537 | # Access payload data using trigger.payload_json. 538 | # Note: Access keys match the JSON payload structure above (data, desc, alertDate) 539 | message: > 540 | {% set data = trigger.payload_json %} 541 | {{ data.title }} in {{ data.data | join(', ') }} 542 | [{{ as_timestamp(data.alertDate) | timestamp_custom('%H:%M:%S', true) }}] 543 | {{ data.desc }} 544 | 545 | # Add other actions like playing TTS, etc. 546 | ``` 547 | This setup allows you to leverage the detailed JSON payload sent over MQTT directly within your Home Assistant automations, providing flexibility for advanced logic or integrating with other systems. 548 | 549 |
550 | 551 | ### History & Backup Files 552 | 553 |
554 | History and Backup File Details 555 | 556 | If `save_2_file` is enabled, the script manages several files in the Home Assistant `/config/www` directory. This allows you to access historical alert data and maintain the last known alert state across AppDaemon restarts. The `/config/www` directory is typically mapped to `http://YOUR_HA_IP:8123/local/` in Home Assistant. 557 | 558 | 1. **`YOUR_SENSOR_NAME_history.txt`**: This file is appended with a summary of each *completed* alert window (when the main sensor state transitions back to `off`). The summary includes the date, time, alert type, areas, and cities. 559 | 2. **`YOUR_SENSOR_NAME_history.csv`**: This file is appended with structured data for each *completed* alert window. It includes columns for ID, Day, Date, Time, Title, City Count, Areas, Cities (string), Description, and Number of Payloads in the window. This format is suitable for importing into spreadsheet software for analysis. The CSV header is automatically created if the file doesn't exist or is empty on startup. 560 | 3. **`YOUR_SENSOR_NAME_history.json`**: This file is a simple backup of the *last received alert payload's core data*. It is saved to help the script restore the `prev_*` attributes of the sensors after AppDaemon restarts, providing some state persistence. It does **not** store the full history list. 561 | 4. **`YOUR_SENSOR_NAME_latest.geojson`**: (See Map section) Stores GeoJSON point data for the cities in the *currently active* alert window. 562 | 5. **`YOUR_SENSOR_NAME_24h.geojson`**: (See Map section) Stores GeoJSON point data for distinct alert *events* within the history window (`hours_to_show`). 563 | 564 | The TXT and CSV history files summarize incidents *after* the main sensor resets to `off` (i.e., after the `timer` duration has passed and no new alerts were detected). The JSON backup is primarily for restoring the `prev_*` attributes on startup. 565 | 566 | You can access these files directly via your browser using URLs like `http://YOUR_HOME_ASSISTANT_IP:8123/local/YOUR_SENSOR_NAME_history.txt`. 567 |
568 | 569 | --- 570 | 571 | ## Script Status 572 | ![image](https://github.com/user-attachments/assets/7ec3d3ee-7bdf-4846-84a3-e5f49b83de6e) 573 | 574 |
575 | Markdown Card YAML 576 | 577 | ```yaml 578 | # Replace 'red_alert' with your configured sensor_name if different. 579 | type: markdown 580 | content: | 581 | {% set status = state_attr('binary_sensor.red_alert', 'script_status') %} {# Adjust if needd #} 582 | {% if status == 'running' or status == 'idle' %} 583 | Script status: {{ status }} 584 | {% elif status == 'initializing' %} 585 | Script status: {{ status }} 586 | {% else %} 587 | Script status: {{ status }} (Check appdaemon log) 588 | {% endif %} 589 | ``` 590 |
591 | 592 | ## History Markdown Example 593 | 594 | This example provides YAML code for a Home Assistant Markdown card that displays recent alert history grouped by alert type and area, leveraging the data available in the `sensor.YOUR_SENSOR_NAME_history_group` sensor's attributes. 595 | 596 | ![History Markdown Card Example](https://github.com/user-attachments/assets/60e6b1d5-bfca-421c-8f5e-840ca95bc917) 597 | 598 |
599 | Markdown Card YAML 600 | 601 | ```yaml 602 | # Replace 'red_alert' with your configured sensor_name if different. 603 | type: markdown 604 | content: | 605 | {% set show_history = True %} 606 | {% set show_info = True %} 607 | {% set alerts = state_attr('sensor.red_alert_history_group', 'last_24h_alerts_group') %} 608 | {% set oref = states('binary_sensor.red_alert') %} 609 | 610 | 614 | 620 |
611 | {% if oref == 'on' %} 612 | # {{ state_attr('binary_sensor.red_alert', 'title') }} {{ state_attr('binary_sensor.red_alert', 'emoji') }} 613 |
615 | {{ state_attr('binary_sensor.red_alert', 'alert_txt') }} 616 | {% else %} 617 | ## אין התרעות ✅ 618 | {% endif %} 619 |
621 | {% set current_date = now().date() %} 622 | {# Check if prev_last_changed attribute exists and is in expected ISO format before parsing #} 623 | {% if state_attr('binary_sensor.red_alert', 'prev_last_changed') is string and state_attr('binary_sensor.red_alert', 'prev_last_changed') | regex_match("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?([+-]\\d{2}:\\d{2}|Z)?$") %} 624 | {% set last_changed_str = state_attr('binary_sensor.red_alert', 'prev_last_changed') %} 625 | {# Attempt parsing with fromisoformat, fallback to as_timestamp if needed or problematic #} 626 | {% set last_changed_dt = last_changed_str | as_datetime(with_tz=True) | default(last_changed_str | as_datetime) | default(None) %} 627 | 628 | {% if last_changed_dt %} 629 | {# Ensure datetime is naive for date comparison if needed, or use UTC #} 630 | {% set last_changed_dt_naive = last_changed_dt | as_local %} # Convert to local time for display/comparison 631 | 632 |
התרעה אחרונה נשלחה 633 | {% set time_difference = (now() - last_changed_dt_naive).total_seconds() %} 634 | 635 | {% if time_difference < 60 %} 636 | לפני פחות מדקה 637 | {% elif time_difference < 3600 %} 638 | לפני {{ (time_difference / 60) | int }} דקות 639 | {% elif time_difference < 86400 and last_changed_dt_naive.date() == now().date() %} 640 | היום בשעה {{ last_changed_dt_naive | timestamp_custom('%H:%M', true) }} 641 | {% else %} 642 | בתאריך {{ last_changed_dt_naive | timestamp_custom('%d/%m/%Y', true) }}, בשעה {{ last_changed_dt_naive | timestamp_custom('%H:%M', true) }} 643 | {% endif %} 644 |
645 | {# else %} {# Optional: Log if parsing failed #} 646 | {#
שגיאה בעיבוד זמן התרעה אחרונה
#} 647 | {% endif %} 648 | {% endif %} 649 | 650 |
651 | {% if alerts and show_history %} 652 | {% if show_info %} 653 | 654 | 656 | 658 | 659 |
655 | {{ state_attr('sensor.red_alert_history_cities', 'cities_past_24h') | length }} :ערים 657 | {{ state_attr('sensor.red_alert_history_list', 'last_24h_alerts') | length }} :התרעות

660 | {% endif %} 661 | 662 | {% for alert_type, areas in alerts.items() %} 663 | {# Adjusted colspan for 3 columns #} 664 | {% for area, cities in areas.items() %} 665 | {# Adjusted colspan #} 666 | {% set unique_cities = [] %} 667 | {% for city_pair in cities|batch(2) %} {# Iterating in batches of 2 for side-by-side display #} 668 | 669 | 675 | 676 | {# Use city_pair[0].time #} 677 | 678 | {# Removed logic for second city in batch as layout is now single column per row for cities/times #} 679 | {% endfor %} 680 | {% endfor %} 681 | {% endfor %} 682 |

{{ alert_type }}


{{ area }}
{% if city_pair[0].time[:10] == (now() - timedelta(days=1)).strftime('%Y-%m-%d') %} 670 | {{ city_pair[0].city }} {# Use city_pair[0].city #} 671 | {% else %} 672 | {{ city_pair[0].city }} {# Use city_pair[0].city #} 673 | {% endif %} 674 | - {{ city_pair[0].time[:5] }}
683 | {% endif %} 684 | ``` 685 | 686 |
687 | -------------------------------------------------------------------------------- /cities_name.md: -------------------------------------------------------------------------------- 1 | In the `appdaemon/apps/apps.yaml` file - add the following code. 2 | 3 | **Make sure to replace the `city_names` values as PIKUD HA-OREF defines them. For example don’t write `תל אביב` - instead write: `תל אביב - מרכז העיר`.** 4 | ```yaml 5 | #/appdaemon/apps/apps.yaml 6 | red_alerts_israel: 7 | module: red_alerts_israel 8 | class: Red_Alerts_Israel 9 | interval: 2 10 | timer: 120 11 | sensor_name: "red_alert" 12 | save_2_file: True 13 | city_names: 14 | - תל אביב - מרכז העיר 15 | - כיסופים 16 | - אשדוד א,ב,ד,ה 17 | - נתיב הל''ה 18 | ``` 19 | # List of Cities 20 | `אבו גוש` ★ 21 | `אבו נוור` ★ 22 | `אבו סנאן` ★ 23 | `אבו קרינאת` ★ 24 | `אבו תלול` ★ 25 | `אבטליון` ★ 26 | `אביאל` ★ 27 | `אביבים` ★ 28 | `אביגדור` ★ 29 | `אביחיל` ★ 30 | `אביעזר` ★ 31 | `אבירים` ★ 32 | `אבן יהודה` ★ 33 | `אבן מנחם` ★ 34 | `אבן ספיר` ★ 35 | `אבן שמואל` ★ 36 | `אבני איתן` ★ 37 | `אבני חפץ` ★ 38 | `אבנת` ★ 39 | `אבשלום` ★ 40 | `אדורה` ★ 41 | `אדוריים` ★ 42 | `אדמית` ★ 43 | `אדרת` ★ 44 | `אודים` ★ 45 | `אודם` ★ 46 | `אום אל פחם` ★ 47 | `אום אל קוטוף` ★ 48 | `אום אלג'נם` ★ 49 | `אום בטין` ★ 50 | `אופקים` ★ 51 | `אור הגנוז` ★ 52 | `אור הנר` ★ 53 | `אור יהודה` ★ 54 | `אור עקיבא` ★ 55 | `אורה` ★ 56 | `אורון תעשייה ומסחר` ★ 57 | `אורות` ★ 58 | `אורטל` ★ 59 | `אורים` ★ 60 | `אורנים` ★ 61 | `אורנית` ★ 62 | `אושה` ★ 63 | `אזור` ★ 64 | `אזור תעשייה אלון התבור` ★ 65 | `אזור תעשייה אפק ולב הארץ` ★ 66 | `אזור תעשייה אריאל` ★ 67 | `אזור תעשייה באר טוביה` ★ 68 | `אזור תעשייה בני יהודה` ★ 69 | `אזור תעשייה בר-לב` ★ 70 | `אזור תעשייה בראון` ★ 71 | `אזור תעשייה ברוש` ★ 72 | `אזור תעשייה ברקן` ★ 73 | `אזור תעשייה גדרה` ★ 74 | `אזור תעשייה דימונה` ★ 75 | `אזור תעשייה הדרומי אשקלון` ★ 76 | `אזור תעשייה הר טוב - צרעה` ★ 77 | `אזור תעשייה חבל מודיעין` ★ 78 | `אזור תעשייה חצור הגלילית` ★ 79 | `אזור תעשייה טירה` ★ 80 | `אזור תעשייה טמרה` ★ 81 | `אזור תעשייה יקנעם עילית` ★ 82 | `אזור תעשייה כנות` ★ 83 | `אזור תעשייה כפר יונה` ★ 84 | `אזור תעשייה כרמיאל` ★ 85 | `אזור תעשייה מבוא כרמל` ★ 86 | `אזור תעשייה מבואות הגלבוע` ★ 87 | `אזור תעשייה מילואות צפון` ★ 88 | `אזור תעשייה מישור אדומים` ★ 89 | `אזור תעשייה מיתרים` ★ 90 | `אזור תעשייה נ.ע.מ` ★ 91 | `אזור תעשייה ניר עציון` ★ 92 | `אזור תעשייה נשר - רמלה` ★ 93 | `אזור תעשייה עד הלום` ★ 94 | `אזור תעשייה עידן הנגב` ★ 95 | `אזור תעשייה עמק חפר` ★ 96 | `אזור תעשייה צ.ח.ר` ★ 97 | `אזור תעשייה צבאים` ★ 98 | `אזור תעשייה ציפורית` ★ 99 | `אזור תעשייה צפוני אשקלון` ★ 100 | `אזור תעשייה קדמת גליל` ★ 101 | `אזור תעשייה קיסריה` ★ 102 | `אזור תעשייה קריית ביאליק` ★ 103 | `אזור תעשייה קריית גת` ★ 104 | `אזור תעשייה רבדים` ★ 105 | `אזור תעשייה רגבים` ★ 106 | `אזור תעשייה רגמ` ★ 107 | `אזור תעשייה רותם` ★ 108 | `אזור תעשייה רמת דלתון` ★ 109 | `אזור תעשייה שחורת` ★ 110 | `אזור תעשייה שחק` ★ 111 | `אזור תעשייה שער בנימין` ★ 112 | `אזור תעשייה שער נעמן` ★ 113 | `אזור תעשייה תימורים` ★ 114 | `אזור תעשייה תרדיון` ★ 115 | `אחווה` ★ 116 | `אחוזם` ★ 117 | `אחוזת ברק` ★ 118 | `אחיה` ★ 119 | `אחיהוד` ★ 120 | `אחיטוב` ★ 121 | `אחיסמך` ★ 122 | `אחיעזר` ★ 123 | `איבטין` ★ 124 | `אייל` ★ 125 | `איילת השחר` ★ 126 | `איירפורט סיטי` ★ 127 | `אילון` ★ 128 | `אילות` ★ 129 | `אילניה` ★ 130 | `אילת` ★ 131 | `אירוס` ★ 132 | `איתמר` ★ 133 | `איתן` ★ 134 | `אכסאל` ★ 135 | `אל סייד` ★ 136 | `אל עזי` ★ 137 | `אל עמארני, אל מסק` ★ 138 | `אל עריאן` ★ 139 | `אל פורעה` ★ 140 | `אל רום` ★ 141 | `אל-ח'וואלד מערב` ★ 142 | `אלומה` ★ 143 | `אלומות` ★ 144 | `אלון` ★ 145 | `אלון הגליל` ★ 146 | `אלון מורה` ★ 147 | `אלון שבות` ★ 148 | `אלוני אבא` ★ 149 | `אלוני הבשן` ★ 150 | `אלוני יצחק` ★ 151 | `אלונים` ★ 152 | `אלי עד` ★ 153 | `אליאב` ★ 154 | `אליכין` ★ 155 | `אליפז ומכרות תמנע` ★ 156 | `אליפלט` ★ 157 | `אליקים` ★ 158 | `אלישיב` ★ 159 | `אלישמע` ★ 160 | `אלמגור` ★ 161 | `אלמוג` ★ 162 | `אלעד` ★ 163 | `אלעזר` ★ 164 | `אלפי מנשה` ★ 165 | `אלקוש` ★ 166 | `אלקנה` ★ 167 | `אמונים` ★ 168 | `אמירים` ★ 169 | `אמנון` ★ 170 | `אמץ` ★ 171 | `אמציה` ★ 172 | `אניעם` ★ 173 | `אעבלין` ★ 174 | `אפיק` ★ 175 | `אפיקים` ★ 176 | `אפק` ★ 177 | `אפרת` ★ 178 | `ארבל` ★ 179 | `ארגמן` ★ 180 | `ארז` ★ 181 | `אריאל` ★ 182 | `ארסוף` ★ 183 | `אשבול` ★ 184 | `אשבל` ★ 185 | `אשדוד - א,ב,ד,ה` ★ 186 | `אשדוד - איזור תעשייה צפוני` ★ 187 | `אשדוד - ג,ו,ז` ★ 188 | `אשדוד - ח,ט,י,יג,יד,טז` ★ 189 | `אשדוד -יא,יב,טו,יז,מרינה,סיטי` ★ 190 | `אשדות יעקב` ★ 191 | `אשחר` ★ 192 | `אשכולות` ★ 193 | `אשל הנשיא` ★ 194 | `אשלים` ★ 195 | `אשקלון - דרום` ★ 196 | `אשקלון - צפון` ★ 197 | `אשרת` ★ 198 | `אשתאול` ★ 199 | `אתר דודאים` ★ 200 | `אתר ההנצחה גולני` ★ 201 | `באקה אל גרבייה` ★ 202 | `באר אורה` ★ 203 | `באר גנים` ★ 204 | `באר טוביה` ★ 205 | `באר יעקב` ★ 206 | `באר מילכה` ★ 207 | `באר שבע - דרום` ★ 208 | `באר שבע - מזרח` ★ 209 | `באר שבע - מערב` ★ 210 | `באר שבע - צפון` ★ 211 | `בארות יצחק` ★ 212 | `בארותיים` ★ 213 | `בארי` ★ 214 | `בוסתן הגליל` ★ 215 | `בועיינה-נוג'ידאת` ★ 216 | `בוקעתא` ★ 217 | `בורגתה` ★ 218 | `בחן` ★ 219 | `בטחה` ★ 220 | `ביצרון` ★ 221 | `ביר אלמכסור` ★ 222 | `ביר הדאג'` ★ 223 | `ביריה` ★ 224 | `בית אורן` ★ 225 | `בית אל` ★ 226 | `בית אלעזרי` ★ 227 | `בית אלפא וחפציבה` ★ 228 | `בית אריה` ★ 229 | `בית ברל` ★ 230 | `בית ג'אן` ★ 231 | `בית גוברין` ★ 232 | `בית גמליאל` ★ 233 | `בית דגן` ★ 234 | `בית הגדי` ★ 235 | `בית הלוי` ★ 236 | `בית הלל` ★ 237 | `בית העלמין החדש נהריה` ★ 238 | `בית העלמין החדש עכו` ★ 239 | `בית העמק` ★ 240 | `בית הערבה` ★ 241 | `בית השיטה` ★ 242 | `בית זית` ★ 243 | `בית זרע` ★ 244 | `בית חג"י` ★ 245 | `בית חורון` ★ 246 | `בית חזון` ★ 247 | `בית חלקיה` ★ 248 | `בית חנן` ★ 249 | `בית חנניה` ★ 250 | `בית חרות` ★ 251 | `בית חשמונאי` ★ 252 | `בית יהושע` ★ 253 | `בית יוסף` ★ 254 | `בית ינאי` ★ 255 | `בית יצחק - שער חפר` ★ 256 | `בית ירח` ★ 257 | `בית יתיר` ★ 258 | `בית לחם הגלילית` ★ 259 | `בית מאיר` ★ 260 | `בית נחמיה` ★ 261 | `בית ניר` ★ 262 | `בית נקופה` ★ 263 | `בית סוהר השרון` ★ 264 | `בית סוהר מגידו` ★ 265 | `בית סוהר נפחא` ★ 266 | `בית סוהר צלמון` ★ 267 | `בית סוהר קישון` ★ 268 | `בית סוהר שיטה וגלבוע` ★ 269 | `בית ספר אורט בנימינה` ★ 270 | `בית ספר שדה מירון` ★ 271 | `בית עובד` ★ 272 | `בית עוזיאל` ★ 273 | `בית עזרא` ★ 274 | `בית עלמין מורשה` ★ 275 | `בית עלמין תל רגב` ★ 276 | `בית עריף` ★ 277 | `בית צבי` ★ 278 | `בית קמה` ★ 279 | `בית קשת` ★ 280 | `בית רימון` ★ 281 | `בית שאן` ★ 282 | `בית שמש` ★ 283 | `בית שערים` ★ 284 | `בית שקמה` ★ 285 | `ביתן אהרן` ★ 286 | `ביתר עילית` ★ 287 | `בלפוריה` ★ 288 | `בן זכאי` ★ 289 | `בן עמי` ★ 290 | `בן שמן` ★ 291 | `בני ברק` ★ 292 | `בני דקלים` ★ 293 | `בני דרום` ★ 294 | `בני דרור` ★ 295 | `בני יהודה וגבעת יואב` ★ 296 | `בני נצרים` ★ 297 | `בני עטרות` ★ 298 | `בני עי''ש` ★ 299 | `בני ציון` ★ 300 | `בני ראם` ★ 301 | `בניה` ★ 302 | `בנימינה` ★ 303 | `בסמת טבעון` ★ 304 | `בענה` ★ 305 | `בצרה` ★ 306 | `בצת` ★ 307 | `בקוע` ★ 308 | `בקעות` ★ 309 | `בר גיורא` ★ 310 | `בר יוחאי` ★ 311 | `ברוכין` ★ 312 | `ברור חיל` ★ 313 | `ברוש` ★ 314 | `ברטעה` ★ 315 | `ברכיה` ★ 316 | `ברעם` ★ 317 | `ברקאי` ★ 318 | `ברקן` ★ 319 | `ברקת` ★ 320 | `בת הדר` ★ 321 | `בת חן` ★ 322 | `בת חפר` ★ 323 | `בת ים` ★ 324 | `בת עין` ★ 325 | `בת שלמה` ★ 326 | `בתי מלון ים המלח` ★ 327 | `ג'דידה מכר` ★ 328 | `ג'וליס` ★ 329 | `ג'לג'וליה` ★ 330 | `ג'סר א-זרקא` ★ 331 | `ג'ש - גוש חלב` ★ 332 | `ג'ת` ★ 333 | `גאולי תימן` ★ 334 | `גאולים` ★ 335 | `גאליה` ★ 336 | `גבולות` ★ 337 | `גבים, מכללת ספיר` ★ 338 | `גבע בנימין` ★ 339 | `גבע כרמל` ★ 340 | `גבעון החדשה` ★ 341 | `גבעות` ★ 342 | `גבעות בר` ★ 343 | `גבעות גורל` ★ 344 | `גבעות עדן` ★ 345 | `גבעת אבני` ★ 346 | `גבעת אלה` ★ 347 | `גבעת אסף` ★ 348 | `גבעת ברנר` ★ 349 | `גבעת הראל וגבעת הרואה` ★ 350 | `גבעת השלושה` ★ 351 | `גבעת וולפסון` ★ 352 | `גבעת וושינגטון` ★ 353 | `גבעת זאב` ★ 354 | `גבעת חביבה` ★ 355 | `גבעת חיים איחוד` ★ 356 | `גבעת חיים מאוחד` ★ 357 | `גבעת חן` ★ 358 | `גבעת יערים` ★ 359 | `גבעת ישעיהו` ★ 360 | `גבעת כ''ח` ★ 361 | `גבעת ניל''י` ★ 362 | `גבעת עדה` ★ 363 | `גבעת עוז` ★ 364 | `גבעת שמואל` ★ 365 | `גבעת שפירא` ★ 366 | `גבעתי` ★ 367 | `גבעתיים` ★ 368 | `גברעם` ★ 369 | `גבת` ★ 370 | `גדות` ★ 371 | `גדעונה` ★ 372 | `גדרה` ★ 373 | `גונן` ★ 374 | `גורן` ★ 375 | `גורנות הגליל` ★ 376 | `גזית` ★ 377 | `גזר` ★ 378 | `גיאה` ★ 379 | `גיבתון` ★ 380 | `גיזו` ★ 381 | `גילת` ★ 382 | `גינוסר` ★ 383 | `גינתון` ★ 384 | `גיתה` ★ 385 | `גיתית` ★ 386 | `גלאון` ★ 387 | `גלגל` ★ 388 | `גלעד` ★ 389 | `גמזו` ★ 390 | `גן הדרום` ★ 391 | `גן השומרון` ★ 392 | `גן חיים` ★ 393 | `גן יאשיה` ★ 394 | `גן יבנה` ★ 395 | `גן נר` ★ 396 | `גן שורק` ★ 397 | `גן שלמה` ★ 398 | `גן שמואל` ★ 399 | `גנות` ★ 400 | `גנות הדר` ★ 401 | `גני הדר` ★ 402 | `גני חוגה` ★ 403 | `גני טל` ★ 404 | `גני יוחנן` ★ 405 | `גני עם` ★ 406 | `גני תקווה` ★ 407 | `גניגר` ★ 408 | `געש` ★ 409 | `געתון` ★ 410 | `גפן` ★ 411 | `גרופית` ★ 412 | `גשור` ★ 413 | `גשר` ★ 414 | `גשר הזיו` ★ 415 | `גת` ★ 416 | `גת רימון` ★ 417 | `דבוריה` ★ 418 | `דביר` ★ 419 | `דברת` ★ 420 | `דגניה א` ★ 421 | `דגניה ב` ★ 422 | `דוב''ב` ★ 423 | `דולב` ★ 424 | `דור` ★ 425 | `דורות` ★ 426 | `דחי` ★ 427 | `דימונה` ★ 428 | `דיר אל-אסד` ★ 429 | `דיר חנא` ★ 430 | `דישון` ★ 431 | `דליה` ★ 432 | `דלית אל כרמל` ★ 433 | `דלתון` ★ 434 | `דמיידה` ★ 435 | `דניאל` ★ 436 | `דפנה` ★ 437 | `דקל` ★ 438 | `האון` ★ 439 | `הבונים` ★ 440 | `הגושרים` ★ 441 | `הדר עם` ★ 442 | `הוד השרון` ★ 443 | `הודיה` ★ 444 | `הודיות` ★ 445 | `הושעיה` ★ 446 | `הזורעים` ★ 447 | `החותרים` ★ 448 | `היוגב` ★ 449 | `היישוב היהודי חברון` ★ 450 | `הילה` ★ 451 | `המעפיל` ★ 452 | `המרכז האקדמי רופין` ★ 453 | `הסוללים` ★ 454 | `העוגן` ★ 455 | `הר אדר` ★ 456 | `הר ברכה` ★ 457 | `הר גילה` ★ 458 | `הר הנגב` ★ 459 | `הר חלוץ` ★ 460 | `הר עמשא` ★ 461 | `הראל` ★ 462 | `הרדוף` ★ 463 | `הרצליה - מערב` ★ 464 | `הרצליה - מרכז וגליל ים` ★ 465 | `הררית יחד` ★ 466 | `ואדי אל חמאם` ★ 467 | `ואדי אל נעם דרום` ★ 468 | `ורד יריחו` ★ 469 | `ורדון` ★ 470 | `זבדיאל` ★ 471 | `זוהר` ★ 472 | `זיקים` ★ 473 | `זיתן` ★ 474 | `זכרון יעקב` ★ 475 | `זכריה` ★ 476 | `זמר` ★ 477 | `זמרת, שובה` ★ 478 | `זנוח` ★ 479 | `זרועה` ★ 480 | `זרזיר` ★ 481 | `זרחיה` ★ 482 | `זרעית` ★ 483 | `ח'וואלד` ★ 484 | `חבצלת השרון וצוקי ים` ★ 485 | `חג'אג'רה` ★ 486 | `חגור` ★ 487 | `חגלה` ★ 488 | `חד נס` ★ 489 | `חדיד` ★ 490 | `חדרה - מזרח` ★ 491 | `חדרה - מערב` ★ 492 | `חדרה - מרכז` ★ 493 | `חדרה - נווה חיים` ★ 494 | `חוואלד` ★ 495 | `חוות אירוח גורן` ★ 496 | `חוות גלעד` ★ 497 | `חוות יאיר` ★ 498 | `חוות יזרעם` ★ 499 | `חוות עדן` ★ 500 | `חוות ערנדל` ★ 501 | `חוות שיקמים` ★ 502 | `חולדה` ★ 503 | `חולון` ★ 504 | `חולית` ★ 505 | `חולתה` ★ 506 | `חוסן` ★ 507 | `חוסנייה` ★ 508 | `חוף אמנון` ★ 509 | `חוף בצת` ★ 510 | `חוף גולן, צאלון` ★ 511 | `חוף גופרה` ★ 512 | `חוף זיקים` ★ 513 | `חוף כורסי, לבנון, חלוקים` ★ 514 | `חוף כינר, דוגה, דוגית` ★ 515 | `חוף ניצנים` ★ 516 | `חוף סוסיתא` ★ 517 | `חוף קליה` ★ 518 | `חופית` ★ 519 | `חוקוק` ★ 520 | `חורה` ★ 521 | `חורפיש` ★ 522 | `חורשים` ★ 523 | `חזון` ★ 524 | `חי-בר יטבתה` ★ 525 | `חיבת ציון` ★ 526 | `חיננית` ★ 527 | `חיפה - כרמל, הדר ועיר תחתית` ★ 528 | `חיפה - מערב` ★ 529 | `חיפה - מפרץ` ★ 530 | `חיפה - נווה שאנן ורמות כרמל` ★ 531 | `חיפה - קריית חיים ושמואל` ★ 532 | `חירן` ★ 533 | `חלמיש` ★ 534 | `חלץ` ★ 535 | `חמד` ★ 536 | `חמדיה` ★ 537 | `חמדת` ★ 538 | `חמרה` ★ 539 | `חמת גדר` ★ 540 | `חניאל` ★ 541 | `חניון הנתיב מהיר` ★ 542 | `חניתה` ★ 543 | `חנתון` ★ 544 | `חספין` ★ 545 | `חפץ חיים` ★ 546 | `חצב` ★ 547 | `חצבה` ★ 548 | `חצור` ★ 549 | `חצור הגלילית` ★ 550 | `חצרים` ★ 551 | `חרב לאת` ★ 552 | `חרוצים` ★ 553 | `חרות` ★ 554 | `חריש` ★ 555 | `חרמש` ★ 556 | `חרשה` ★ 557 | `חרשים` ★ 558 | `חשמונאים` ★ 559 | `טבחה` ★ 560 | `טבריה` ★ 561 | `טובא זנגריה` ★ 562 | `טורעאן` ★ 563 | `טייבה` ★ 564 | `טייבה בגלבוע` ★ 565 | `טירה` ★ 566 | `טירת יהודה` ★ 567 | `טירת כרמל` ★ 568 | `טירת צבי` ★ 569 | `טל - אל` ★ 570 | `טל מנשה` ★ 571 | `טל שחר` ★ 572 | `טללים` ★ 573 | `טלמון` ★ 574 | `טמרה` ★ 575 | `טמרה בגלבוע` ★ 576 | `טנא עומרים` ★ 577 | `טפחות` ★ 578 | `יבול` ★ 579 | `יבנאל` ★ 580 | `יבנה` ★ 581 | `יגור` ★ 582 | `יגל` ★ 583 | `יד בנימין` ★ 584 | `יד השמונה` ★ 585 | `יד חנה` ★ 586 | `יד מרדכי` ★ 587 | `יד נתן` ★ 588 | `יד רמב''ם` ★ 589 | `יהוד מונוסון` ★ 590 | `יהל` ★ 591 | `יובלים` ★ 592 | `יודפת` ★ 593 | `יונתן` ★ 594 | `יושיביה` ★ 595 | `יזרעאל` ★ 596 | `יחיעם` ★ 597 | `יטבתה` ★ 598 | `ייט''ב` ★ 599 | `יכיני` ★ 600 | `ינוב` ★ 601 | `ינוח ג'ת` ★ 602 | `ינון` ★ 603 | `יסוד המעלה` ★ 604 | `יסודות` ★ 605 | `יסעור` ★ 606 | `יעד` ★ 607 | `יעף` ★ 608 | `יערה` ★ 609 | `יערות הכרמל` ★ 610 | `יפיע` ★ 611 | `יפית` ★ 612 | `יפעת` ★ 613 | `יפתח` ★ 614 | `יצהר` ★ 615 | `יציץ` ★ 616 | `יקום` ★ 617 | `יקיר` ★ 618 | `יקנעם המושבה והזורע` ★ 619 | `יקנעם עילית` ★ 620 | `יראון` ★ 621 | `ירדנה` ★ 622 | `ירוחם` ★ 623 | `ירושלים - אזור תעשייה עטרות` ★ 624 | `ירושלים - דרום` ★ 625 | `ירושלים - כפר עקב` ★ 626 | `ירושלים - מזרח` ★ 627 | `ירושלים - מערב` ★ 628 | `ירושלים - מרכז` ★ 629 | `ירושלים - צפון` ★ 630 | `ירחיב` ★ 631 | `ירכא` ★ 632 | `ירקונה` ★ 633 | `ישובי אומן` ★ 634 | `ישובי יעל` ★ 635 | `ישעי` ★ 636 | `ישרש` ★ 637 | `יתד` ★ 638 | `כאבול` ★ 639 | `כאוכב אבו אלהיג'א` ★ 640 | `כברי` ★ 641 | `כדורי` ★ 642 | `כוכב השחר` ★ 643 | `כוכב יאיר - צור יגאל` ★ 644 | `כוכב יעקב` ★ 645 | `כוכב מיכאל` ★ 646 | `כורזים ורד הגליל` ★ 647 | `כושי רמון` ★ 648 | `כחל` ★ 649 | `כינרת מושבה` ★ 650 | `כינרת קבוצה` ★ 651 | `כיסופים` ★ 652 | `כישור` ★ 653 | `כל הארץ` ★ 654 | `כלא דמון` ★ 655 | `כליל` ★ 656 | `כלנית` ★ 657 | `כמהין` ★ 658 | `כמון` ★ 659 | `כנות` ★ 660 | `כנף` ★ 661 | `כסייפה` ★ 662 | `כסלון` ★ 663 | `כסרא סמיע` ★ 664 | `כעביה` ★ 665 | `כעביה טבאש` ★ 666 | `כפר אביב` ★ 667 | `כפר אדומים` ★ 668 | `כפר אוריה` ★ 669 | `כפר אחים` ★ 670 | `כפר אלדד` ★ 671 | `כפר ביאליק` ★ 672 | `כפר ביל''ו` ★ 673 | `כפר בלום` ★ 674 | `כפר בן נון` ★ 675 | `כפר ברא` ★ 676 | `כפר ברוך` ★ 677 | `כפר גדעון` ★ 678 | `כפר גלים` ★ 679 | `כפר גליקסון` ★ 680 | `כפר גלעדי` ★ 681 | `כפר גמילה מלכישוע` ★ 682 | `כפר דניאל` ★ 683 | `כפר האורנים` ★ 684 | `כפר החורש` ★ 685 | `כפר המכבי` ★ 686 | `כפר הנגיד` ★ 687 | `כפר הנוער ימין אורד` ★ 688 | `כפר הנוער קריית יערים` ★ 689 | `כפר הנוקדים` ★ 690 | `כפר הנשיא` ★ 691 | `כפר הס` ★ 692 | `כפר הרא''ה` ★ 693 | `כפר הרי''ף וצומת ראם` ★ 694 | `כפר ויתקין` ★ 695 | `כפר ורבורג` ★ 696 | `כפר ורדים` ★ 697 | `כפר זוהרים` ★ 698 | `כפר זיתים` ★ 699 | `כפר חב''ד` ★ 700 | `כפר חיטים` ★ 701 | `כפר חיים` ★ 702 | `כפר חנניה` ★ 703 | `כפר חסידים` ★ 704 | `כפר חרוב` ★ 705 | `כפר טבאש` ★ 706 | `כפר טרומן` ★ 707 | `כפר יאסיף` ★ 708 | `כפר ידידיה` ★ 709 | `כפר יהושע` ★ 710 | `כפר יובל` ★ 711 | `כפר יונה` ★ 712 | `כפר יחזקאל` ★ 713 | `כפר יעבץ` ★ 714 | `כפר כמא` ★ 715 | `כפר כנא` ★ 716 | `כפר מונש` ★ 717 | `כפר מימון ותושיה` ★ 718 | `כפר מל''ל` ★ 719 | `כפר מנדא` ★ 720 | `כפר מנחם` ★ 721 | `כפר מסריק` ★ 722 | `כפר מצר` ★ 723 | `כפר מרדכי` ★ 724 | `כפר נהר הירדן` ★ 725 | `כפר נוער בן שמן` ★ 726 | `כפר נחום` ★ 727 | `כפר נטר` ★ 728 | `כפר סאלד` ★ 729 | `כפר סבא` ★ 730 | `כפר סילבר` ★ 731 | `כפר סירקין` ★ 732 | `כפר עבודה` ★ 733 | `כפר עזה` ★ 734 | `כפר עציון` ★ 735 | `כפר פינס` ★ 736 | `כפר קאסם` ★ 737 | `כפר קיש` ★ 738 | `כפר קרע` ★ 739 | `כפר רופין` ★ 740 | `כפר רות` ★ 741 | `כפר שמאי` ★ 742 | `כפר שמואל` ★ 743 | `כפר שמריהו` ★ 744 | `כפר תבור` ★ 745 | `כפר תפוח` ★ 746 | `כפר תקווה` ★ 747 | `כרכום` ★ 748 | `כרם ביבנה` ★ 749 | `כרם בן זמרה` ★ 750 | `כרם מהר''ל` ★ 751 | `כרם רעים` ★ 752 | `כרם שלום` ★ 753 | `כרמי יוסף` ★ 754 | `כרמי צור` ★ 755 | `כרמי קטיף` ★ 756 | `כרמיאל` ★ 757 | `כרמיה` ★ 758 | `כרמים` ★ 759 | `כרמית` ★ 760 | `כרמל` ★ 761 | `לב החולה` ★ 762 | `לבון` ★ 763 | `לביא` ★ 764 | `לבנים` ★ 765 | `להב` ★ 766 | `להבות הבשן` ★ 767 | `להבות חביבה` ★ 768 | `להבים` ★ 769 | `לוד` ★ 770 | `לוזית` ★ 771 | `לוחמי הגטאות` ★ 772 | `לוטם וחמדון` ★ 773 | `לוטן` ★ 774 | `לטרון` ★ 775 | `לימן` ★ 776 | `לכיש` ★ 777 | `לפיד` ★ 778 | `לפידות` ★ 779 | `לקיה` ★ 780 | `מאור` ★ 781 | `מאיר שפיה` ★ 782 | `מבוא ביתר` ★ 783 | `מבוא דותן` ★ 784 | `מבוא חורון` ★ 785 | `מבוא חמה` ★ 786 | `מבוא מודיעים` ★ 787 | `מבואות יריחו` ★ 788 | `מבועים` ★ 789 | `מבטחים, עמיעוז, ישע` ★ 790 | `מבקיעים` ★ 791 | `מבשרת ציון` ★ 792 | `מג'דל כרום` ★ 793 | `מג'דל שמס` ★ 794 | `מגדים` ★ 795 | `מגדל` ★ 796 | `מגדל העמק` ★ 797 | `מגדל עוז` ★ 798 | `מגדל תפן` ★ 799 | `מגדלים` ★ 800 | `מגל` ★ 801 | `מגן` ★ 802 | `מגן שאול` ★ 803 | `מגרון` ★ 804 | `מגשימים` ★ 805 | `מדרך עוז` ★ 806 | `מדרשת בן גוריון` ★ 807 | `מודיעין - ישפרו סנטר` ★ 808 | `מודיעין - ליגד סנטר` ★ 809 | `מודיעין מכבים רעות` ★ 810 | `מודיעין עילית` ★ 811 | `מולדת` ★ 812 | `מועאוויה` ★ 813 | `מוצא עילית` ★ 814 | `מוקיבלה` ★ 815 | `מורן` ★ 816 | `מורשת` ★ 817 | `מזור` ★ 818 | `מזכרת בתיה` ★ 819 | `מזרע` ★ 820 | `מזרעה` ★ 821 | `מחולה` ★ 822 | `מחניים` ★ 823 | `מחסיה` ★ 824 | `מטווח ניר עם` ★ 825 | `מטולה` ★ 826 | `מטע` ★ 827 | `מי עמי` ★ 828 | `מייסר` ★ 829 | `מיצד` ★ 830 | `מיצר` ★ 831 | `מירב` ★ 832 | `מירון` ★ 833 | `מישר` ★ 834 | `מיתר` ★ 835 | `מכון וינגייט` ★ 836 | `מכורה` ★ 837 | `מכמורת` ★ 838 | `מכמנים` ★ 839 | `מלון אחוזת ירדן` ★ 840 | `מלונות ים המלח מרכז` ★ 841 | `מלכיה` ★ 842 | `ממשית` ★ 843 | `מנוחה` ★ 844 | `מנוף` ★ 845 | `מנות` ★ 846 | `מנחמיה` ★ 847 | `מנחת מחניים` ★ 848 | `מנרה` ★ 849 | `מנשית זבדה` ★ 850 | `מסד` ★ 851 | `מסדה` ★ 852 | `מסילות` ★ 853 | `מסילת ציון` ★ 854 | `מסלול` ★ 855 | `מסעדה` ★ 856 | `מע'אר` ★ 857 | `מעברות` ★ 858 | `מעגלים, גבעולים, מלילות` ★ 859 | `מעגן` ★ 860 | `מעגן מיכאל` ★ 861 | `מעוז חיים` ★ 862 | `מעון` ★ 863 | `מעון צופיה` ★ 864 | `מעונה` ★ 865 | `מעיין ברוך` ★ 866 | `מעיין צבי` ★ 867 | `מעיליא` ★ 868 | `מעלה אדומים` ★ 869 | `מעלה אפרים` ★ 870 | `מעלה גלבוע` ★ 871 | `מעלה גמלא` ★ 872 | `מעלה החמישה` ★ 873 | `מעלה חבר` ★ 874 | `מעלה לבונה` ★ 875 | `מעלה מכמש` ★ 876 | `מעלה עירון` ★ 877 | `מעלה עמוס` ★ 878 | `מעלה צביה` ★ 879 | `מעלה רחבעם` ★ 880 | `מעלות תרשיחא` ★ 881 | `מענית` ★ 882 | `מעש` ★ 883 | `מפלסים` ★ 884 | `מפעל אגריגדה` ★ 885 | `מצדה` ★ 886 | `מצובה` ★ 887 | `מצוק עורבים` ★ 888 | `מצוקי דרגות` ★ 889 | `מצליח` ★ 890 | `מצפה` ★ 891 | `מצפה אבי''ב` ★ 892 | `מצפה אילן` ★ 893 | `מצפה יריחו` ★ 894 | `מצפה נטופה` ★ 895 | `מצפה רמון` ★ 896 | `מצפה שלם` ★ 897 | `מצר` ★ 898 | `מקווה ישראל` ★ 899 | `מרגליות` ★ 900 | `מרום גולן` ★ 901 | `מרחב עם` ★ 902 | `מרחביה מושב` ★ 903 | `מרחביה קיבוץ` ★ 904 | `מרחצאות עין גדי` ★ 905 | `מרכז אזורי דרום השרון` ★ 906 | `מרכז אזורי מבואות חרמון` ★ 907 | `מרכז אזורי מגילות` ★ 908 | `מרכז אזורי מרום גליל` ★ 909 | `מרכז אזורי משגב` ★ 910 | `מרכז חבר` ★ 911 | `מרכז ימי קיסריה` ★ 912 | `מרכז מיר''ב` ★ 913 | `מרכז שפירא` ★ 914 | `מרעית` ★ 915 | `משאבי שדה` ★ 916 | `משגב דב` ★ 917 | `משגב עם` ★ 918 | `משהד` ★ 919 | `משואה` ★ 920 | `משואות יצחק` ★ 921 | `משכיות` ★ 922 | `משמר איילון` ★ 923 | `משמר דוד` ★ 924 | `משמר הירדן` ★ 925 | `משמר הנגב` ★ 926 | `משמר העמק` ★ 927 | `משמר השבעה` ★ 928 | `משמר השרון` ★ 929 | `משמרות` ★ 930 | `משמרת` ★ 931 | `משען` ★ 932 | `מתחם "חנה וסע" שפיים` ★ 933 | `מתחם בני דרום` ★ 934 | `מתחם פי גלילות` ★ 935 | `מתחם צומת שוקת` ★ 936 | `מתן` ★ 937 | `מתת` ★ 938 | `מתתיהו` ★ 939 | `נאות גולן` ★ 940 | `נאות הכיכר` ★ 941 | `נאות מרדכי` ★ 942 | `נאות סמדר` ★ 943 | `נאות קדומים` ★ 944 | `נאעורה` ★ 945 | `נבטים` ★ 946 | `נבי סמואל` ★ 947 | `נבי שועייב` ★ 948 | `נגבה` ★ 949 | `נגוהות` ★ 950 | `נהורה` ★ 951 | `נהלל` ★ 952 | `נהריה` ★ 953 | `נוב` ★ 954 | `נוגה` ★ 955 | `נוה איתן` ★ 956 | `נווה` ★ 957 | `נווה אור` ★ 958 | `נווה אטי''ב` ★ 959 | `נווה אילן` ★ 960 | `נווה דניאל` ★ 961 | `נווה זוהר` ★ 962 | `נווה זיו` ★ 963 | `נווה חריף` ★ 964 | `נווה ים` ★ 965 | `נווה ימין` ★ 966 | `נווה ירק` ★ 967 | `נווה מבטח` ★ 968 | `נווה מיכאל - רוגלית` ★ 969 | `נווה שלום` ★ 970 | `נועם` ★ 971 | `נוף איילון` ★ 972 | `נוף הגליל` ★ 973 | `נופי נחמיה` ★ 974 | `נופי פרת` ★ 975 | `נופים` ★ 976 | `נופית` ★ 977 | `נופך` ★ 978 | `נוקדים` ★ 979 | `נורדיה` ★ 980 | `נורית` ★ 981 | `נחושה` ★ 982 | `נחל עוז` ★ 983 | `נחלה` ★ 984 | `נחליאל` ★ 985 | `נחלים` ★ 986 | `נחם` ★ 987 | `נחף` ★ 988 | `נחשולים` ★ 989 | `נחשון` ★ 990 | `נחשונים` ★ 991 | `נטועה` ★ 992 | `נטור` ★ 993 | `נטע` ★ 994 | `נטעים` ★ 995 | `נטף` ★ 996 | `נילי` ★ 997 | `נין` ★ 998 | `ניצן` ★ 999 | `ניצנה` ★ 1000 | `ניצני עוז` ★ 1001 | `ניצנים` ★ 1002 | `ניר אליהו` ★ 1003 | `ניר בנים` ★ 1004 | `ניר גלים` ★ 1005 | `ניר דוד` ★ 1006 | `ניר ח''ן` ★ 1007 | `ניר יצחק` ★ 1008 | `ניר ישראל` ★ 1009 | `ניר משה` ★ 1010 | `ניר עוז` ★ 1011 | `ניר עם` ★ 1012 | `ניר עציון` ★ 1013 | `ניר עקיבא` ★ 1014 | `ניר צבי` ★ 1015 | `נירים` ★ 1016 | `נירית` ★ 1017 | `נמרוד` ★ 1018 | `נס הרים` ★ 1019 | `נס עמים` ★ 1020 | `נס ציונה` ★ 1021 | `נעורים` ★ 1022 | `נעלה` ★ 1023 | `נעמה` ★ 1024 | `נען` ★ 1025 | `נערן` ★ 1026 | `נצר חזני` ★ 1027 | `נצר סרני` ★ 1028 | `נצרת` ★ 1029 | `נריה` ★ 1030 | `נשר` ★ 1031 | `נתיב הגדוד` ★ 1032 | `נתיב הל''ה` ★ 1033 | `נתיב העשרה` ★ 1034 | `נתיב השיירה` ★ 1035 | `נתיבות` ★ 1036 | `נתניה - מזרח` ★ 1037 | `נתניה - מערב` ★ 1038 | `סאג'ור` ★ 1039 | `סאסא` ★ 1040 | `סביון` ★ 1041 | `סגולה` ★ 1042 | `סואעד חמירה` ★ 1043 | `סולם` ★ 1044 | `סוסיא` ★ 1045 | `סופה` ★ 1046 | `סינמה סיטי גלילות` ★ 1047 | `סכנין` ★ 1048 | `סלמה` ★ 1049 | `סלעית` ★ 1050 | `סמר` ★ 1051 | `סנדלה` ★ 1052 | `סנסנה` ★ 1053 | `סעד` ★ 1054 | `סעווה` ★ 1055 | `סער` ★ 1056 | `ספיר` ★ 1057 | `ספסופה - כפר חושן` ★ 1058 | `סתריה` ★ 1059 | `ע'ג'ר` ★ 1060 | `עבדון` ★ 1061 | `עבדת` ★ 1062 | `עברון` ★ 1063 | `עגור` ★ 1064 | `עדי` ★ 1065 | `עדי עד` ★ 1066 | `עדנים` ★ 1067 | `עוזה` ★ 1068 | `עוזייר` ★ 1069 | `עולש` ★ 1070 | `עומר` ★ 1071 | `עופר` ★ 1072 | `עופרים` ★ 1073 | `עוצם` ★ 1074 | `עזוז` ★ 1075 | `עזר` ★ 1076 | `עזריאל` ★ 1077 | `עזריה` ★ 1078 | `עזריקם` ★ 1079 | `עטרת` ★ 1080 | `עידן` ★ 1081 | `עיינות` ★ 1082 | `עילבון` ★ 1083 | `עילוט` ★ 1084 | `עין איילה` ★ 1085 | `עין אל אסד` ★ 1086 | `עין אל סהלה` ★ 1087 | `עין בוקק` ★ 1088 | `עין גב` ★ 1089 | `עין גדי` ★ 1090 | `עין דור` ★ 1091 | `עין הבשור` ★ 1092 | `עין הוד` ★ 1093 | `עין החורש` ★ 1094 | `עין המפרץ` ★ 1095 | `עין הנצי''ב` ★ 1096 | `עין העמק` ★ 1097 | `עין השופט` ★ 1098 | `עין השלושה` ★ 1099 | `עין ורד` ★ 1100 | `עין זיוון` ★ 1101 | `עין חוד` ★ 1102 | `עין חצבה` ★ 1103 | `עין חרוד` ★ 1104 | `עין יהב` ★ 1105 | `עין יעקב` ★ 1106 | `עין כמונים` ★ 1107 | `עין כרמל` ★ 1108 | `עין מאהל` ★ 1109 | `עין נקובא` ★ 1110 | `עין עירון` ★ 1111 | `עין צורים` ★ 1112 | `עין קנייא` ★ 1113 | `עין ראפה` ★ 1114 | `עין שמר` ★ 1115 | `עין שריד` ★ 1116 | `עין תמר` ★ 1117 | `עינבר` ★ 1118 | `עינת` ★ 1119 | `עיר אובות` ★ 1120 | `עכו` ★ 1121 | `עכו - אזור תעשייה` ★ 1122 | `עלומים` ★ 1123 | `עלי` ★ 1124 | `עלי זהב` ★ 1125 | `עלמה` ★ 1126 | `עלמון` ★ 1127 | `עמוקה` ★ 1128 | `עמיחי` ★ 1129 | `עמינדב` ★ 1130 | `עמיעד` ★ 1131 | `עמיקם` ★ 1132 | `עמיר` ★ 1133 | `עמנואל` ★ 1134 | `עמקה` ★ 1135 | `ענב` ★ 1136 | `עספיא` ★ 1137 | `עפולה` ★ 1138 | `עפרה` ★ 1139 | `עץ אפרים` ★ 1140 | `עצמון - שגב` ★ 1141 | `עראבה` ★ 1142 | `ערב אל נעים` ★ 1143 | `ערב אל עראמשה` ★ 1144 | `ערד` ★ 1145 | `ערוגות` ★ 1146 | `ערערה` ★ 1147 | `ערערה בנגב` ★ 1148 | `עשהאל` ★ 1149 | `עשרת` ★ 1150 | `עתלית` ★ 1151 | `עתניאל` ★ 1152 | `פארן` ★ 1153 | `פארק תעשיות מגדל עוז` ★ 1154 | `פארק תעשיות פלמחים` ★ 1155 | `פארק תעשייה ראם` ★ 1156 | `פדואל` ★ 1157 | `פדויים` ★ 1158 | `פדיה` ★ 1159 | `פוריה כפר עבודה` ★ 1160 | `פוריה נווה עובד` ★ 1161 | `פוריה עילית` ★ 1162 | `פוריידיס` ★ 1163 | `פורת` ★ 1164 | `פטיש` ★ 1165 | `פלך` ★ 1166 | `פלמחים` ★ 1167 | `פני קדם` ★ 1168 | `פנימיית עין כרם` ★ 1169 | `פסגות` ★ 1170 | `פסוטה` ★ 1171 | `פעמי תש''ז` ★ 1172 | `פצאל` ★ 1173 | `פקיעין` ★ 1174 | `פקיעין החדשה` ★ 1175 | `פרדס חנה כרכור` ★ 1176 | `פרדסיה` ★ 1177 | `פרוד` ★ 1178 | `פרי גן` ★ 1179 | `פתח תקווה` ★ 1180 | `פתחיה` ★ 1181 | `צאלים` ★ 1182 | `צבעון` ★ 1183 | `צובה` ★ 1184 | `צוחר, אוהד` ★ 1185 | `צומת בנימינה` ★ 1186 | `צומת דבירה` ★ 1187 | `צומת האלה` ★ 1188 | `צומת הגוש` ★ 1189 | `צופים` ★ 1190 | `צופית` ★ 1191 | `צופר` ★ 1192 | `צוקים` ★ 1193 | `צור הדסה` ★ 1194 | `צור יצחק` ★ 1195 | `צור משה` ★ 1196 | `צור נתן` ★ 1197 | `צוריאל` ★ 1198 | `צורית גילון` ★ 1199 | `ציפורי` ★ 1200 | `צלפון` ★ 1201 | `צמח` ★ 1202 | `צפריה` ★ 1203 | `צפרירים` ★ 1204 | `צפת` ★ 1205 | `צפת - נוף כנרת` ★ 1206 | `צפת - עיר` ★ 1207 | `צפת - עכברה` ★ 1208 | `צרופה` ★ 1209 | `צרעה` ★ 1210 | `קבוצת גבע` ★ 1211 | `קבוצת יבנה` ★ 1212 | `קדומים` ★ 1213 | `קדימה צורן` ★ 1214 | `קדיתא` ★ 1215 | `קדמה` ★ 1216 | `קדמת צבי` ★ 1217 | `קדרון` ★ 1218 | `קדרים` ★ 1219 | `קדש ברנע` ★ 1220 | `קוממיות` ★ 1221 | `קורנית` ★ 1222 | `קטורה` ★ 1223 | `קיבוץ דן` ★ 1224 | `קיבוץ מגידו` ★ 1225 | `קידה` ★ 1226 | `קידר` ★ 1227 | `קיסריה` ★ 1228 | `קלחים` ★ 1229 | `קליה` ★ 1230 | `קלנסווה` ★ 1231 | `קסר א-סר` ★ 1232 | `קציר` ★ 1233 | `קצרין` ★ 1234 | `קצרין - אזור תעשייה` ★ 1235 | `קריית אונו` ★ 1236 | `קריית ארבע` ★ 1237 | `קריית אתא` ★ 1238 | `קריית ביאליק` ★ 1239 | `קריית גת, כרמי גת` ★ 1240 | `קריית חינוך מרחבים` ★ 1241 | `קריית טבעון - בית זייד` ★ 1242 | `קריית ים` ★ 1243 | `קריית יערים` ★ 1244 | `קריית מוצקין` ★ 1245 | `קריית מלאכי` ★ 1246 | `קריית נטפים` ★ 1247 | `קריית ענבים` ★ 1248 | `קריית עקרון` ★ 1249 | `קריית שמונה` ★ 1250 | `קרני שומרון` ★ 1251 | `קשת` ★ 1252 | `ראמה` ★ 1253 | `ראס אל-עין` ★ 1254 | `ראס עלי` ★ 1255 | `ראש הנקרה` ★ 1256 | `ראש העין` ★ 1257 | `ראש פינה` ★ 1258 | `ראש צורים` ★ 1259 | `ראשון לציון - מזרח` ★ 1260 | `ראשון לציון - מערב` ★ 1261 | `רבבה` ★ 1262 | `רבדים` ★ 1263 | `רביבים` ★ 1264 | `רביד` ★ 1265 | `רגבה` ★ 1266 | `רגבים` ★ 1267 | `רהט` ★ 1268 | `רווחה` ★ 1269 | `רוויה` ★ 1270 | `רוחמה` ★ 1271 | `רומאנה` ★ 1272 | `רומת אל הייב` ★ 1273 | `רועי` ★ 1274 | `רותם` ★ 1275 | `רחוב` ★ 1276 | `רחובות` ★ 1277 | `רחלים` ★ 1278 | `רטורנו - גבעת שמש` ★ 1279 | `ריחאנייה` ★ 1280 | `ריחן` ★ 1281 | `ריינה` ★ 1282 | `רימונים` ★ 1283 | `רינתיה` ★ 1284 | `רכסים` ★ 1285 | `רם און` ★ 1286 | `רמות` ★ 1287 | `רמות השבים` ★ 1288 | `רמות מאיר` ★ 1289 | `רמות מנשה` ★ 1290 | `רמות נפתלי` ★ 1291 | `רמלה` ★ 1292 | `רמת גן - מזרח` ★ 1293 | `רמת גן - מערב` ★ 1294 | `רמת דוד` ★ 1295 | `רמת הכובש` ★ 1296 | `רמת הנדיב` ★ 1297 | `רמת השופט` ★ 1298 | `רמת השרון` ★ 1299 | `רמת טראמפ` ★ 1300 | `רמת יוחנן` ★ 1301 | `רמת ישי` ★ 1302 | `רמת מגשימים` ★ 1303 | `רמת צבי` ★ 1304 | `רמת רזיאל` ★ 1305 | `רנן` ★ 1306 | `רעים` ★ 1307 | `רעננה` ★ 1308 | `רפטינג נהר הירדן` ★ 1309 | `רקפת` ★ 1310 | `רשפון` ★ 1311 | `רשפים` ★ 1312 | `רתמים` ★ 1313 | `שאנטי במדבר` ★ 1314 | `שאר ישוב` ★ 1315 | `שבות רחל` ★ 1316 | `שבי דרום` ★ 1317 | `שבי ציון` ★ 1318 | `שבי שומרון` ★ 1319 | `שבלי` ★ 1320 | `שגב שלום` ★ 1321 | `שדה אילן` ★ 1322 | `שדה אליהו` ★ 1323 | `שדה אליעזר` ★ 1324 | `שדה בוקר` ★ 1325 | `שדה בר` ★ 1326 | `שדה דוד` ★ 1327 | `שדה ורבורג` ★ 1328 | `שדה יואב` ★ 1329 | `שדה יעקב` ★ 1330 | `שדה יצחק` ★ 1331 | `שדה משה` ★ 1332 | `שדה נחום` ★ 1333 | `שדה נחמיה` ★ 1334 | `שדה ניצן` ★ 1335 | `שדה עוזיהו` ★ 1336 | `שדה צבי` ★ 1337 | `שדות ים` ★ 1338 | `שדות מיכה` ★ 1339 | `שדי אברהם` ★ 1340 | `שדי חמד` ★ 1341 | `שדי תרומות` ★ 1342 | `שדמה` ★ 1343 | `שדמות דבורה` ★ 1344 | `שדמות מחולה` ★ 1345 | `שדרות, איבים` ★ 1346 | `שואבה` ★ 1347 | `שובל` ★ 1348 | `שוהם` ★ 1349 | `שומרה` ★ 1350 | `שומריה` ★ 1351 | `שומרת` ★ 1352 | `שוקדה` ★ 1353 | `שורש` ★ 1354 | `שורשים` ★ 1355 | `שושנת העמקים` ★ 1356 | `שזור` ★ 1357 | `שחר` ★ 1358 | `שחרות` ★ 1359 | `שיבולים` ★ 1360 | `שיטים` ★ 1361 | `שייח' דנון` ★ 1362 | `שילה` ★ 1363 | `שילת` ★ 1364 | `שכניה` ★ 1365 | `שלווה` ★ 1366 | `שלוחות` ★ 1367 | `שלומי` ★ 1368 | `שלומית` ★ 1369 | `שלפים` ★ 1370 | `שמיר` ★ 1371 | `שמעה` ★ 1372 | `שמשית` ★ 1373 | `שני ליבנה` ★ 1374 | `שניר` ★ 1375 | `שעב` ★ 1376 | `שעל` ★ 1377 | `שעלבים` ★ 1378 | `שער אפרים` ★ 1379 | `שער הגולן` ★ 1380 | `שער הגיא` ★ 1381 | `שער העמקים` ★ 1382 | `שער מנשה` ★ 1383 | `שערי תקווה` ★ 1384 | `שפיים` ★ 1385 | `שפיר` ★ 1386 | `שפר` ★ 1387 | `שפרעם` ★ 1388 | `שקד` ★ 1389 | `שקף` ★ 1390 | `שרונה` ★ 1391 | `שריגים - לי-און` ★ 1392 | `שריד` ★ 1393 | `שרשרת` ★ 1394 | `שתולה` ★ 1395 | `שתולים` ★ 1396 | `תארבין` ★ 1397 | `תאשור` ★ 1398 | `תדהר` ★ 1399 | `תובל` ★ 1400 | `תומר` ★ 1401 | `תחנת רכבת כפר ברוך` ★ 1402 | `תחנת רכבת כפר יהושוע` ★ 1403 | `תחנת רכבת קריית מלאכי - יואב` ★ 1404 | `תחנת רכבת ראש העין` ★ 1405 | `תימורים` ★ 1406 | `תירוש` ★ 1407 | `תל אביב - דרום העיר ויפו` ★ 1408 | `תל אביב - מזרח` ★ 1409 | `תל אביב - מרכז העיר` ★ 1410 | `תל אביב - עבר הירקון` ★ 1411 | `תל חי` ★ 1412 | `תל יוסף` ★ 1413 | `תל יצחק` ★ 1414 | `תל מונד` ★ 1415 | `תל עדשים` ★ 1416 | `תל ערד` ★ 1417 | `תל ציון` ★ 1418 | `תל קציר` ★ 1419 | `תל שבע` ★ 1420 | `תל תאומים` ★ 1421 | `תלם` ★ 1422 | `תלמי אליהו` ★ 1423 | `תלמי אלעזר` ★ 1424 | `תלמי ביל''ו` ★ 1425 | `תלמי יוסף` ★ 1426 | `תלמי יחיאל` ★ 1427 | `תלמי יפה` ★ 1428 | `תלמים` ★ 1429 | `תמרת` ★ 1430 | `תנובות` ★ 1431 | `תעוז` ★ 1432 | `תעשיון חצב` ★ 1433 | `תעשיון צריפין` ★ 1434 | `תפרח` ★ 1435 | `תקומה` ★ 1436 | `תקוע` ★ 1437 | `תרום` 1438 | -------------------------------------------------------------------------------- /english.md: -------------------------------------------------------------------------------- 1 | # Israeli Red Alert Service for Home Assistant (AppDaemon) 2 | * ***Not Official Pikud Ha-Oref*** 3 | * Short Hebrew version can be found here: https://github.com/idodov/RedAlert/blob/main/hebrew.md 4 | ____ 5 | ## Important Notice 6 | * This installation method **relies** on Supervised Add-ons, which are exclusively accessible if you've employed either the Home Assistant Operating System or the Home Assistant Supervised installation method (You can also opt to install the AppDaemon add-on through Docker. For additional details, please consult the following link: https://appdaemon.readthedocs.io/en/latest/DOCKER_TUTORIAL.html). 7 | * Starting from version 0.15.2, AppDaemon has changed the location of its files. 8 | With this release, the appdaemon data folder will migrate/move out of the Home Assistant configuration folder into a dedicated folder for this add-on. You can access add-on configuration folders using SSH, Samba, VSCode, and similar add-ons by accessing the **addon_configs** folder/share. 9 | If you have this in your appdaemon.yaml file: 10 | ``` 11 | secrets: /config/secrets.yaml 12 | ``` 13 | You will need to adjust this to: 14 | ``` 15 | secrets: /homeassistant/secrets.yaml 16 | ``` 17 | * The latest appdaemon files are no longer situated in the config directory, causing add-ons like **File Editor** to be unable to access them. 18 | * Using a **Samba Share** allows you to access and open these files with any file editor in your computer. 19 | * In the provided screenshot, the **VSCode** add-on can be accessed by pressing ctrl+o and selecting the **addon_configs** folder. 20 | ![ac](https://github.com/idodov/RedAlert/assets/19820046/f249ae47-b5b7-4339-8b61-42321f754922) 21 | ____ 22 | **This script sets up two new entities in Home Assistant:** 23 | 1. A binary sensor called ***binary_sensor.red_alert*** to store PIKUD HA-OREF data. The sensor can be used in automations or to create sub-sensors/binary sensors from it. 24 | 2. A text input entity named ***input_text.last_alert_in_israel*** for storing the latest alert information, mainly for historical purposes. 25 | 26 | The binary sensor provides a warning for all threats that the PIKUD HA-OREF alerts for, including red alerts rocket and missile launches, unauthorized aircraft penetration, earthquakes, tsunami concerns, infiltration of terrorists, hazardous materials incidents, unconventional warfare, and any other threat. When the alert is received, the nature of the threat will appear at the beginning of the alert (e.g., 'ירי רקטות וטילים'). 27 | 28 | While the binary sensor's state switches to 'on' when there is an active alert in Israel behavior may not suit everyone, the sensor is designed with additional attributes containing data such as cities, types of attacks and more. These attributes make it easy to create customized sub-sensors to meet individual requirements. For example, you can set up specific sensors that activate only when an alarm pertains to a particular city or area. 29 | 30 |
31 | Why did I choose this method and not REST sensor? 32 | Until we all have an official Home Assistant add-on to handle 'Red Alert' situations, there are several approaches for implementing the data into Home Assistant. One of them is creating a REST sensor and adding the code to the *configuration.yaml* file. However, using a binary sensor (instead of a 'REST sensor') is a better choice because it accurately represents binary states (alerted or not alerted), is more compatible with Home Assistant tools, and simplifies automation and user configuration. It offers a more intuitive and standardized approach to monitoring alert status. I tried various methods in Home Assistant, but this script worked best for my needs. 33 |
34 | 35 | *By default, for testing purposes, the entities will contain data related to cities inside the Gaza Strip.* 36 | # Installation Instructions 37 | 1. Install the **AppDaemon** addon in Home Assistant by going to Settings > Add-ons > Ad-on-store and search for **AppDaemon**. 38 | 2. Once AppDaemon is installed, enable the **Auto-Start** and **Watchdog** options. 39 | 3. Go to the AppDaemon ***configuration*** page and add ```requests``` ***Python package*** under the Python Packages section. 40 | 41 | ![Capture1](https://github.com/idodov/RedAlert/assets/19820046/d4e3800a-a59b-4605-b8fe-402942c3525b) 42 | 43 | 4. **Start** the add-on 44 | 5. In file editor open **\addon_configs\appdaemon\appdaemon.yaml** and make this changes under *appdeamon* section for `latitude: 31.9837528` & 45 | `longitude: 34.7359077` & `time_zone: Asia/Jerusalem`. 46 | *You can locate your own coordinates (latitude & longitude) here: https://www.latlong.net/* 47 | ```yaml 48 | --- 49 | secrets: /homeassistant/secrets.yaml 50 | appdaemon: 51 | latitude: 31.9837528 52 | longitude: 34.7359077 53 | elevation: 2 54 | time_zone: Asia/Jerusalem 55 | plugins: 56 | HASS: 57 | type: hass 58 | http: 59 | url: http://127.0.0.1:5050 60 | admin: 61 | api: 62 | hadashboard: 63 | ``` 64 | 5. Create a file named **orefalert.py** in the **\addon_configs\appdaemon\apps** directory. 65 | 6. Paste the script code into the **orefalert.py** file and save it. 66 | The script updates the sensors every *2 seconds*, or more frequently if you specify a shorter scan ```interval```. 67 | ``` 68 | # UPDATE 03/01/2024 - Twicks & Bug fixes 69 | import requests 70 | import re 71 | import time 72 | import json 73 | import codecs 74 | import traceback 75 | from datetime import datetime 76 | from appdaemon.plugins.hass.hassapi import Hass 77 | 78 | interval = 2 79 | 80 | class OrefAlert(Hass): 81 | def initialize(self): 82 | self.check_create_binary_sensor() 83 | self.run_every(self.poll_alerts, datetime.now(), interval, timeout=30) 84 | 85 | def check_create_binary_sensor(self): 86 | if not self.entity_exists("binary_sensor.red_alert"): 87 | self.set_state("binary_sensor.red_alert", state="off", attributes={ "id":0, "cat": 0, "title": "", "desc": "", "data": "", "data_count": 0, "duration": 0, "last_changed": "", "emoji": "🚨", "icon_alert": "mdi:alert", "prev_last_changed": datetime.now().isoformat(), "prev_cat": 0, "prev_title": "מפוצצים את עזה", "prev_desc": "תישארו בחוץ", "prev_data" :"בית חאנון, בית לאהיא, בני סוהילה, ג'באליה, דיר אל-בלח, ח'אן יונס, עבסאן אל-כבירה, עזה, רפיח", "prev_data_count": 9,"prev_duration": 10, "prev_areas": "רצועת עזה", "prev_last_changed": datetime.now().isoformat()},) 88 | if not self.entity_exists("input_text.last_alert_in_israel"): 89 | self.set_state("input_text.last_alert_in_israel", state="ירי רקטות וטילים = בית חאנון, בית לאהיא, בני סוהילה, ג'באליה, דיר אל-בלח, ח'אן יונס, עבסאן אל-כבירה, עזה, רפיח", attributes={"min": 0, "max": 255, "mode": "text", "friendly_name": "Last Alert in Israel"},) 90 | 91 | def poll_alerts(self, kwargs): 92 | #url = "https://www.oref.org.il/WarningMessages/History/AlertsHistory.json" 93 | url = "https://www.oref.org.il/WarningMessages/alert/alerts.json" 94 | headers = { 95 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3', 96 | 'Referer': 'https://www.oref.org.il/', 97 | 'X-Requested-With': 'XMLHttpRequest', 98 | 'Content-Type': 'application/json', 99 | } 100 | lamas = {"areas":{"גליל עליון":{"אבו סנאן":{},"אור הגנוז":{},"אזור תעשייה בר-לב":{},"אזור תעשייה חצור הגלילית":{},"אזור תעשייה כרמיאל":{},"אזור תעשייה צ.ח.ר":{},"אזור תעשייה שער נעמן":{},"אחיהוד":{},"איילת השחר":{},"אליפלט":{},"אמירים":{},"אמנון":{},"אפק":{},"אשרת":{},"בוסתן הגליל":{},"ביריה":{},"בית ג'אן":{},"בית העמק":{},"בענה":{},"בר יוחאי":{},"ג'דידה מכר":{},"ג'וליס":{},"גדות":{},"גיתה":{},"דיר אל-אסד":{},"הר-חלוץ":{},"חולתה":{},"חצור הגלילית":{},"חרשים":{},"טובא זנגריה":{},"טל-אל":{},"ינוח-ג'ת":{},"יסוד המעלה":{},"יסעור":{},"ירכא":{},"כורזים ורד הגליל":{},"כחל":{},"כיסרא סמיע":{},"כישור":{},"כליל":{},"כמון":{},"כפר הנשיא":{},"כפר יסיף":{},"כפר מסריק":{},"כפר שמאי":{},"כרכום":{},"כרמיאל":{},"לבון":{},"לוחמי הגטאות":{},"לפידות":{},"מג'דל כרום":{},"מרכז אזורי מרום גליל":{},"מזרעה":{},"מחניים":{},"מירון":{},"מכמנים":{},"מנחת מחניים":{},"משמר הירדן":{},"נחף":{},"נס עמים":{},"נתיב השיירה":{},"סאג'ור":{},"ספסופה - כפר חושן":{},"עין אל אסד":{},"עין המפרץ":{},"עין כמונים":{},"עכו":{},"עכו - אזור תעשייה":{},"עמוקה":{},"עמיעד":{},"עמקה":{},"פלך":{},"פרוד":{},"צורית גילון":{},"צפת":{},"קדיתא":{},"קדרים":{},"ראמה":{},"ראש פינה":{},"רגבה":{},"שבי ציון":{},"שדה אליעזר":{},"שומרת":{},"שזור":{},"שייח' דנון":{},"שפר":{},"תובל":{}},"דרום הנגב":{"אבו קרינאת":{},"אבו תלול":{},"אורון תעשייה ומסחר":{},"אזור תעשייה דימונה":{},"אזור תעשייה רותם":{},"אל פורעה":{},"אשלים":{},"באר מילכה":{},"'ביר הדאג":{},"בית סוהר נפחא":{},"דימונה":{},"הר הנגב":{},"ואדי אל נעם דרום":{},"חירן":{},"טללים":{},"ירוחם":{},"כמהין":{},"כסייפה":{},"מדרשת בן גוריון":{},"ממשית":{},"מצפה רמון":{},"מרחב עם":{},"מרעית":{},"משאבי שדה":{},"ניצנה":{},"סעייה-מולדה":{},"עבדת":{},"עזוז":{},"ערד":{},"ערערה בנגב":{},"קדש ברנע":{},"קצר-א-סיר":{},"רביבים":{},"רתמים":{},"שאנטי במדבר":{},"שדה בוקר":{},"תל ערד":{}},"שפלת יהודה":{"אבו-גוש":{},"אביעזר":{},"אדרת":{},"אזור תעשייה ברוש":{},"אזור תעשייה הר טוב - צרעה":{},"אשתאול":{},"בית גוברין":{},"בית מאיר":{},"בית ניר":{},"בית נקופה":{},"בית שמש":{},"בקוע":{},"בר גיורא":{},"גבעות עדן":{},"גבעת יערים":{},"גבעת ישעיהו":{},"גיזו":{},"גלאון":{},"גפן":{},"הר אדר":{},"הראל":{},"זכריה":{},"זנוח":{},"טל שחר":{},"יד השמונה":{},"ישעי":{},"כסלון":{},"כפר אוריה":{},"כפר זוהרים":{},"כפר מנחם":{},"לוזית":{},"לטרון":{},"מבוא ביתר":{},"מחסיה":{},"מטע":{},"מסילת ציון":{},"מעלה החמישה":{},"נווה אילן":{},"נווה מיכאל - רוגלית":{},"נווה שלום":{},"נחושה":{},"נחם":{},"נחשון":{},"נטף":{},"נס הרים":{},"נתיב הל''ה":{},"עגור":{},"עין נקובא":{},"עין ראפה":{},"צובה":{},"צור הדסה":{},"צלפון":{},"צפרירים":{},"צרעה":{},"קריית יערים":{},"קריית ענבים":{},"רטורנו - גבעת שמש":{},"רמת רזיאל":{},"שדות מיכה":{},"שואבה":{},"שורש":{},"שריגים - ליאון":{},"תירוש":{},"תעוז":{},"תרום":{}},"מרכז הגליל":{"אבטליון":{},"אזור תעשייה תרדיון":{},"אעבלין":{},"אשבל":{},"אשחר":{},"בועיינה-נוג'ידאת":{},"ביר אלמכסור":{},"בית סוהר צלמון":{},"בית רימון":{},"דיר חנא":{},"דמיידה":{},"הררית יחד":{},"חוסנייה":{},"חזון":{},"חנתון":{},"טורעאן":{},"טמרה":{},"טפחות":{},"יובלים":{},"יודפת":{},"יעד":{},"כאבול":{},"כאוכב אבו אלהיג'א":{},"כלנית":{},"כפר חנניה":{},"כפר מנדא":{},"לוטם וחמדון":{},"מורן":{},"מורשת":{},"מנוף":{},"מסד":{},"מע'אר":{},"מעלה צביה":{},"מצפה אבי''ב":{},"מצפה נטופה":{},"מרכז אזורי משגב":{},"סכנין":{},"סלמה":{},"עוזייר":{},"עילבון":{},"עינבר":{},"עצמון - שגב":{},"עראבה":{},"ערב אל-נעים":{},"קורנית":{},"ראס אל-עין":{},"רומאנה":{},"רומת אל הייב":{},"רקפת":{},"שורשים":{},"שכניה":{},"שעב":{},"שפרעם":{}},"מנשה":{"אביאל":{},"אור עקיבא":{},"אזור תעשייה קיסריה":{},"אזור תעשייה רגבים":{},"אלוני יצחק":{},"בית חנניה":{},"בית ספר אורט בנימינה":{},"בנימינה":{},"ברקאי":{},"ג'סר א-זרקא":{},"גבעת חביבה":{},"גבעת עדה":{},"גן השומרון":{},"גן שמואל":{},"זכרון יעקב":{},"חדרה - מזרח":{},"חדרה - מערב":{},"חדרה - מרכז":{},"חדרה - נווה חיים":{},"כפר גליקסון":{},"כפר פינס":{},"להבות חביבה":{},"מאור":{},"מעגן מיכאל":{},"מעיין צבי":{},"מענית":{},"מרכז ימי קיסריה":{},"משמרות":{},"עין עירון":{},"עין שמר":{},"עמיקם":{},"פרדס חנה-כרכור":{},"קיסריה":{},"רמת הנדיב":{},"שדה יצחק":{},"שדות ים":{},"שער מנשה":{},"תלמי אלעזר":{}},"קו העימות":{"אביבים":{},"אבירים":{},"אבן מנחם":{},"אדמית":{},"אזור תעשייה אכזיב מילואות":{},"אזור תעשייה רמת דלתון":{},"אילון":{},"אלקוש":{},"בית הלל":{},"בית ספר שדה מירון":{},"בן עמי":{},"בצת":{},"ברעם":{},"ג'ש - גוש חלב":{},"גונן":{},"גורן":{},"גורנות הגליל":{},"געתון":{},"גשר הזיו":{},"דוב''ב":{},"דישון":{},"דלתון":{},"קיבוץ דן":{},"דפנה":{},"הגושרים":{},"הילה":{},"זרעית":{},"חוסן":{},"חורפיש":{},"חניתה":{},"יחיעם":{},"יערה":{},"יפתח":{},"יראון":{},"כברי":{},"כפר בלום":{},"כפר גלעדי":{},"כפר ורדים":{},"כפר יובל":{},"כפר סאלד":{},"כרם בן זמרה":{},"להבות הבשן":{},"לימן":{},"מרכז אזורי מבואות חרמון":{},"מטולה":{},"מלכיה":{},"מנות":{},"מנרה":{},"מעונה":{},"מעיין ברוך":{},"מעיליא":{},"מעלות תרשיחא":{},"מצובה":{},"מרגליות":{},"משגב עם":{},"מתת":{},"נאות מרדכי":{},"נהריה":{},"נווה זיו":{},"נטועה":{},"סאסא":{},"סער":{},"עבדון":{},"עברון":{},"ע'ג'ר":{},"עין יעקב":{},"עלמה":{},"עמיר":{},"ערב אל עראמשה":{},"פסוטה":{},"פקיעין":{},"צבעון":{},"צוריאל":{},"קריית שמונה":{},"ראש הנקרה":{},"ריחאנייה":{},"רמות נפתלי":{},"שאר ישוב":{},"שדה נחמיה":{},"שומרה":{},"שלומי":{},"שמיר":{},"שניר":{},"שתולה":{},"תל חי":{}},"לכיש":{"אביגדור":{},"אבן שמואל":{},"אורות":{},"אזור תעשייה באר טוביה":{},"אזור תעשייה כנות":{},"אזור תעשייה עד הלום":{},"אזור תעשייה קריית גת":{},"אזור תעשייה תימורים":{},"אחווה":{},"אחוזם":{},"איתן":{},"אל עזי":{},"אלומה":{},"אמונים":{},"אשדוד - א,ב,ד,ה":{},"אשדוד - איזור תעשייה צפוני":{},"אשדוד - ג,ו,ז":{},"אשדוד - ח,ט,י,יג,יד,טז":{},"אשדוד -יא,יב,טו,יז,מרינה,סיט":{},"באר טוביה":{},"ביצרון":{},"בית אלעזרי":{},"בית גמליאל":{},"בית חלקיה":{},"בית עזרא":{},"בן זכאי":{},"בני דרום":{},"בני עי''ש":{},"בני ראם":{},"בניה":{},"גבעת ברנר":{},"גבעת וושינגטון":{},"גבעתי":{},"גדרה":{},"גן הדרום":{},"גן יבנה":{},"גני טל":{},"גת":{},"ורדון":{},"זבדיאל":{},"זוהר":{},"זרחיה":{},"חפץ חיים":{},"חצב":{},"חצור":{},"יבנה":{},"יד בנימין":{},"יד נתן":{},"ינון":{},"כנות":{},"כפר אביב":{},"כפר אחים":{},"כפר הנגיד":{},"כפר הרי''ף וצומת ראם":{},"כפר ורבורג":{},"כפר מרדכי":{},"כרם ביבנה":{},"לכיש":{},"מישר":{},"מנוחה":{},"מעון צופיה":{},"מרכז שפירא":{},"משגב דב":{},"משואות יצחק":{},"מתחם בני דרום":{},"נגבה":{},"נהורה":{},"נוגה":{},"נווה מבטח":{},"נועם":{},"נחלה":{},"ניר בנים":{},"ניר גלים":{},"ניר ח''ן":{},"סגולה":{},"עוזה":{},"עוצם":{},"עזר":{},"עזריקם":{},"עין צורים":{},"ערוגות":{},"עשרת":{},"פארק תעשייה ראם":{},"פלמחים":{},"קבוצת יבנה":{},"קדמה":{},"קדרון":{},"קוממיות":{},"קריית גת, כרמי גת":{},"קריית מלאכי":{},"רבדים":{},"רווחה":{},"שדה דוד":{},"שדה יואב":{},"שדה משה":{},"שדה עוזיהו":{},"שדמה":{},"שחר":{},"שלווה":{},"שפיר":{},"שתולים":{},"תימורים":{},"תלמי יחיאל":{},"תלמים":{}},"שרון":{"אביחיל":{},"אבן יהודה":{},"אודים":{},"אורנית":{},"אזור תעשייה טירה":{},"אזור תעשייה עמק חפר":{},"אחיטוב":{},"אייל":{},"אליכין":{},"אלישיב":{},"אלישמע":{},"אלפי מנשה":{},"אלקנה":{},"אמץ":{},"ארסוף":{},"בארותיים":{},"בורגתה":{},"בחן":{},"בית ברל":{},"בית הלוי":{},"בית חזון":{},"בית חרות":{},"בית יהושע":{},"בית ינאי":{},"בית יצחק - שער חפר":{},"בית סוהר השרון":{},"ביתן אהרן":{},"בני דרור":{},"בני ציון":{},"בצרה":{},"בת חן":{},"בת חפר":{},"ג'לג'וליה":{},"גאולי תימן":{},"גאולים":{},"גבעת חיים איחוד":{},"גבעת חיים מאוחד":{},"גבעת חן":{},"גבעת שפירא":{},"גן חיים":{},"גן יאשיה":{},"גנות הדר":{},"גני עם":{},"געש":{},"הדר עם":{},"הוד השרון":{},"המעפיל":{},"המרכז האקדמי רופין":{},"העוגן":{},"זמר":{},"חבצלת השרון וצוקי ים":{},"חגור":{},"חגלה":{},"חופית":{},"חורשים":{},"חיבת ציון":{},"חניאל":{},"חרב לאת":{},"חרוצים":{},"חרות":{},"טייבה":{},"טירה":{},"יד חנה":{},"ינוב":{},"יעף":{},"יקום":{},"ירחיב":{},"ירקונה":{},"כוכב יאיר - צור יגאל":{},"כפר ברא":{},"כפר הס":{},"כפר הרא''ה":{},"כפר ויתקין":{},"כפר חיים":{},"כפר ידידיה":{},"כפר יונה":{},"כפר יעבץ":{},"כפר מונש":{},"כפר מל''ל":{},"כפר נטר":{},"כפר סבא":{},"כפר עבודה":{},"כפר קאסם":{},"מרכז אזורי דרום השרון":{},"מכון וינגייט":{},"מכמורת":{},"מעברות":{},"משמר השרון":{},"משמרת":{},"מתן":{},"נווה ימין":{},"נווה ירק":{},"נורדיה":{},"ניצני עוז":{},"ניר אליהו":{},"נירית":{},"נעורים":{},"נתניה - מזרח":{},"נתניה - מערב":{},"סלעית":{},"עדנים":{},"עולש":{},"עזריאל":{},"עין החורש":{},"עין ורד":{},"עין שריד":{},"עץ אפרים":{},"פורת":{},"פרדסיה":{},"צופים":{},"צופית":{},"צור יצחק":{},"צור משה":{},"צור נתן":{},"קדימה-צורן":{},"קלנסווה":{},"רמות השבים":{},"רמת הכובש":{},"רעננה":{},"רשפון":{},"שדה ורבורג":{},"שדי חמד":{},"שושנת העמקים":{},"שער אפרים":{},"שערי תקווה":{},"שפיים":{},"תחנת רכבת ראש העין":{},"תל יצחק":{},"תל מונד":{},"תנובות":{}},"ירושלים":{"אבן ספיר":{},"אורה":{},"בית זית":{},"גבעת זאב":{},"ירושלים - אזור תעשייה עטרות":{},"ירושלים - דרום":{},"ירושלים - כפר עקב":{},"ירושלים - מזרח":{},"ירושלים - מערב":{},"ירושלים - מרכז":{},"ירושלים - צפון":{},"מבשרת ציון":{},"מוצא עילית":{},"נבי סמואל":{},"עמינדב":{},"פנימיית עין כרם":{}},"דרום הגולן":{"אבני איתן":{},"אזור תעשייה בני יהודה":{},"אלוני הבשן":{},"אלי עד":{},"אלמגור":{},"אניעם":{},"אפיק":{},"אשדות יעקב איחוד":{},"אשדות יעקב מאוחד":{},"בני יהודה וגבעת יואב":{},"גשור":{},"האון":{},"חד נס":{},"חמת גדר":{},"חספין":{},"יונתן":{},"כנף":{},"כפר חרוב":{},"מבוא חמה":{},"מיצר":{},"מסדה":{},"מעגן":{},"מעלה גמלא":{},"נאות גולן":{},"נוב":{},"נטור":{},"עין גב":{},"קדמת צבי":{},"קצרין":{},"קצרין - אזור תעשייה":{},"קשת":{},"רמות":{},"רמת מגשימים":{},"שער הגולן":{},"תל קציר":{}},"שומרון":{"אבני חפץ":{},"אזור תעשייה בראון":{},"אזור תעשייה שער בנימין":{},"אחיה":{},"איתמר":{},"אלון מורה":{},"אריאל":{},"בית אל":{},"בית אריה":{},"בית חורון":{},"ברוכין":{},"ברקן":{},"גבע בנימין":{},"גבעת אסף":{},"גבעת הראל וגבעת הרואה":{},"דולב":{},"הר ברכה":{},"חוות גלעד":{},"חוות יאיר":{},"חיננית":{},"חלמיש":{},"חרמש":{},"חרשה":{},"טל מנשה":{},"טלמון":{},"יצהר":{},"יקיר":{},"כוכב השחר":{},"כוכב יעקב":{},"כפר תפוח":{},"מבוא דותן":{},"מגדלים":{},"מגרון":{},"מעלה לבונה":{},"מעלה מכמש":{},"מעלה שומרון":{},"נופי נחמיה":{},"נופים":{},"נחליאל":{},"ניל''י":{},"נעלה":{},"נריה":{},"עדי עד":{},"עופרים":{},"עטרת":{},"עלי":{},"עלי זהב":{},"עמיחי":{},"עמנואל":{},"ענב":{},"עפרה":{},"פדואל":{},"פסגות":{},"קדומים":{},"קידה":{},"קריית נטפים":{},"קרני שומרון":{},"רבבה":{},"רחלים":{},"ריחן":{},"רימונים":{},"שבות רחל":{},"שבי שומרון":{},"שילה":{},"שקד":{},"תל ציון":{}},"ים המלח":{"אבנת":{},"אלמוג":{},"בית הערבה":{},"בתי מלון ים המלח":{},"ורד יריחו":{},"מלונות ים המלח מרכז":{},"מצדה":{},"מצוקי דרגות":{},"מצפה שלם":{},"מרחצאות עין גדי":{},"מרכז אזורי מגילות":{},"נאות הכיכר":{},"נווה זוהר":{},"עין בוקק":{},"עין גדי":{},"עין תמר":{},"קליה":{}},"עוטף עזה":{"אבשלום":{},"אור הנר":{},"ארז":{},"בארי":{},"בני נצרים":{},"גבים, מכללת ספיר":{},"גברעם":{},"דקל":{},"זיקים":{},"זמרת, שובה":{},"חולית":{},"יבול":{},"יד מרדכי":{},"יכיני":{},"יתד":{},"כיסופים":{},"כפר מימון ותושיה":{},"כפר עזה":{},"כרם שלום":{},"כרמיה":{},"מבטחים, עמיעוז, ישע":{},"מגן":{},"מטווח ניר עם":{},"מפלסים":{},"נווה":{},"נחל עוז":{},"ניר יצחק":{},"ניר עוז":{},"נירים":{},"נתיב העשרה":{},"סופה":{},"סעד":{},"עין הבשור":{},"עין השלושה":{},"עלומים":{},"פרי גן":{},"צוחר, אוהד":{},"רעים":{},"שדה אברהם":{},"שדה ניצן":{},"שדרות, איבים, ניר עם":{},"שוקדה":{},"שלומית":{},"תלמי אליהו":{},"תלמי יוסף":{},"תקומה":{},"תקומה וחוות יזרעם":{}},"יהודה":{"אדורה":{},"אדוריים":{},"אזור תעשייה מישור אדומים":{},"אזור תעשייה מיתרים":{},"אלון":{},"אלון שבות":{},"אליאב":{},"אלעזר":{},"אמציה":{},"אפרת":{},"בית חגי":{},"בית יתיר":{},"ביתר עילית":{},"בני דקלים":{},"בת עין":{},"גבעות":{},"הר גילה":{},"הר עמשא":{},"חברון":{},"חוות שדה בר":{},"טנא עומרים":{},"כפר אדומים":{},"כפר אלדד":{},"כפר עציון":{},"כרמי צור":{},"כרמי קטיף":{},"כרמל":{},"מגדל עוז":{},"מיצד":{},"מעון":{},"מעלה אדומים":{},"מעלה חבר":{},"מעלה עמוס":{},"מעלה רחבעם":{},"מצפה יריחו":{},"נגוהות":{},"נווה דניאל":{},"נופי פרת":{},"נוקדים":{},"נטע":{},"סוסיא":{},"עלמון":{},"עשאהל":{},"עתניאל":{},"פני קדם":{},"קדר":{},"קרית ארבע":{},"ראש צורים":{},"שומריה":{},"שמעה":{},"שני ליבנה":{},"שקף":{},"תלם":{},"תקוע":{}},"צפון הגולן":{"אודם":{},"אורטל":{},"אל רום":{},"בוקעתא":{},"מג'דל שמס":{},"מסעדה":{},"מרום גולן":{},"נווה אטי''ב":{},"נמרוד":{},"עין זיוון":{},"עין קנייא":{},"קלע":{},"שעל":{}},"גליל תחתון":{"בית ירח":{},"אזור תעשייה צמח":{},"אזור תעשייה קדמת גליל":{},"אלומות":{},"אפיקים":{},"ארבל":{},"אתר ההנצחה גולני":{},"בית זרע":{},"גבעת אבני":{},"גינוסר":{},"דגניה א":{},"דגניה ב":{},"הודיות":{},"הזורעים":{},"המכללה האקדמית כנרת":{},"ואדי אל חמאם":{},"חוקוק":{},"טבריה":{},"יבנאל":{},"כינרת מושבה":{},"כינרת קבוצה":{},"כפר זיתים":{},"כפר חיטים":{},"כפר כמא":{},"כפר נהר הירדן":{},"לביא":{},"לבנים":{},"מגדל":{},"מצפה":{},"פוריה כפר עבודה":{},"פוריה נווה עובד":{},"פוריה עילית":{},"רביד":{},"שדה אילן":{},"שרונה":{}},"ואדי ערה":{"אום אל פחם":{},"אום אל קוטוף":{},"אזור תעשייה יקנעם עילית":{},"אזור תעשייה מבוא כרמל":{},"אל עריאן":{},"אליקים":{},"באקה אל גרבייה":{},"בית סוהר מגידו":{},"ברטעה":{},"ג'ת":{},"גבעת ניל''י":{},"גבעת עוז":{},"גלעד":{},"דליה":{},"חריש":{},"יקנעם המושבה והזורע":{},"יקנעם עילית":{},"כפר קרע":{},"קיבוץ מגידו":{},"מגל":{},"מדרך עוז":{},"מועאוויה":{},"מי עמי":{},"מייסר":{},"מעלה עירון":{},"מצפה אילן":{},"מצר":{},"משמר העמק":{},"עין אל-סהלה":{},"עין העמק":{},"עין השופט":{},"ערערה":{},"קציר":{},"רגבים":{},"רמות מנשה":{},"רמת השופט":{}},"העמקים":{"אום אל-גנם":{},"אורנים":{},"אזור תעשייה אלון התבור":{},"אזור תעשייה מבואות הגלבוע":{},"אזור תעשייה ציפורית":{},"אחוזת ברק":{},"אילניה":{},"אכסאל":{},"אל-ח'וואלד מערב":{},"אלון הגליל":{},"אלוני אבא":{},"אלונים":{},"בית לחם הגלילית":{},"בית סוהר שיטה וגלבוע":{},"בית קשת":{},"בית שערים":{},"בלפוריה":{},"בסמת טבעון":{},"קבוצת גבע":{},"גבעת אלה":{},"גבת":{},"גדעונה":{},"גזית":{},"גן נר":{},"גניגר":{},"דבוריה":{},"דברת":{},"דחי":{},"הושעיה":{},"היוגב":{},"הסוללים":{},"הרדוף":{},"זרזיר":{},"ח'וואלד":{},"חג'אג'רה":{},"טמרה בגלבוע":{},"יזרעאל":{},"יפיע":{},"יפעת":{},"ישובי אומן":{},"מרכז חבר":{},"ישובי יעל":{},"כדורי":{},"כעביה":{},"כעביה טבאש":{},"כפר ברוך":{},"כפר גדעון":{},"כפר החורש":{},"כפר טבאש":{},"כפר יהושע":{},"כפר יחזקאל":{},"כפר כנא":{},"כפר מצר":{},"כפר קיש":{},"כפר תבור":{},"כפר תקווה":{},"מגדל העמק":{},"מגן שאול":{},"מוקיבלה":{},"מזרע":{},"מנשית זבדה":{},"מרחביה מושב":{},"מרחביה קיבוץ":{},"משהד":{},"נעורה":{},"נהלל":{},"נופית":{},"נורית":{},"נין":{},"נצרת":{},"נוף הגליל":{},"סואעד חמירה":{},"סולם":{},"סנדלה":{},"עדי":{},"עילוט":{},"עין דור":{},"עין חרוד":{},"עין מאהל":{},"עפולה":{},"ציפורי":{},"קריית טבעון-בית זייד":{},"ראס עלי":{},"ריינה":{},"רם און":{},"רמת דוד":{},"רמת ישי":{},"רמת צבי":{},"שבלי":{},"שדה יעקב":{},"שדמות דבורה":{},"שמשית":{},"שער העמקים":{},"שריד":{},"תחנת רכבת כפר יהושוע":{},"תל יוסף":{},"תל עדשים":{},"תמרת":{}},"מרכז הנגב":{"אום בטין":{},"אזור תעשייה עידן הנגב":{},"אל סייד":{},"אשכולות":{},"אתר דודאים":{},"באר שבע - דרום":{},"באר שבע - מזרח":{},"באר שבע - מערב":{},"באר שבע - צפון":{},"בית קמה":{},"גבעות בר":{},"גבעות גורל":{},"דביר":{},"חורה":{},"חצרים":{},"כרמים":{},"כרמית":{},"להב":{},"להבים":{},"לקיה":{},"מיתר":{},"משמר הנגב":{},"מתחם צומת שוקת":{},"נבטים":{},"סנסנה":{},"עומר":{},"רהט":{},"שגב שלום":{},"שובל":{},"תל שבע":{},"תארבין":{}},"מערב הנגב":{"אופקים":{},"אורים":{},"אזור תעשייה נ.ע.מ":{},"אשבול":{},"אשל הנשיא":{},"בטחה":{},"בית הגדי":{},"ברור חיל":{},"ברוש":{},"גבולות":{},"גילת":{},"דורות":{},"דניאל":{},"זרועה":{},"חוות שיקמים":{},"יושיביה":{},"מבועים":{},"מסלול":{},"מעגלים, גבעולים, מלילות":{},"ניר משה":{},"ניר עקיבא":{},"נתיבות":{},"פדויים":{},"פטיש":{},"פעמי תש''ז":{},"צאלים":{},"קלחים":{},"קריית חינוך מרחבים":{},"רוחמה":{},"רנן":{},"שבי דרום":{},"שדה צבי":{},"שיבולים":{},"שרשרת":{},"תאשור":{},"תדהר":{},"תלמי ביל''ו":{},"תפרח":{}},"גוש דן":{"אור יהודה":{},"אזור":{},"בני ברק":{},"בת-ים":{},"גבעת השלושה":{},"גבעת שמואל":{},"גבעתיים":{},"גני תקווה":{},"גת רימון":{},"הרצליה - מערב":{},"הרצליה - מרכז וגליל ים":{},"חולון":{},"יהוד-מונוסון":{},"כפר סירקין":{},"כפר שמריהו":{},"מגשימים":{},"מעש":{},"מקווה ישראל":{},"מתחם פי גלילות":{},"סביון":{},"סינמה סיטי גלילות":{},"פתח תקווה":{},"קריית אונו":{},"רמת גן - מזרח":{},"רמת גן - מערב":{},"רמת השרון":{},"תל אביב - דרום העיר ויפו":{},"תל אביב - מזרח":{},"תל אביב - מרכז העיר":{},"תל אביב - עבר הירקון":{}},"המפרץ":{"אושה":{},"איבטין":{},"בית עלמין תל רגב":{},"החותרים":{},"חיפה - כרמל ועיר תחתית":{},"חיפה - מערב":{},"חיפה - נווה שאנן ורמות כרמל":{},"חיפה - קריית חיים ושמואל":{},"חיפה-מפרץ":{},"טירת כרמל":{},"יגור":{},"כפר ביאליק":{},"כפר גלים":{},"כפר המכבי":{},"כפר חסידים":{},"נשר":{},"קריית ביאליק":{},"קריית ים":{},"קריית מוצקין":{},"קריית אתא":{},"רכסים":{},"רמת יוחנן":{}},"ירקון":{"אזור תעשייה אפק ולב הארץ":{},"אזור תעשייה חבל מודיעין":{},"אלעד":{},"בארות יצחק":{},"בית נחמיה":{},"בית עריף":{},"בני עטרות":{},"ברקת":{},"גבעת כ''ח":{},"גמזו":{},"חדיד":{},"חשמונאים":{},"טירת יהודה":{},"כפר דניאל":{},"כפר האורנים":{},"כפר טרומן":{},"כפר רות":{},"לפיד":{},"מבוא חורון":{},"מבוא מודיעים":{},"מודיעין":{},"מודיעין - ישפרו סנטר":{},"מודיעין - ליגד סנטר":{},"מודיעין עילית":{},"מזור":{},"מתתיהו":{},"נוף איילון":{},"נופך":{},"נחלים":{},"נחשונים":{},"עינת":{},"ראש העין":{},"רינתיה":{},"שהם":{},"שילת":{},"שעלבים":{},"תעשיון חצב":{}},"מערב לכיש":{"אזור תעשייה הדרומי אשקלון":{},"אזור תעשייה צפוני אשקלון":{},"אשקלון - דרום":{},"אשקלון - צפון":{},"באר גנים":{},"בית שקמה":{},"ברכיה":{},"בת הדר":{},"גיאה":{},"הודיה":{},"חלץ":{},"כוכב מיכאל":{},"כפר סילבר":{},"מבקיעים":{},"משען":{},"ניצן":{},"ניצנים":{},"ניר ישראל":{},"תלמי יפה":{}},"הכרמל":{"אזור תעשייה ניר עציון":{},"בית אורן":{},"בית סוהר קישון":{},"בית צבי":{},"בת שלמה":{},"גבע כרמל":{},"גבעת וולפסון":{},"דור":{},"דלית אל כרמל":{},"הבונים":{},"יערות הכרמל":{},"כלא דמון":{},"כפר הנוער ימין אורד":{},"כרם מהר''ל":{},"מאיר שפיה":{},"מגדים":{},"מרכז מיר''ב":{},"נווה ים":{},"נחשולים":{},"ניר עציון":{},"עופר":{},"עין איילה":{},"עין הוד":{},"עין חוד":{},"עין כרמל":{},"עספיא":{},"עתלית":{},"פוריידיס":{},"צרופה":{}},"השפלה":{"אזור תעשייה נשר - רמלה":{},"אחיסמך":{},"אחיעזר":{},"אירוס":{},"באר יעקב":{},"בית דגן":{},"בית חנן":{},"בית חשמונאי":{},"בית עובד":{},"בית עוזיאל":{},"בן שמן":{},"גאליה":{},"גזר":{},"גיבתון":{},"גינתון":{},"גן שורק":{},"גן שלמה":{},"גנות":{},"גני הדר":{},"גני יוחנן":{},"זיתן":{},"חולדה":{},"חמד":{},"יגל":{},"יד רמב''ם":{},"יסודות":{},"יציץ":{},"ישרש":{},"כפר ביל''ו":{},"כפר בן נון":{},"כפר חב''ד":{},"כפר נוער בן שמן":{},"כפר שמואל":{},"כרמי יוסף":{},"לוד":{},"מזכרת בתיה":{},"מצליח":{},"משמר איילון":{},"משמר דוד":{},"משמר השבעה":{},"נטעים":{},"ניר צבי":{},"נס ציונה":{},"נען":{},"נצר חזני":{},"נצר סרני":{},"סתריה":{},"עזריה":{},"עיינות":{},"פארק תעשיות פלמחים":{},"פדיה":{},"פתחיה":{},"צפריה":{},"קריית עקרון":{},"ראשון לציון - מזרח":{},"ראשון לציון - מערב":{},"רחובות":{},"רמות מאיר":{},"רמלה":{},"תעשיון צריפין":{}},"בקעת בית שאן":{"אזור תעשייה צבאים":{},"בית אלפא וחפציבה":{},"בית השיטה":{},"בית יוסף":{},"בית שאן":{},"גשר":{},"חוות עדן":{},"חמדיה":{},"טייבה בגלבוע":{},"טירת צבי":{},"ירדנה":{},"כפר גמילה מלכישוע":{},"כפר רופין":{},"מולדת":{},"מירב":{},"מנחמיה":{},"מסילות":{},"מעוז חיים":{},"מעלה גלבוע":{},"נווה אור":{},"נוה איתן":{},"ניר דוד":{},"עין הנצי''ב":{},"רוויה":{},"רחוב":{},"רשפים":{},"שדה אליהו":{},"שדה נחום":{},"שדי תרומות":{},"שלוחות":{},"שלפים":{},"תל תאומים":{}},"אילת":{"אזור תעשייה שחורת":{},"אילות":{},"אילת":{}},"ערבה":{"אל עמארני, אל מסק":{},"אליפז ומכרות תמנע":{},"באר אורה":{},"גרופית":{},"חוות ערנדל":{},"חי-בר יטבתה":{},"חצבה":{},"יהל":{},"יטבתה":{},"כושי רמון":{},"לוטן":{},"נאות סמדר":{},"נווה חריף":{},"סמר":{},"ספיר":{},"עידן":{},"עין חצבה":{},"עין יהב":{},"עיר אובות":{},"פארן":{},"צופר":{},"צוקים":{},"קטורה":{},"שחרות":{},"שיטים":{}},"בקעה":{"ארגמן":{},"בקעות":{},"גיתית":{},"גלגל":{},"חמדת":{},"חמרה":{},"ייט''ב":{},"יפית":{},"מבואות יריחו":{},"מחולה":{},"מכורה":{},"מעלה אפרים":{},"משואה":{},"משכיות":{},"נעמה":{},"נערן":{},"נתיב הגדוד":{},"פצאל":{},"רועי":{},"רותם":{},"שדמות מחולה":{},"תומר":{}}}} 101 | icons = {1: "mdi:rocket-launch",2: "mdi:home-alert",3: "mdi:earth-box",4: "mdi:chemical-weapon",5: "mdi:waves",6: "mdi:airplane",7: "mdi:skull",8: "mdi:alert",9: "mdi:alert",10: "mdi:alert",11: "mdi:alert",12: "mdi:alert",13: "mdi:run-fast",} 102 | icon_alert = "mdi:alert" 103 | emojis = {1: "🚀",2: "⚠️",3: "🌍",4: "☢️",5: "🌊",6: "🛩️",7: "💀",8: "❗",9: "❗",10: "❗",11: "❗",12: "❗",13: "👣👹",} 104 | icon_emoji = "🚨" 105 | areas_alert = "ישראל" 106 | try: 107 | response = requests.get(url, headers=headers, timeout=30) 108 | if response.status_code == 200: 109 | response_data = codecs.decode(response.content, 'utf-8-sig') 110 | current_value = self.get_state("binary_sensor.red_alert", attribute="prev_data") 111 | if response_data.strip(): 112 | try: 113 | data = json.loads(response_data) 114 | if 'data' in data and data['data']: 115 | alert_title = data.get('title', '') 116 | alerts_data = ', '.join(sorted(data.get('data', []))) 117 | icon_alert = icons.get(int(data.get('cat', 1)), "mdi:alert") 118 | icon_emoji = emojis.get(int(data.get('cat', 1)), "❗") 119 | if isinstance(alerts_data, str): 120 | data_count = len(alerts_data.split(',')) 121 | else: 122 | data_count = 0 123 | duration_match = re.findall(r'\d+', data.get('desc', '0')) 124 | if duration_match: 125 | duration = int(duration_match[0]) * 60 126 | else: 127 | duration = 0 128 | 129 | for area, cities in lamas['areas'].items(): 130 | if isinstance(cities, str): 131 | cities = cities.split(',') 132 | standardized_cities = [re.sub(r'[\-\,\(\)\s]+', '', city).strip() for city in cities] 133 | lamas['areas'][area] = standardized_cities 134 | 135 | city_names = alerts_data.split(',') 136 | standardized_names = [re.sub(r'[\-\,\(\)\s]+', '', name).strip() for name in city_names] 137 | 138 | areas = [] 139 | for area, cities in lamas['areas'].items(): 140 | if any(city in cities for city in standardized_names): 141 | areas.append(area) 142 | areas.sort() 143 | if len(areas) > 1: 144 | all_but_last = ", ".join(areas[:-1]) 145 | areas_text = f"{all_but_last} ו{areas[-1]}" 146 | else: 147 | areas_text = ", ".join(areas) 148 | 149 | areas_alert = areas_text 150 | 151 | if not current_value or current_value != alerts_data: 152 | self.set_state("binary_sensor.red_alert", state="on", attributes={ 153 | "id": int(data.get('id', 0)), 154 | "cat": int(data.get('cat', 0)), 155 | "title": alert_title, 156 | "desc": data.get('desc', None), 157 | "areas": areas_alert, 158 | "data": alerts_data, 159 | "data_count": data_count, 160 | "duration": duration, 161 | "last_changed": datetime.now().isoformat(), 162 | "prev_cat": int(data.get('cat', 0)), 163 | "prev_title": alert_title, 164 | "prev_desc": data.get('desc', None), 165 | "prev_areas": areas_alert, 166 | "prev_data": alerts_data, 167 | "prev_data_count": data_count, 168 | "prev_duration": duration, 169 | "prev_last_changed": datetime.now().isoformat(), 170 | "icon": icon_alert, 171 | "emoji": icon_emoji, 172 | "friendly_name": alert_title, 173 | }, 174 | ) 175 | text_status = f"{alert_title} ב{areas_alert} - {alerts_data}" 176 | if len(text_status) > 255: 177 | text_status = f"{text_status[:252]}..." 178 | self.set_state("input_text.last_alert_in_israel", state=f"{text_status}", attributes={"icon": f"{icon_alert}"},) 179 | 180 | except json.JSONDecodeError: 181 | self.log("Error: Invalid JSON format in the response.") 182 | icon_alert = "mdi:alert" 183 | else: 184 | # Clear the input_text and set binary_sensor state to off if there is no data in the response 185 | self.set_state( 186 | "binary_sensor.red_alert", 187 | state="off", 188 | attributes={ 189 | "id": 0, 190 | "cat": 0, 191 | "title": "אין התרעות", 192 | "desc": "", 193 | "data": "", 194 | "areas": "", 195 | "data_count": 0, 196 | "duration": 0, 197 | "icon": icon_alert, 198 | "emoji": icon_emoji, 199 | "friendly_name": "Red Alert", 200 | }, 201 | ) 202 | else: 203 | self.log(f"Failed to retrieve data. Status code: {response.status_code}") 204 | except requests.exceptions.Timeout: 205 | self.log("The request timed out") 206 | return 207 | except Exception as e: 208 | self.log(f"Error: {e}\n{traceback.format_exc()}") 209 | ``` 210 | 7. With a file editor, open the **\addon_configs\appdaemon\apps\apps.yaml** file and add/enter the following lines 211 | ```yaml 212 | orefalert: 213 | module: orefalert 214 | class: OrefAlert 215 | ``` 216 | 8. **Restart** the **AppDaemon** addon. 217 | 218 | After restarting the AppDaemon addon, Home Assistant will generate two entities. The first entity called ***binary_sensor.red_alert***, is the main sensor. This sensor will be **on** if there is a Red Alert in Israel, and **off** otherwise. The sensor also includes attributes that can serve various purposes, including category, ID, title, data, description, the number of active alerts, and emojis. 219 | 220 | The second entity, ***input_text.last_alert_in_israel*** is primarily designed for historical alert records on the logbook screen. Please be aware that Home Assistant has an internal character limit of 255 characters for text entities. This limitation means that during significant events, like a large-scale attack involving multiple areas or cities, some data may be truncated or lost. Therefore, it is highly discouraged to use the text input entity as a trigger for automations or to create sub-sensors from it. 221 | 222 | ## Verifying Sensor Functionality and Troubleshooting in AppDaemon 223 | To ensure that the sensor is functioning correctly, it is recommended to follow these steps after installing the script: 224 | 1. Access the AppDaemon web interface, which can be found on the main page of the add-on in Home Assistant, located to the right of the "start" button. If you are accessing this page from your local network, you can use the following link: http://homeassistant.local:5050/aui/index.html#/state?tab=apps (If the link is broken, replace "homeassistant.local" with your Home Assistant's IP address). 225 | 2. Within the state page, you can monitor the sensor to check if it is working as expected. 226 | ![Untitled-1](https://github.com/idodov/RedAlert/assets/19820046/664ece42-52bb-498b-8b3c-12edf41aaedb) 227 | 228 | In case the sensor isn't functioning properly, make sure to review the logs. You can access the logs from the main AppDaemon page on the screen. This will help you identify and resolve any issues or problems that may arise. 229 | ## binary_sensor.red_alert Attribues 230 | You can use any attribue from the sensor. For example, to show the title on lovelace card, use this code syntax: 231 | 232 | ```{{ state_attr('binary_sensor.red_alert', 'title') }}``` 233 | | Attribute name | Means | Example | 234 | | ----- | ----- | ----- | 235 | | cat | Category number. can be from 1 to 13 | 1 | 236 | | title | Attack type in text | ירי רקטות וטילים | 237 | | data | List of cities | תל אביב - מרכז העיר | 238 | | areas | List of areas | גוש דן | 239 | | desc | Explain what to do | היכנסו למרחב המוגן ושהו בו 10 דקות | 240 | | duration | How many seconds to be in the safe room | 600 | 241 | | id | Id of the alert | 133413399870000000 | 242 | | data_count | Number of cities that are attacked | 1 | 243 | | emoji | Icon for type of attack | 🚀 | 244 | | prev_* | Last data from each attribue | *stores the most recent information when the sensor was active. These attributes will become available after the first alert.* | 245 | 246 | ## Red Alert Trigger for Cities with Similar Character Patterns, Specific City, and Cities With Multiple Alert Zones 247 | Choosing the right method for binary sensors based on city names and alert zones is crucial. To distinguish similar city names, like "Yavne" and "Gan Yavne", it's better to use the SPLIT function instead of REGEX_SEARCH. 248 | 249 | For residents in cities with multiple alert zones: Ashkelon, Beersheba, Ashdod, Herzliya, Hadera, Haifa, Jerusalem, Netanya, Rishon Lezion, Ramat Gan, and Tel Aviv-Yafo - to set up triggers or sensors covering the entire city, it's recommended to use the REGEX_SEARCH function. This ensures they receive alerts for the whole city, even if it has multiple alert zones. This approach provides comprehensive coverage for these cities. 250 | ## Sample Trigger or Value Template for a Binary Sensor 251 | To create a sensor that activates only when an attack occurs in a specific city that has similar character patterns in other city names, you should use the following approach. For example, if you want to create a sensor that activates when **only** "יבנה" and **not** "גן יבנה" is attacked, you can use the following code syntax. 252 | ### Yavne city and not Gan-Yavne city 253 | ``` 254 | {{ "יבנה" in state_attr('binary_sensor.red_alert', 'data').split(', ') }} 255 | ``` 256 | ### Multiple cities or city areas 257 | ``` 258 | {{ "אירוס" in state_attr('binary_sensor.red_alert', 'data').split(', ') 259 | or "בית חנן" in state_attr('binary_sensor.red_alert', 'data').split(', ') 260 | or "גן שורק" in state_attr('binary_sensor.red_alert', 'data').split(', ') }} 261 | ``` 262 | ### Cities With Multiple Zones: 263 | In cities with multiple zones, relying solely on the SPLIT function won't be effective if you've only defined the city name. If you need a sensor that triggers for all zones within the 11 cities divided into multiple alert zones, it's advisable to utilize the SEARCH_REGEX function instead of splitting the data. 264 | ``` 265 | {{ state_attr('binary_sensor.red_alert', 'data') | regex_search("תל אביב") }} 266 | ``` 267 | If you want to trigger a specific area, use the SPLIT function and make sure to type the city name and area **exactly** as they appear in https://www.oref.org.il/12481-he/Pakar.aspx 268 | ``` 269 | {{ "תל אביב - מרכז העיר" in state_attr('binary_sensor.red_alert', 'data').split(', ') }} 270 | ``` 271 | ### Metropolitan Areas 272 | Israel is segmented into 30 metropolitan areas, allowing you to determine the general status of nearby towns without the need to specify each one individually. To achieve this, you can utilize the "areas" attribute. Here's the list of the 30 metropolitan areas in Israel, presented in alphabetical order: 273 | 274 | אילת, בקעה, בקעת בית שאן, גוש דן, גליל עליון, גליל תחתון, דרום הגולן, דרום הנגב, הכרמל, המפרץ, העמקים, השפלה, ואדי ערה, יהודה, ים המלח, ירושלים, ירקון, לכיש, מנשה, מערב הנגב, מערב לכיש, מרכז הגליל, מרכז הנגב, עוטף עזה, 275 | ערבה, צפון הגולן, קו העימות, שומרון, שפלת יהודה ושרון 276 | ``` 277 | {{ "גוש דן" in state_attr('binary_sensor.red_alert', 'areas').split(', ') }} 278 | ``` 279 | ## Red Alert Trigger for Particular Type of Alert: 280 | The **'cat'** attribute defines the alert type, with a range from 1 to 13. You have the option to set up a binary sensor for a particular type of alert with or without any city or area of your choice. 281 | | Cat (number) | Type of Alert | 282 | | ---- | --- | 283 | | 1 | Missle Attack | 284 | | 6 | Unauthorized Aircraft Penetration | 285 | | 13 | Infiltration of Terrorists | 286 | 287 | **Trigger for Automation** 288 | ``` 289 | {{ state_attr('binary_sensor.red_alert', 'cat') == '6' }} 290 | ``` 291 | ***Sample trigger alert for unauthorized aircraft penetration in Nahal-Oz*** 292 | ```yaml 293 | {{ state_attr('binary_sensor.red_alert', 'cat') == '6' 294 | and "נחל עוז" in state_attr('binary_sensor.red_alert', 'data').split(', ') }} 295 | ``` 296 | ## How to create a custom sub-sensor 297 | You can generate a new binary sensor to monitor your city within the user interface under **'Settings' > 'Devices and Services' > 'Helpers' > 'Create Helper' > 'Template' > 'Template binary sensor'** 298 | 299 | **Ensure that you employ the accurate syntax!** 300 | 301 | ![QQQ](https://github.com/idodov/RedAlert/assets/19820046/3d5e93ab-d698-4ce0-b341-6bee0e641e05) 302 | ## Usage *binary_sensor.red_alert* for Home Assistant 303 | ### Lovelace Card Example 304 | Displays whether there is an alert, the number of active alerts, and their respective locations. 305 | 306 | ![TILIM](https://github.com/idodov/RedAlert/assets/19820046/f8ad780b-7e64-4c54-ab74-79e7ff56b780) 307 | ```yaml 308 | type: markdown 309 | content: >- 310 |

{% if state_attr('binary_sensor.red_alert', 'data_count') > 0 %} 311 | כרגע יש {% if state_attr('binary_sensor.red_alert', 'data_count') > 1 %}{{ 312 | state_attr('binary_sensor.red_alert', 'data_count') }} התרעות פעילות{% elif 313 | state_attr('binary_sensor.red_alert', 'data_count') == 1 %} התרעה פעילה אחת{% 314 | endif %}{% else %} אין התרעות פעילות{% endif %}

315 | 316 | {% if state_attr('binary_sensor.red_alert', 'data_count') > 0 %}

{{ 317 | state_attr('binary_sensor.red_alert', 'emoji') }} {{ 318 | state_attr('binary_sensor.red_alert', 'title') }}

319 |

{{ state_attr('binary_sensor.red_alert', 'data') }}

320 | **{{ state_attr('binary_sensor.red_alert', 'desc') }}** {% endif %}
321 | title: Red Alert 322 | ``` 323 | Using this script, you have the flexibility to include additional information, such as the **precise time the alert was triggered**. 324 | 325 | ![TILIMA](https://github.com/idodov/RedAlert/assets/19820046/4ba18dde-ae0c-4415-a55d-80ed0c010cbc) 326 | ![LAST](https://github.com/idodov/RedAlert/assets/19820046/ae52bc94-46ba-4cdb-b92b-36220500ee48) 327 | ``` 328 | type: markdown 329 | content: >- 330 |

{% if state_attr('binary_sensor.red_alert', 'data_count') > 0 %} 331 | כרגע יש {% if state_attr('binary_sensor.red_alert', 'data_count') > 1 %}{{ 332 | state_attr('binary_sensor.red_alert', 'data_count') }} התרעות פעילות{% elif 333 | state_attr('binary_sensor.red_alert', 'data_count') == 1 %} התרעה פעילה אחת{% 334 | endif %}{% else %} אין התרעות פעילות{% endif %}

335 | 336 | {% if state_attr('binary_sensor.red_alert', 'data_count') > 0 %}

{{ 337 | state_attr('binary_sensor.red_alert', 'emoji') }} {{ 338 | state_attr('binary_sensor.red_alert', 'title') }}

{{ 339 | state_attr('binary_sensor.red_alert', 'data') }}

**{{ 340 | state_attr('binary_sensor.red_alert', 'desc') }}** {% endif %} 341 | 342 | {% if state_attr('binary_sensor.red_alert', 'last_changed') | 343 | regex_match("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\d{2}:\d{2}.\d+$") %} 344 | 345 | {% set last_changed_timestamp = state_attr('binary_sensor.red_alert', 346 | 'last_changed') | as_timestamp %} 347 | 348 | {% set current_date = now().date() %} 349 | 350 | {% if current_date == (last_changed_timestamp | timestamp_custom('%Y-%m-%d', 351 | true) 352 | | as_datetime).date() %} 353 | ההתרעה האחרונה נשלחה היום בשעה {{ last_changed_timestamp | timestamp_custom('%H:%M', true) }} 354 | {% else %}התרעה אחרונה נשלחה בתאריך {{ last_changed_timestamp | 355 | timestamp_custom('%d/%m/%Y', true) }}, בשעה {{ last_changed_timestamp | 356 | timestamp_custom('%H:%M', true) }} 357 | 358 | {% endif %} 359 | {% endif %} 360 |
361 | ``` 362 | **Another nicer way:** 363 | 364 | ![3333](https://github.com/idodov/RedAlert/assets/19820046/438c0870-56e8-461b-a1e5-aa24122a71bc) 365 | ![000000](https://github.com/idodov/RedAlert/assets/19820046/2d6da8d4-2f84-46d4-9f52-baffdbd4b54b) 366 | ``` 367 | type: markdown 368 | content: >- 369 | {% if state_attr('binary_sensor.red_alert', 'data_count') > 0 371 | %}כרגע יש {% if state_attr('binary_sensor.red_alert', 'data_count') > 1 %}{{ 372 | state_attr('binary_sensor.red_alert', 'data_count') }} התרעות פעילות{% elif 373 | state_attr('binary_sensor.red_alert', 'data_count') == 1 %} התרעה פעילה אחת{% 374 | endif %}{% else %}אין התרעות פעילות{% endif %}{% if 375 | state_attr('binary_sensor.red_alert', 'data_count') > 0 %} 376 | 377 | {{ state_attr('binary_sensor.red_alert', 'data') }} 379 | 380 | {{ state_attr('binary_sensor.red_alert', 381 | 'desc') }} 382 | 383 | {% endif %} 384 | 385 | {% if state_attr('binary_sensor.red_alert', 'last_changed') | 386 | regex_match("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\d{2}:\d{2}.\d+$") %} 387 | 388 | {% set last_changed_timestamp = state_attr('binary_sensor.red_alert', 389 | 'last_changed') | as_timestamp %} 390 | 391 | {% set current_date = now().date() %}{% if current_date == 392 | (last_changed_timestamp | timestamp_custom('%Y-%m-%d', true) 393 | | as_datetime).date() %}ההתרעה האחרונה נשלחה היום בשעה {{ last_changed_timestamp | timestamp_custom('%H:%M', true) }} 394 | {% else %}התרעה אחרונה נשלחה בתאריך {{ last_changed_timestamp | 395 | timestamp_custom('%d/%m/%Y', true) }}, בשעה {{ last_changed_timestamp | 396 | timestamp_custom('%H:%M', true) }}{% endif %}{% endif %} 397 | ``` 398 | ## Automation Examples 399 | You have the flexibility to generate various automated actions triggered by the binary sensor or its subsidiary sensors. As an example, one potential application is to dispatch alert messages to a LED matrix screen (in pic: forwarding all alerts to the Ulanzi Smart Clock, which is based on ESPHome32 and features a screen). 400 | 401 | ![20231013_210149](https://github.com/idodov/RedAlert/assets/19820046/0f88c82c-c87a-4933-aec7-8db425f6515f) 402 | 403 | ### Send a notification to the phone (Home Assistant app) when there is an alert in Israel (all cities) 404 | *(Change ```#your phone#``` to your entity name)* 405 | ```yaml 406 | alias: Notify attack 407 | description: "Real-time Attack Notification" 408 | trigger: 409 | - platform: state 410 | entity_id: 411 | - binary_sensor.red_alert 412 | from: "off" 413 | to: "on" 414 | condition: [] 415 | action: 416 | - service: notify.mobile_app_#your phone# 417 | data: 418 | message: "{{ state_attr('binary_sensor.red_alert', 'data') }}" 419 | title: "{{ state_attr('binary_sensor.red_alert', 'title') }} ב{{ state_attr('binary_sensor.red_alert', 'areas') }}" 420 | mode: single 421 | ``` 422 | ### Change the light color when there is an active alert in all areas of Tel Aviv 423 | As another illustration, you can configure your RGB lights to change colors repeatedly while the alert is active. 424 | 425 | ![20231013_221552](https://github.com/idodov/RedAlert/assets/19820046/6e60d5ca-12a9-4fd2-9b10-bcb19bf38a6d) 426 | 427 | *(Change ```light.#light-1#``` to your entity name)* 428 | ```yaml 429 | alias: Alert in TLV 430 | description: "When an alert occurs in Tel Aviv, the lights will cyclically change to red and blue for a duration of 30 seconds, after which they will revert to their previous states" 431 | trigger: 432 | - platform: template 433 | id: TLV 434 | value_template: >- 435 | {{ state_attr('binary_sensor.red_alert', 'data') | regex_search("תל אביב") }} 436 | condition: [] 437 | action: 438 | - service: scene.create 439 | data: 440 | scene_id: before_red_alert 441 | snapshot_entities: 442 | - light.#light-1# 443 | - light.#light-2# 444 | - light.#light-3# 445 | - repeat: 446 | count: 30 447 | sequence: 448 | - service: light.turn_on 449 | data: 450 | color_name: blue 451 | target: 452 | entity_id: 453 | - light.#light-1# 454 | - light.#light-2# 455 | - light.#light-3# 456 | - delay: 457 | hours: 0 458 | minutes: 0 459 | seconds: 0 460 | milliseconds: 500 461 | - service: light.turn_on 462 | data: 463 | color_name: red 464 | target: 465 | entity_id: 466 | - light.#light-1# 467 | - light.#light-2# 468 | - light.#light-3# 469 | - delay: 470 | hours: 0 471 | minutes: 0 472 | seconds: 0 473 | milliseconds: 500 474 | - service: scene.turn_on 475 | data: {} 476 | target: 477 | entity_id: scene.before_red_alert 478 | mode: single 479 | ``` 480 | ### Get notification when it's safe 481 | The "desc" attribute provides information on the duration in minutes for staying inside the safe room. This automation will generate a timer based on the data from this attribute. 482 | Before implementing this automation, it's essential to create a TIMER helper. 483 | 1. Create a new **TIMER helper**. You can generate a new timer entity within the user interface under **'Settings' > 'Devices and Services' > 'Helpers' > 'Create Helper' > 'Timer'** 484 | 2. Name it "**Oref Alert**". 485 | 3. Create automation with your desire trigger, 486 | **for example:** *(change ```#your phone#``` to your entity name)* 487 | ```yaml 488 | Alias: Safe to go out 489 | description: "Notify on phone that it's safe to go outside" 490 | mode: single 491 | trigger: 492 | - platform: template 493 | value_template: >- 494 | {{ "תל אביב - מרכז העיר" in state_attr('binary_sensor.red_alert', 495 | 'data').split(', ') }} 496 | condition: [] 497 | action: 498 | - service: timer.start 499 | data: 500 | duration: >- 501 | {{ state_attr('binary_sensor.red_alert', 'duration') }} 502 | target: 503 | entity_id: timer.red_alert 504 | - service: notify.mobile_app_#your phone# 505 | data: 506 | title: ההתרעה הוסרה 507 | message: אפשר לחזור לשגרה 508 | ``` 509 | ## Usage *input_text.last_alert_in_israel* for Home Assistant 510 | This entity stores the alert history for viewing on the logbook screen. 511 | ![logobok](https://github.com/idodov/RedAlert/assets/19820046/725e93bc-3c0d-4a1c-8310-a5db08568c26) 512 | 513 | You can use this entity as an automation trigger for demonstration purposes. However, it's important to note that it's strongly advised not to rely on this entity for creating sub-sensors or triggers in production scenarios. 514 | 515 | To trigger a check for any city, area name or title, you can use the following line of code: 516 | ``` 517 | {{ 'אור יהודה' in states('input_text.last_alert_in_israel') }} 518 | ``` 519 | Here's an example automation for demonstration purposes: 520 | ``` 521 | mode: single 522 | trigger: 523 | - platform: template 524 | value_template: | 525 | {{ 'אור יהודה' in states('input_text.last_alert_in_israel') }} 526 | condition: [] 527 | action: 528 | - service: light.turn_on 529 | data: 530 | flash: long 531 | rgb_color: 532 | - 255 533 | - 0 534 | - 0 535 | target: 536 | entity_id: light.#RGB_LIGHT# 537 | ``` 538 | To test it, navigate to the Developer Tools State screen and select the "input_text.last_alert_in_israel" entity. Here, you'll find the last historical data. If no alerts have occurred yet, you'll see a demo list of cities. 539 | 540 | ![eeeeee](https://github.com/idodov/RedAlert/assets/19820046/4b072463-19ff-4659-bf0e-9181f8e68e3d) 541 | 542 | To trigger your automation, clear the existing data and enter the city, area name or any word from the title you want to use as a trigger. Click **SET STATE** and the entity data will be updated, subsequently triggering your automation. 543 | 544 | It's important to note that while this approach may work for live data when alerts occur and function most of the time, **it's not recommended as the primary automation for alerts**, as it may not work reliably under all circumstances. 545 | _______ 546 | *This code is based on and inspired by https://gist.github.com/shahafc84/5e8b62cdaeb03d2dfaaf906a4fad98b9* 547 | -------------------------------------------------------------------------------- /hacs.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Red Alerts Israel", 3 | "render_readme": "true", 4 | "version": "3.0.0", 5 | "documentation": "https://github.com/idodov/RedAlert" 6 | } 7 | -------------------------------------------------------------------------------- /hebrew.md: -------------------------------------------------------------------------------- 1 | # התרעות פיקוד העורף במערכת HomeAssistant (AppDaemon) 2 | ***זהו אינו תוסף רשמי של פיקוד העורף.*** 3 | * לגרסה באנגלית https://github.com/idodov/RedAlert 4 | * מדריך שימוש: https://youtu.be/mlDJ1sKk0Y0 5 | ____ 6 | **הערות חשובות!** 7 | החל מגרסה 0.15.2 של תוסף AppDaemon, השתנה נתיב הקבצים, והוא אינו נגיש דרך תיקיית ה-config. כתוצאה מכך, תוספים כגון: "FILE EDITOR" יותרו ללא גישה. 8 | על מנת לגשת לקבצים נדרש להשתמש באמצעות פקודות SSH או תוספים כדוגמת SAMBA SHARE או VSCODE (מומלץ), ולגשת לתייקה **addon_configs**. 9 | 10 | במידה ובקובץ appdaemon.yaml קיימת שורת הקוד הבאה: 11 | ``` 12 | secrets: /config/secrets.yaml 13 | ``` 14 | נדרש להחליפה לשורת הקוד: 15 | ``` 16 | secrets: /homeassistant/secrets.yaml 17 | ``` 18 | בצילום מסך זה מוצג תוסף VSCODE. לחיצה על מקשי ctrl+o תפתח חלון בו יש לבחור את תיקיית **addon_configs** 19 | ![ac](https://github.com/idodov/RedAlert/assets/19820046/f249ae47-b5b7-4339-8b61-42321f754922) 20 | _____ 21 | 22 | **הסקריפט מייצר שתי ישויות חדשות ב-Home Assistant:** 23 | 1. יישות/חיישן בינארי בשם ***binary_sensor.oref_alert*** לאחסון נתוני פיקוד העורף. החיישן יכול לשמש באוטומציות או ליצירת תת חיישנים/חיישנים בינאריים ממנו. 24 | 2. ישות קלט טקסט בשם ***input_text.last_alert_in_israel*** לאחסון מידע ההתרעה העדכני, בעיקר למטרות תצוגת היסטוריית התרעות. 25 | 26 | החיישן הבינארי מספק אזהרה לכל האיומים שפיקוד העורף מתריע לגביהם לרבות: שיגורי רקטות וטילים, חדירת כלי טיס לא מורשים, רעידות אדמה, חששות צונאמי, חדירת מחבלים, תקריות חומרים מסוכנים, לוחמה לא קונבנציונלית וכל איום אחר. כאשר מתקבלת ההתרעה, אופי האיום יוצג (למשל, 'ירי רקטות וטילים'). 27 | 28 | בעוד שמצב החיישן הבינארי עובר ל'מופעל' כשיש התראה כלשהי פעילה בישראל, התנהגות אולי לא תתאים לכולם. החיישן בנוי עם תכונות נוספות המכילות נתונים כמו ערים, סוגי תקיפות ועוד. תכונות אלו מקלות על יצירת חיישני משנה מותאמים אישית כדי לעמוד בדרישות האישיות. לדוגמה, ניתן להגדיר חיישנים ספציפיים שיפעלו רק כאשר אזעקה נוגעת לסוג אירוע ו/או לעיר או אזור מסוים. 29 | ## מידע חשוב לפני ההתקנה 30 | שיטת התקנה זו **מסתמכת** על תוספים מפוקחים, הנגישים בלעדית בשימוש במערכת ההפעלה Home Assistant או בשיטת ההתקנה בפיקוח Home Assistant (ניתן גם לבחור להתקין את התוסף AppDaemon דרך Docker. לפרטים נוספים: https://appdaemon.readthedocs.io/en/latest/DOCKER_TUTORIAL.html). 31 | 32 | ## הוראות התקנה 33 | 1. תחילה יש להכנס אל מסך **ההגדרות**, לבחר **הרחבות** ומשם את **חנות ההרחבות** 34 | 2. בחנות ההרחבות יש לחפש הרחבה בשם **"AppDaemon"** (ואם לא מותקנת הרחבת FILE EDITOR, יש להתקינה ולהריץ אותה) 35 | 3. לאחר התקנת AppDaemon יש להפעיל מצב **כלב שמירה** ומצב **עדכון אוטומטי** (עדיין לא להריץ את ההרחבה) 36 | 4. יש לגשת ללשונית **תצורה** ולהוסיף תחת ההגדרה "Python packages" את ההגדרה "**requests**" 37 | 38 | ![Capture1](https://github.com/idodov/RedAlert/assets/19820046/d4e3800a-a59b-4605-b8fe-402942c3525b) 39 | 40 | 5. **כעת יש להריץ את ההרחבה** 41 | 6. באמצעות עורך קבצים יש לפתוח את הקובץ `addon_configs/appdaemon/appdaemon.yaml/` 42 | 7. יש לעדכן את הנתונים הבאים: 43 | את איזור הזמן (`time_zone`) יש לעדכן ל-"Asia/Jerusalem", את הגדרת קו הרוחב (`latitude`) יש לעדכן ל-"31.9837528", את הגדרת קו האורך (`longitude`) יש לעדכן ל-"34.7359077". 44 | ```yaml 45 | --- 46 | secrets: /homeassistant/secrets.yaml 47 | appdaemon: 48 | latitude: 31.9837528 49 | longitude: 34.7359077 50 | elevation: 2 51 | time_zone: Asia/Jerusalem 52 | plugins: 53 | HASS: 54 | type: hass 55 | http: 56 | url: http://127.0.0.1:5050 57 | admin: 58 | api: 59 | hadashboard: 60 | ``` 61 | 8. בעזרת עורך קבצים נדרש לנווט לתיקייה `addon_configs/appdaemon/apps/` ולהקים קובץ בשם **orefalert.py** אל תוכו להעתיק את הקוד הבא: 62 | 63 | *לתשומת ליבך, בקוד מוגדר שהסנסור יבדוק מידע מול פיקוד העורף **כל 2 שניות**. ניתן לשנות את הנתון `interval = 2` למספר אחר. לדוגמא 1 = שנייה, 0.5 = חצי שנייה.* 64 | ``` 65 | # UPDATE 31/10/2023 - Add Text Input entity 66 | import requests 67 | import re 68 | import time 69 | import json 70 | import codecs 71 | from datetime import datetime 72 | from appdaemon.plugins.hass.hassapi import Hass 73 | 74 | interval = 2 75 | 76 | class OrefAlert(Hass): 77 | def initialize(self): 78 | self.check_create_binary_sensor() 79 | self.run_every(self.poll_alerts, datetime.now(), interval, timeout=30) 80 | 81 | def check_create_binary_sensor(self): 82 | if not self.entity_exists("binary_sensor.oref_alert"): 83 | self.set_state("binary_sensor.oref_alert", state="off", attributes={ "id":"", "cat": "", "title": "", "desc": "", "data": "", "data_count": 0, "duration": 0, "last_changed": "", "prev_cat": 0, "prev_title": "מפוצצים את עזה", "prev_desc": "תישארו בחוץ", "prev_data" :"בית חאנון, בית לאהיא, בני סוהילה, ג'באליה, דיר אל-בלח, ח'אן יונס, עבסאן אל-כבירה, עזה, רפיח", "prev_data_count": 9,"prev_duration": 10, "prev_last_changed": datetime.now().isoformat()},) 84 | if not self.entity_exists("input_text.last_alert_in_israel"): 85 | self.set_state("input_text.last_alert_in_israel", state="ירי רקטות וטילים = בית חאנון, בית לאהיא, בני סוהילה, ג'באליה, דיר אל-בלח, ח'אן יונס, עבסאן אל-כבירה, עזה, רפיח", attributes={"min": 0, "max": 255, "mode": "text", "friendly_name": "Last Alert in Israel"},) 86 | 87 | def poll_alerts(self, kwargs): 88 | #url = "https://www.oref.org.il/WarningMessages/History/AlertsHistory.json" 89 | url = "https://www.oref.org.il/WarningMessages/alert/alerts.json" 90 | headers = { 91 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3', 92 | 'Referer': 'https://www.oref.org.il/', 93 | 'X-Requested-With': 'XMLHttpRequest', 94 | 'Content-Type': 'application/json', 95 | } 96 | lamas = {"areas":{"גליל עליון":{"אבו סנאן":{},"אור הגנוז":{},"אזור תעשייה בר-לב":{},"אזור תעשייה חצור הגלילית":{},"אזור תעשייה כרמיאל":{},"אזור תעשייה צ.ח.ר":{},"אזור תעשייה שער נעמן":{},"אחיהוד":{},"איילת השחר":{},"אליפלט":{},"אמירים":{},"אמנון":{},"אפק":{},"אשרת":{},"בוסתן הגליל":{},"ביריה":{},"בית ג'אן":{},"בית העמק":{},"בענה":{},"בר יוחאי":{},"ג'דידה מכר":{},"ג'וליס":{},"גדות":{},"גיתה":{},"דיר אל-אסד":{},"הר-חלוץ":{},"חולתה":{},"חצור הגלילית":{},"חרשים":{},"טובא זנגריה":{},"טל-אל":{},"ינוח-ג'ת":{},"יסוד המעלה":{},"יסעור":{},"ירכא":{},"כורזים ורד הגליל":{},"כחל":{},"כיסרא סמיע":{},"כישור":{},"כליל":{},"כמון":{},"כפר הנשיא":{},"כפר יסיף":{},"כפר מסריק":{},"כפר שמאי":{},"כרכום":{},"כרמיאל":{},"לבון":{},"לוחמי הגטאות":{},"לפידות":{},"מג'דל כרום":{},"מרכז אזורי מרום גליל":{},"מזרעה":{},"מחניים":{},"מירון":{},"מכמנים":{},"מנחת מחניים":{},"משמר הירדן":{},"נחף":{},"נס עמים":{},"נתיב השיירה":{},"סאג'ור":{},"ספסופה - כפר חושן":{},"עין אל אסד":{},"עין המפרץ":{},"עין כמונים":{},"עכו":{},"עכו - אזור תעשייה":{},"עמוקה":{},"עמיעד":{},"עמקה":{},"פלך":{},"פרוד":{},"צורית גילון":{},"צפת":{},"קדיתא":{},"קדרים":{},"ראמה":{},"ראש פינה":{},"רגבה":{},"שבי ציון":{},"שדה אליעזר":{},"שומרת":{},"שזור":{},"שייח' דנון":{},"שפר":{},"תובל":{}},"דרום הנגב":{"אבו קרינאת":{},"אבו תלול":{},"אורון תעשייה ומסחר":{},"אזור תעשייה דימונה":{},"אזור תעשייה רותם":{},"אל פורעה":{},"אשלים":{},"באר מילכה":{},"'ביר הדאג":{},"בית סוהר נפחא":{},"דימונה":{},"הר הנגב":{},"ואדי אל נעם דרום":{},"חירן":{},"טללים":{},"ירוחם":{},"כמהין":{},"כסייפה":{},"מדרשת בן גוריון":{},"ממשית":{},"מצפה רמון":{},"מרחב עם":{},"מרעית":{},"משאבי שדה":{},"ניצנה":{},"סעייה-מולדה":{},"עבדת":{},"עזוז":{},"ערד":{},"ערערה בנגב":{},"קדש ברנע":{},"קצר-א-סיר":{},"רביבים":{},"רתמים":{},"שאנטי במדבר":{},"שדה בוקר":{},"תל ערד":{}},"שפלת יהודה":{"אבו-גוש":{},"אביעזר":{},"אדרת":{},"אזור תעשייה ברוש":{},"אזור תעשייה הר טוב - צרעה":{},"אשתאול":{},"בית גוברין":{},"בית מאיר":{},"בית ניר":{},"בית נקופה":{},"בית שמש":{},"בקוע":{},"בר גיורא":{},"גבעות עדן":{},"גבעת יערים":{},"גבעת ישעיהו":{},"גיזו":{},"גלאון":{},"גפן":{},"הר אדר":{},"הראל":{},"זכריה":{},"זנוח":{},"טל שחר":{},"יד השמונה":{},"ישעי":{},"כסלון":{},"כפר אוריה":{},"כפר זוהרים":{},"כפר מנחם":{},"לוזית":{},"לטרון":{},"מבוא ביתר":{},"מחסיה":{},"מטע":{},"מסילת ציון":{},"מעלה החמישה":{},"נווה אילן":{},"נווה מיכאל - רוגלית":{},"נווה שלום":{},"נחושה":{},"נחם":{},"נחשון":{},"נטף":{},"נס הרים":{},"נתיב הל''ה":{},"עגור":{},"עין נקובא":{},"עין ראפה":{},"צובה":{},"צור הדסה":{},"צלפון":{},"צפרירים":{},"צרעה":{},"קריית יערים":{},"קריית ענבים":{},"רטורנו - גבעת שמש":{},"רמת רזיאל":{},"שדות מיכה":{},"שואבה":{},"שורש":{},"שריגים - ליאון":{},"תירוש":{},"תעוז":{},"תרום":{}},"מרכז הגליל":{"אבטליון":{},"אזור תעשייה תרדיון":{},"אעבלין":{},"אשבל":{},"אשחר":{},"בועיינה-נוג'ידאת":{},"ביר אלמכסור":{},"בית סוהר צלמון":{},"בית רימון":{},"דיר חנא":{},"דמיידה":{},"הררית יחד":{},"חוסנייה":{},"חזון":{},"חנתון":{},"טורעאן":{},"טמרה":{},"טפחות":{},"יובלים":{},"יודפת":{},"יעד":{},"כאבול":{},"כאוכב אבו אלהיג'א":{},"כלנית":{},"כפר חנניה":{},"כפר מנדא":{},"לוטם וחמדון":{},"מורן":{},"מורשת":{},"מנוף":{},"מסד":{},"מע'אר":{},"מעלה צביה":{},"מצפה אבי''ב":{},"מצפה נטופה":{},"מרכז אזורי משגב":{},"סכנין":{},"סלמה":{},"עוזייר":{},"עילבון":{},"עינבר":{},"עצמון - שגב":{},"עראבה":{},"ערב אל-נעים":{},"קורנית":{},"ראס אל-עין":{},"רומאנה":{},"רומת אל הייב":{},"רקפת":{},"שורשים":{},"שכניה":{},"שעב":{},"שפרעם":{}},"מנשה":{"אביאל":{},"אור עקיבא":{},"אזור תעשייה קיסריה":{},"אזור תעשייה רגבים":{},"אלוני יצחק":{},"בית חנניה":{},"בית ספר אורט בנימינה":{},"בנימינה":{},"ברקאי":{},"ג'סר א-זרקא":{},"גבעת חביבה":{},"גבעת עדה":{},"גן השומרון":{},"גן שמואל":{},"זכרון יעקב":{},"חדרה - מזרח":{},"חדרה - מערב":{},"חדרה - מרכז":{},"חדרה - נווה חיים":{},"כפר גליקסון":{},"כפר פינס":{},"להבות חביבה":{},"מאור":{},"מעגן מיכאל":{},"מעיין צבי":{},"מענית":{},"מרכז ימי קיסריה":{},"משמרות":{},"עין עירון":{},"עין שמר":{},"עמיקם":{},"פרדס חנה-כרכור":{},"קיסריה":{},"רמת הנדיב":{},"שדה יצחק":{},"שדות ים":{},"שער מנשה":{},"תלמי אלעזר":{}},"קו העימות":{"אביבים":{},"אבירים":{},"אבן מנחם":{},"אדמית":{},"אזור תעשייה אכזיב מילואות":{},"אזור תעשייה רמת דלתון":{},"אילון":{},"אלקוש":{},"בית הלל":{},"בית ספר שדה מירון":{},"בן עמי":{},"בצת":{},"ברעם":{},"ג'ש - גוש חלב":{},"גונן":{},"גורן":{},"גורנות הגליל":{},"געתון":{},"גשר הזיו":{},"דוב''ב":{},"דישון":{},"דלתון":{},"קיבוץ דן":{},"דפנה":{},"הגושרים":{},"הילה":{},"זרעית":{},"חוסן":{},"חורפיש":{},"חניתה":{},"יחיעם":{},"יערה":{},"יפתח":{},"יראון":{},"כברי":{},"כפר בלום":{},"כפר גלעדי":{},"כפר ורדים":{},"כפר יובל":{},"כפר סאלד":{},"כרם בן זמרה":{},"להבות הבשן":{},"לימן":{},"מרכז אזורי מבואות חרמון":{},"מטולה":{},"מלכיה":{},"מנות":{},"מנרה":{},"מעונה":{},"מעיין ברוך":{},"מעיליא":{},"מעלות תרשיחא":{},"מצובה":{},"מרגליות":{},"משגב עם":{},"מתת":{},"נאות מרדכי":{},"נהריה":{},"נווה זיו":{},"נטועה":{},"סאסא":{},"סער":{},"עבדון":{},"עברון":{},"ע'ג'ר":{},"עין יעקב":{},"עלמה":{},"עמיר":{},"ערב אל עראמשה":{},"פסוטה":{},"פקיעין":{},"צבעון":{},"צוריאל":{},"קריית שמונה":{},"ראש הנקרה":{},"ריחאנייה":{},"רמות נפתלי":{},"שאר ישוב":{},"שדה נחמיה":{},"שומרה":{},"שלומי":{},"שמיר":{},"שניר":{},"שתולה":{},"תל חי":{}},"לכיש":{"אביגדור":{},"אבן שמואל":{},"אורות":{},"אזור תעשייה באר טוביה":{},"אזור תעשייה כנות":{},"אזור תעשייה עד הלום":{},"אזור תעשייה קריית גת":{},"אזור תעשייה תימורים":{},"אחווה":{},"אחוזם":{},"איתן":{},"אל עזי":{},"אלומה":{},"אמונים":{},"אשדוד - א,ב,ד,ה":{},"אשדוד - איזור תעשייה צפוני":{},"אשדוד - ג,ו,ז":{},"אשדוד - ח,ט,י,יג,יד,טז":{},"אשדוד -יא,יב,טו,יז,מרינה,סיט":{},"באר טוביה":{},"ביצרון":{},"בית אלעזרי":{},"בית גמליאל":{},"בית חלקיה":{},"בית עזרא":{},"בן זכאי":{},"בני דרום":{},"בני עי''ש":{},"בני ראם":{},"בניה":{},"גבעת ברנר":{},"גבעת וושינגטון":{},"גבעתי":{},"גדרה":{},"גן הדרום":{},"גן יבנה":{},"גני טל":{},"גת":{},"ורדון":{},"זבדיאל":{},"זוהר":{},"זרחיה":{},"חפץ חיים":{},"חצב":{},"חצור":{},"יבנה":{},"יד בנימין":{},"יד נתן":{},"ינון":{},"כנות":{},"כפר אביב":{},"כפר אחים":{},"כפר הנגיד":{},"כפר הרי''ף וצומת ראם":{},"כפר ורבורג":{},"כפר מרדכי":{},"כרם ביבנה":{},"לכיש":{},"מישר":{},"מנוחה":{},"מעון צופיה":{},"מרכז שפירא":{},"משגב דב":{},"משואות יצחק":{},"מתחם בני דרום":{},"נגבה":{},"נהורה":{},"נוגה":{},"נווה מבטח":{},"נועם":{},"נחלה":{},"ניר בנים":{},"ניר גלים":{},"ניר ח''ן":{},"סגולה":{},"עוזה":{},"עוצם":{},"עזר":{},"עזריקם":{},"עין צורים":{},"ערוגות":{},"עשרת":{},"פארק תעשייה ראם":{},"פלמחים":{},"קבוצת יבנה":{},"קדמה":{},"קדרון":{},"קוממיות":{},"קריית גת, כרמי גת":{},"קריית מלאכי":{},"רבדים":{},"רווחה":{},"שדה דוד":{},"שדה יואב":{},"שדה משה":{},"שדה עוזיהו":{},"שדמה":{},"שחר":{},"שלווה":{},"שפיר":{},"שתולים":{},"תימורים":{},"תלמי יחיאל":{},"תלמים":{}},"שרון":{"אביחיל":{},"אבן יהודה":{},"אודים":{},"אורנית":{},"אזור תעשייה טירה":{},"אזור תעשייה עמק חפר":{},"אחיטוב":{},"אייל":{},"אליכין":{},"אלישיב":{},"אלישמע":{},"אלפי מנשה":{},"אלקנה":{},"אמץ":{},"ארסוף":{},"בארותיים":{},"בורגתה":{},"בחן":{},"בית ברל":{},"בית הלוי":{},"בית חזון":{},"בית חרות":{},"בית יהושע":{},"בית ינאי":{},"בית יצחק - שער חפר":{},"בית סוהר השרון":{},"ביתן אהרן":{},"בני דרור":{},"בני ציון":{},"בצרה":{},"בת חן":{},"בת חפר":{},"ג'לג'וליה":{},"גאולי תימן":{},"גאולים":{},"גבעת חיים איחוד":{},"גבעת חיים מאוחד":{},"גבעת חן":{},"גבעת שפירא":{},"גן חיים":{},"גן יאשיה":{},"גנות הדר":{},"גני עם":{},"געש":{},"הדר עם":{},"הוד השרון":{},"המעפיל":{},"המרכז האקדמי רופין":{},"העוגן":{},"זמר":{},"חבצלת השרון וצוקי ים":{},"חגור":{},"חגלה":{},"חופית":{},"חורשים":{},"חיבת ציון":{},"חניאל":{},"חרב לאת":{},"חרוצים":{},"חרות":{},"טייבה":{},"טירה":{},"יד חנה":{},"ינוב":{},"יעף":{},"יקום":{},"ירחיב":{},"ירקונה":{},"כוכב יאיר - צור יגאל":{},"כפר ברא":{},"כפר הס":{},"כפר הרא''ה":{},"כפר ויתקין":{},"כפר חיים":{},"כפר ידידיה":{},"כפר יונה":{},"כפר יעבץ":{},"כפר מונש":{},"כפר מל''ל":{},"כפר נטר":{},"כפר סבא":{},"כפר עבודה":{},"כפר קאסם":{},"מרכז אזורי דרום השרון":{},"מכון וינגייט":{},"מכמורת":{},"מעברות":{},"משמר השרון":{},"משמרת":{},"מתן":{},"נווה ימין":{},"נווה ירק":{},"נורדיה":{},"ניצני עוז":{},"ניר אליהו":{},"נירית":{},"נעורים":{},"נתניה - מזרח":{},"נתניה - מערב":{},"סלעית":{},"עדנים":{},"עולש":{},"עזריאל":{},"עין החורש":{},"עין ורד":{},"עין שריד":{},"עץ אפרים":{},"פורת":{},"פרדסיה":{},"צופים":{},"צופית":{},"צור יצחק":{},"צור משה":{},"צור נתן":{},"קדימה-צורן":{},"קלנסווה":{},"רמות השבים":{},"רמת הכובש":{},"רעננה":{},"רשפון":{},"שדה ורבורג":{},"שדי חמד":{},"שושנת העמקים":{},"שער אפרים":{},"שערי תקווה":{},"שפיים":{},"תחנת רכבת ראש העין":{},"תל יצחק":{},"תל מונד":{},"תנובות":{}},"ירושלים":{"אבן ספיר":{},"אורה":{},"בית זית":{},"גבעת זאב":{},"ירושלים - אזור תעשייה עטרות":{},"ירושלים - דרום":{},"ירושלים - כפר עקב":{},"ירושלים - מזרח":{},"ירושלים - מערב":{},"ירושלים - מרכז":{},"ירושלים - צפון":{},"מבשרת ציון":{},"מוצא עילית":{},"נבי סמואל":{},"עמינדב":{},"פנימיית עין כרם":{}},"דרום הגולן":{"אבני איתן":{},"אזור תעשייה בני יהודה":{},"אלוני הבשן":{},"אלי עד":{},"אלמגור":{},"אניעם":{},"אפיק":{},"אשדות יעקב איחוד":{},"אשדות יעקב מאוחד":{},"בני יהודה וגבעת יואב":{},"גשור":{},"האון":{},"חד נס":{},"חמת גדר":{},"חספין":{},"יונתן":{},"כנף":{},"כפר חרוב":{},"מבוא חמה":{},"מיצר":{},"מסדה":{},"מעגן":{},"מעלה גמלא":{},"נאות גולן":{},"נוב":{},"נטור":{},"עין גב":{},"קדמת צבי":{},"קצרין":{},"קצרין - אזור תעשייה":{},"קשת":{},"רמות":{},"רמת מגשימים":{},"שער הגולן":{},"תל קציר":{}},"שומרון":{"אבני חפץ":{},"אזור תעשייה בראון":{},"אזור תעשייה שער בנימין":{},"אחיה":{},"איתמר":{},"אלון מורה":{},"אריאל":{},"בית אל":{},"בית אריה":{},"בית חורון":{},"ברוכין":{},"ברקן":{},"גבע בנימין":{},"גבעת אסף":{},"גבעת הראל וגבעת הרואה":{},"דולב":{},"הר ברכה":{},"חוות גלעד":{},"חוות יאיר":{},"חיננית":{},"חלמיש":{},"חרמש":{},"חרשה":{},"טל מנשה":{},"טלמון":{},"יצהר":{},"יקיר":{},"כוכב השחר":{},"כוכב יעקב":{},"כפר תפוח":{},"מבוא דותן":{},"מגדלים":{},"מגרון":{},"מעלה לבונה":{},"מעלה מכמש":{},"מעלה שומרון":{},"נופי נחמיה":{},"נופים":{},"נחליאל":{},"ניל''י":{},"נעלה":{},"נריה":{},"עדי עד":{},"עופרים":{},"עטרת":{},"עלי":{},"עלי זהב":{},"עמיחי":{},"עמנואל":{},"ענב":{},"עפרה":{},"פדואל":{},"פסגות":{},"קדומים":{},"קידה":{},"קריית נטפים":{},"קרני שומרון":{},"רבבה":{},"רחלים":{},"ריחן":{},"רימונים":{},"שבות רחל":{},"שבי שומרון":{},"שילה":{},"שקד":{},"תל ציון":{}},"ים המלח":{"אבנת":{},"אלמוג":{},"בית הערבה":{},"בתי מלון ים המלח":{},"ורד יריחו":{},"מלונות ים המלח מרכז":{},"מצדה":{},"מצוקי דרגות":{},"מצפה שלם":{},"מרחצאות עין גדי":{},"מרכז אזורי מגילות":{},"נאות הכיכר":{},"נווה זוהר":{},"עין בוקק":{},"עין גדי":{},"עין תמר":{},"קליה":{}},"עוטף עזה":{"אבשלום":{},"אור הנר":{},"ארז":{},"בארי":{},"בני נצרים":{},"גבים, מכללת ספיר":{},"גברעם":{},"דקל":{},"זיקים":{},"זמרת, שובה":{},"חולית":{},"יבול":{},"יד מרדכי":{},"יכיני":{},"יתד":{},"כיסופים":{},"כפר מימון ותושיה":{},"כפר עזה":{},"כרם שלום":{},"כרמיה":{},"מבטחים, עמיעוז, ישע":{},"מגן":{},"מטווח ניר עם":{},"מפלסים":{},"נווה":{},"נחל עוז":{},"ניר יצחק":{},"ניר עוז":{},"נירים":{},"נתיב העשרה":{},"סופה":{},"סעד":{},"עין הבשור":{},"עין השלושה":{},"עלומים":{},"פרי גן":{},"צוחר, אוהד":{},"רעים":{},"שדה אברהם":{},"שדה ניצן":{},"שדרות, איבים, ניר עם":{},"שוקדה":{},"שלומית":{},"תלמי אליהו":{},"תלמי יוסף":{},"תקומה":{},"תקומה וחוות יזרעם":{}},"יהודה":{"אדורה":{},"אדוריים":{},"אזור תעשייה מישור אדומים":{},"אזור תעשייה מיתרים":{},"אלון":{},"אלון שבות":{},"אליאב":{},"אלעזר":{},"אמציה":{},"אפרת":{},"בית חגי":{},"בית יתיר":{},"ביתר עילית":{},"בני דקלים":{},"בת עין":{},"גבעות":{},"הר גילה":{},"הר עמשא":{},"חברון":{},"חוות שדה בר":{},"טנא עומרים":{},"כפר אדומים":{},"כפר אלדד":{},"כפר עציון":{},"כרמי צור":{},"כרמי קטיף":{},"כרמל":{},"מגדל עוז":{},"מיצד":{},"מעון":{},"מעלה אדומים":{},"מעלה חבר":{},"מעלה עמוס":{},"מעלה רחבעם":{},"מצפה יריחו":{},"נגוהות":{},"נווה דניאל":{},"נופי פרת":{},"נוקדים":{},"נטע":{},"סוסיא":{},"עלמון":{},"עשאהל":{},"עתניאל":{},"פני קדם":{},"קדר":{},"קרית ארבע":{},"ראש צורים":{},"שומריה":{},"שמעה":{},"שני ליבנה":{},"שקף":{},"תלם":{},"תקוע":{}},"צפון הגולן":{"אודם":{},"אורטל":{},"אל רום":{},"בוקעתא":{},"מג'דל שמס":{},"מסעדה":{},"מרום גולן":{},"נווה אטי''ב":{},"נמרוד":{},"עין זיוון":{},"עין קנייא":{},"קלע":{},"שעל":{}},"גליל תחתון":{"בית ירח":{},"אזור תעשייה צמח":{},"אזור תעשייה קדמת גליל":{},"אלומות":{},"אפיקים":{},"ארבל":{},"אתר ההנצחה גולני":{},"בית זרע":{},"גבעת אבני":{},"גינוסר":{},"דגניה א":{},"דגניה ב":{},"הודיות":{},"הזורעים":{},"המכללה האקדמית כנרת":{},"ואדי אל חמאם":{},"חוקוק":{},"טבריה":{},"יבנאל":{},"כינרת מושבה":{},"כינרת קבוצה":{},"כפר זיתים":{},"כפר חיטים":{},"כפר כמא":{},"כפר נהר הירדן":{},"לביא":{},"לבנים":{},"מגדל":{},"מצפה":{},"פוריה כפר עבודה":{},"פוריה נווה עובד":{},"פוריה עילית":{},"רביד":{},"שדה אילן":{},"שרונה":{}},"ואדי ערה":{"אום אל פחם":{},"אום אל קוטוף":{},"אזור תעשייה יקנעם עילית":{},"אזור תעשייה מבוא כרמל":{},"אל עריאן":{},"אליקים":{},"באקה אל גרבייה":{},"בית סוהר מגידו":{},"ברטעה":{},"ג'ת":{},"גבעת ניל''י":{},"גבעת עוז":{},"גלעד":{},"דליה":{},"חריש":{},"יקנעם המושבה והזורע":{},"יקנעם עילית":{},"כפר קרע":{},"קיבוץ מגידו":{},"מגל":{},"מדרך עוז":{},"מועאוויה":{},"מי עמי":{},"מייסר":{},"מעלה עירון":{},"מצפה אילן":{},"מצר":{},"משמר העמק":{},"עין אל-סהלה":{},"עין העמק":{},"עין השופט":{},"ערערה":{},"קציר":{},"רגבים":{},"רמות מנשה":{},"רמת השופט":{}},"העמקים":{"אום אל-גנם":{},"אורנים":{},"אזור תעשייה אלון התבור":{},"אזור תעשייה מבואות הגלבוע":{},"אזור תעשייה ציפורית":{},"אחוזת ברק":{},"אילניה":{},"אכסאל":{},"אל-ח'וואלד מערב":{},"אלון הגליל":{},"אלוני אבא":{},"אלונים":{},"בית לחם הגלילית":{},"בית סוהר שיטה וגלבוע":{},"בית קשת":{},"בית שערים":{},"בלפוריה":{},"בסמת טבעון":{},"קבוצת גבע":{},"גבעת אלה":{},"גבת":{},"גדעונה":{},"גזית":{},"גן נר":{},"גניגר":{},"דבוריה":{},"דברת":{},"דחי":{},"הושעיה":{},"היוגב":{},"הסוללים":{},"הרדוף":{},"זרזיר":{},"ח'וואלד":{},"חג'אג'רה":{},"טמרה בגלבוע":{},"יזרעאל":{},"יפיע":{},"יפעת":{},"ישובי אומן":{},"מרכז חבר":{},"ישובי יעל":{},"כדורי":{},"כעביה":{},"כעביה טבאש":{},"כפר ברוך":{},"כפר גדעון":{},"כפר החורש":{},"כפר טבאש":{},"כפר יהושע":{},"כפר יחזקאל":{},"כפר כנא":{},"כפר מצר":{},"כפר קיש":{},"כפר תבור":{},"כפר תקווה":{},"מגדל העמק":{},"מגן שאול":{},"מוקיבלה":{},"מזרע":{},"מנשית זבדה":{},"מרחביה מושב":{},"מרחביה קיבוץ":{},"משהד":{},"נעורה":{},"נהלל":{},"נופית":{},"נורית":{},"נין":{},"נצרת":{},"נוף הגליל":{},"סואעד חמירה":{},"סולם":{},"סנדלה":{},"עדי":{},"עילוט":{},"עין דור":{},"עין חרוד":{},"עין מאהל":{},"עפולה":{},"ציפורי":{},"קריית טבעון-בית זייד":{},"ראס עלי":{},"ריינה":{},"רם און":{},"רמת דוד":{},"רמת ישי":{},"רמת צבי":{},"שבלי":{},"שדה יעקב":{},"שדמות דבורה":{},"שמשית":{},"שער העמקים":{},"שריד":{},"תחנת רכבת כפר יהושוע":{},"תל יוסף":{},"תל עדשים":{},"תמרת":{}},"מרכז הנגב":{"אום בטין":{},"אזור תעשייה עידן הנגב":{},"אל סייד":{},"אשכולות":{},"אתר דודאים":{},"באר שבע - דרום":{},"באר שבע - מזרח":{},"באר שבע - מערב":{},"באר שבע - צפון":{},"בית קמה":{},"גבעות בר":{},"גבעות גורל":{},"דביר":{},"חורה":{},"חצרים":{},"כרמים":{},"כרמית":{},"להב":{},"להבים":{},"לקיה":{},"מיתר":{},"משמר הנגב":{},"מתחם צומת שוקת":{},"נבטים":{},"סנסנה":{},"עומר":{},"רהט":{},"שגב שלום":{},"שובל":{},"תל שבע":{},"תארבין":{}},"מערב הנגב":{"אופקים":{},"אורים":{},"אזור תעשייה נ.ע.מ":{},"אשבול":{},"אשל הנשיא":{},"בטחה":{},"בית הגדי":{},"ברור חיל":{},"ברוש":{},"גבולות":{},"גילת":{},"דורות":{},"דניאל":{},"זרועה":{},"חוות שיקמים":{},"יושיביה":{},"מבועים":{},"מסלול":{},"מעגלים, גבעולים, מלילות":{},"ניר משה":{},"ניר עקיבא":{},"נתיבות":{},"פדויים":{},"פטיש":{},"פעמי תש''ז":{},"צאלים":{},"קלחים":{},"קריית חינוך מרחבים":{},"רוחמה":{},"רנן":{},"שבי דרום":{},"שדה צבי":{},"שיבולים":{},"שרשרת":{},"תאשור":{},"תדהר":{},"תלמי ביל''ו":{},"תפרח":{}},"גוש דן":{"אור יהודה":{},"אזור":{},"בני ברק":{},"בת-ים":{},"גבעת השלושה":{},"גבעת שמואל":{},"גבעתיים":{},"גני תקווה":{},"גת רימון":{},"הרצליה - מערב":{},"הרצליה - מרכז וגליל ים":{},"חולון":{},"יהוד-מונוסון":{},"כפר סירקין":{},"כפר שמריהו":{},"מגשימים":{},"מעש":{},"מקווה ישראל":{},"מתחם פי גלילות":{},"סביון":{},"סינמה סיטי גלילות":{},"פתח תקווה":{},"קריית אונו":{},"רמת גן - מזרח":{},"רמת גן - מערב":{},"רמת השרון":{},"תל אביב - דרום העיר ויפו":{},"תל אביב - מזרח":{},"תל אביב - מרכז העיר":{},"תל אביב - עבר הירקון":{}},"המפרץ":{"אושה":{},"איבטין":{},"בית עלמין תל רגב":{},"החותרים":{},"חיפה - כרמל ועיר תחתית":{},"חיפה - מערב":{},"חיפה - נווה שאנן ורמות כרמל":{},"חיפה - קריית חיים ושמואל":{},"חיפה-מפרץ":{},"טירת כרמל":{},"יגור":{},"כפר ביאליק":{},"כפר גלים":{},"כפר המכבי":{},"כפר חסידים":{},"נשר":{},"קריית ביאליק":{},"קריית ים":{},"קריית מוצקין":{},"קריית אתא":{},"רכסים":{},"רמת יוחנן":{}},"ירקון":{"אזור תעשייה אפק ולב הארץ":{},"אזור תעשייה חבל מודיעין":{},"אלעד":{},"בארות יצחק":{},"בית נחמיה":{},"בית עריף":{},"בני עטרות":{},"ברקת":{},"גבעת כ''ח":{},"גמזו":{},"חדיד":{},"חשמונאים":{},"טירת יהודה":{},"כפר דניאל":{},"כפר האורנים":{},"כפר טרומן":{},"כפר רות":{},"לפיד":{},"מבוא חורון":{},"מבוא מודיעים":{},"מודיעין":{},"מודיעין - ישפרו סנטר":{},"מודיעין - ליגד סנטר":{},"מודיעין עילית":{},"מזור":{},"מתתיהו":{},"נוף איילון":{},"נופך":{},"נחלים":{},"נחשונים":{},"עינת":{},"ראש העין":{},"רינתיה":{},"שהם":{},"שילת":{},"שעלבים":{},"תעשיון חצב":{}},"מערב לכיש":{"אזור תעשייה הדרומי אשקלון":{},"אזור תעשייה צפוני אשקלון":{},"אשקלון - דרום":{},"אשקלון - צפון":{},"באר גנים":{},"בית שקמה":{},"ברכיה":{},"בת הדר":{},"גיאה":{},"הודיה":{},"חלץ":{},"כוכב מיכאל":{},"כפר סילבר":{},"מבקיעים":{},"משען":{},"ניצן":{},"ניצנים":{},"ניר ישראל":{},"תלמי יפה":{}},"הכרמל":{"אזור תעשייה ניר עציון":{},"בית אורן":{},"בית סוהר קישון":{},"בית צבי":{},"בת שלמה":{},"גבע כרמל":{},"גבעת וולפסון":{},"דור":{},"דלית אל כרמל":{},"הבונים":{},"יערות הכרמל":{},"כלא דמון":{},"כפר הנוער ימין אורד":{},"כרם מהר''ל":{},"מאיר שפיה":{},"מגדים":{},"מרכז מיר''ב":{},"נווה ים":{},"נחשולים":{},"ניר עציון":{},"עופר":{},"עין איילה":{},"עין הוד":{},"עין חוד":{},"עין כרמל":{},"עספיא":{},"עתלית":{},"פוריידיס":{},"צרופה":{}},"השפלה":{"אזור תעשייה נשר - רמלה":{},"אחיסמך":{},"אחיעזר":{},"אירוס":{},"באר יעקב":{},"בית דגן":{},"בית חנן":{},"בית חשמונאי":{},"בית עובד":{},"בית עוזיאל":{},"בן שמן":{},"גאליה":{},"גזר":{},"גיבתון":{},"גינתון":{},"גן שורק":{},"גן שלמה":{},"גנות":{},"גני הדר":{},"גני יוחנן":{},"זיתן":{},"חולדה":{},"חמד":{},"יגל":{},"יד רמב''ם":{},"יסודות":{},"יציץ":{},"ישרש":{},"כפר ביל''ו":{},"כפר בן נון":{},"כפר חב''ד":{},"כפר נוער בן שמן":{},"כפר שמואל":{},"כרמי יוסף":{},"לוד":{},"מזכרת בתיה":{},"מצליח":{},"משמר איילון":{},"משמר דוד":{},"משמר השבעה":{},"נטעים":{},"ניר צבי":{},"נס ציונה":{},"נען":{},"נצר חזני":{},"נצר סרני":{},"סתריה":{},"עזריה":{},"עיינות":{},"פארק תעשיות פלמחים":{},"פדיה":{},"פתחיה":{},"צפריה":{},"קריית עקרון":{},"ראשון לציון - מזרח":{},"ראשון לציון - מערב":{},"רחובות":{},"רמות מאיר":{},"רמלה":{},"תעשיון צריפין":{}},"בקעת בית שאן":{"אזור תעשייה צבאים":{},"בית אלפא וחפציבה":{},"בית השיטה":{},"בית יוסף":{},"בית שאן":{},"גשר":{},"חוות עדן":{},"חמדיה":{},"טייבה בגלבוע":{},"טירת צבי":{},"ירדנה":{},"כפר גמילה מלכישוע":{},"כפר רופין":{},"מולדת":{},"מירב":{},"מנחמיה":{},"מסילות":{},"מעוז חיים":{},"מעלה גלבוע":{},"נווה אור":{},"נוה איתן":{},"ניר דוד":{},"עין הנצי''ב":{},"רוויה":{},"רחוב":{},"רשפים":{},"שדה אליהו":{},"שדה נחום":{},"שדי תרומות":{},"שלוחות":{},"שלפים":{},"תל תאומים":{}},"אילת":{"אזור תעשייה שחורת":{},"אילות":{},"אילת":{}},"ערבה":{"אל עמארני, אל מסק":{},"אליפז ומכרות תמנע":{},"באר אורה":{},"גרופית":{},"חוות ערנדל":{},"חי-בר יטבתה":{},"חצבה":{},"יהל":{},"יטבתה":{},"כושי רמון":{},"לוטן":{},"נאות סמדר":{},"נווה חריף":{},"סמר":{},"ספיר":{},"עידן":{},"עין חצבה":{},"עין יהב":{},"עיר אובות":{},"פארן":{},"צופר":{},"צוקים":{},"קטורה":{},"שחרות":{},"שיטים":{}},"בקעה":{"ארגמן":{},"בקעות":{},"גיתית":{},"גלגל":{},"חמדת":{},"חמרה":{},"ייט''ב":{},"יפית":{},"מבואות יריחו":{},"מחולה":{},"מכורה":{},"מעלה אפרים":{},"משואה":{},"משכיות":{},"נעמה":{},"נערן":{},"נתיב הגדוד":{},"פצאל":{},"רועי":{},"רותם":{},"שדמות מחולה":{},"תומר":{}}}} 97 | icons = {1: "mdi:rocket-launch",2: "mdi:home-alert",3: "mdi:earth-box",4: "mdi:chemical-weapon",5: "mdi:waves",6: "mdi:airplane",7: "mdi:skull",8: "mdi:alert",9: "mdi:alert",10: "mdi:alert",11: "mdi:alert",12: "mdi:alert",13: "mdi:run-fast",} 98 | icon_alert = "mdi:alert" 99 | emojis = {1: "🚀",2: "⚠️",3: "🌍",4: "☢️",5: "🌊",6: "🛩️",7: "💀",8: "❗",9: "❗",10: "❗",11: "❗",12: "❗",13: "👣👹",} 100 | icon_emoji = "🚨" 101 | try: 102 | response = requests.get(url, headers=headers) 103 | if response.status_code == 200: 104 | response_data = codecs.decode(response.content, 'utf-8-sig') 105 | current_value = self.get_state("binary_sensor.oref_alert", attribute="prev_data") 106 | if response_data.strip(): 107 | try: 108 | data = json.loads(response_data) 109 | if 'data' in data and data['data']: 110 | alert_title = data.get('title', '') 111 | alerts_data = ', '.join(data['data']) 112 | icon_alert = icons.get(int(data.get('cat', 1)), "mdi:alert") 113 | icon_emoji = emojis.get(int(data.get('cat', 1)), "❗") 114 | if isinstance(alerts_data, str): 115 | data_count = len(alerts_data.split(',')) 116 | else: 117 | data_count = 0 118 | duration_match = re.findall(r'\d+', data.get('desc', '0')) 119 | if duration_match: 120 | duration = int(duration_match[0]) * 60 121 | else: 122 | duration = 0 123 | 124 | # Standardize lamas cities once globally 125 | for area, cities in lamas['areas'].items(): 126 | if isinstance(cities, str): 127 | cities = cities.split(',') 128 | standardized_cities = [re.sub(r'[\-\,\(\)\s]+', '', city).strip() for city in cities] 129 | lamas['areas'][area] = standardized_cities 130 | 131 | city_names = alerts_data.split(',') 132 | standardized_names = [re.sub(r'[\-\,\(\)\s]+', '', name).strip() for name in city_names] 133 | 134 | areas = [] 135 | 136 | for area, cities in lamas['areas'].items(): 137 | if any(city in cities for city in standardized_names): 138 | areas.append(area) 139 | 140 | areas.sort() 141 | 142 | if len(areas) > 1: 143 | all_but_last = ", ".join(areas[:-1]) 144 | areas_text = f"{all_but_last} ו{areas[-1]}" 145 | else: 146 | areas_text = areas[0] 147 | 148 | areas_text = areas_text.replace('השפלה', 'שפלה') 149 | areas_alert = areas_text 150 | 151 | 152 | if not current_value or current_value != alerts_data: 153 | self.set_state("binary_sensor.oref_alert", state="on", attributes={ 154 | "id": data.get('id', None), 155 | "cat": data.get('cat', None), 156 | "title": alert_title, 157 | "desc": data.get('desc', None), 158 | "areas": areas_alert, 159 | "data": alerts_data, 160 | "data_count": data_count, 161 | "duration": duration, 162 | "last_changed": datetime.now().isoformat(), 163 | "prev_cat": data.get('cat', None), 164 | "prev_title": alert_title, 165 | "prev_desc": data.get('desc', None), 166 | "prev_areas": areas_alert, 167 | "prev_data": alerts_data, 168 | "prev_data_count": data_count, 169 | "prev_duration": duration, 170 | "prev_last_changed": datetime.now().isoformat(), 171 | "icon": icon_alert, 172 | "emoji": icon_emoji, 173 | "friendly_name": alert_title, 174 | }, 175 | ) 176 | text_status = f"{alert_title} ב{areas_alert} - {alerts_data}" 177 | if len(text_status) > 255: 178 | text_status = text_status[:252] + "..." 179 | self.set_state("input_text.last_alert_in_israel", state=f"{text_status}", attributes={"icon": f"{icon_alert}"},) 180 | else: 181 | # Clear the sensor if there is no data in the response 182 | self.set_state( 183 | "binary_sensor.oref_alert", 184 | state="off", 185 | attributes={ 186 | "id": "", 187 | "cat": 0, 188 | "title": "אין התרעות", 189 | "desc": "", 190 | "data": "", 191 | "areas": "", 192 | "data_count": 0, 193 | "duration": 0, 194 | "emoji": icon_emoji, 195 | "icon": icon_alert, 196 | "friendly_name": "Oref Alert", 197 | }, 198 | ) 199 | except json.JSONDecodeError: 200 | self.log("Error: Invalid JSON format in the response.") 201 | icon_alert = "mdi:alert" 202 | else: 203 | # Clear the input_text and set binary_sensor state to off if there is no data in the response 204 | self.set_state( 205 | "binary_sensor.oref_alert", 206 | state="off", 207 | attributes={ 208 | "id": "", 209 | "cat": 0, 210 | "title": "אין התרעות", 211 | "desc": "", 212 | "data": "", 213 | "areas": "", 214 | "data_count": 0, 215 | "duration": 0, 216 | "icon": icon_alert, 217 | "emoji": icon_emoji, 218 | "friendly_name": "Oref Alert", 219 | }, 220 | ) 221 | else: 222 | self.log(f"Failed to retrieve data. Status code: {response.status_code}") 223 | except Exception as e: 224 | self.log(f"Error: {e}") 225 | ``` 226 | 9. יש לפתוח את הקובץ **apps.yaml** אשר נמצא בנתיב `addon_configs/appdaemon/apps/` ולהוסיף את השורות הבאות **ולשמור**: 227 | ```yaml 228 | orefalert: 229 | module: orefalert 230 | class: OrefAlert 231 | ``` 232 | 10. יש **להפעיל מחדש** את התוסף **appdaemon**. 233 | 234 | לאחר הפעלה מחדש של התוסף AppDaemon מערכת HOME ASSISTANT תפיק שתי ישויות. הישות הראשונה נקראת ***binary_sensor.oref_alert***, היא החיישן הראשי. חיישן זה יהיה **מופעל** אם יש התרעת צבע אדום בישראל, ו**כבוי** אחרת. החיישן כולל גם תכונות שיכולות לשרת מטרות שונות, כולל כותרת, נתונים, תיאור, מספר ההתראות הפעילות ואימוג'י. 235 | 236 | הישות השנייה, ***input_text.last_alert_in_israel*** מיועדת בעיקר לרשומות התרעות היסטוריות במסך היומן (Logbook). לתשומת לבכם, ל-Home Assistant יש מגבלת תווים פנימית של 255 תווים עבור ישויות טקסט. מגבלה זו פירושה שבמהלך אירועים משמעותיים, כמו התקפה בקנה מידה גדול הכוללת מספר אזורים וערים במקביל, חלק מהנתונים עלולים להיקטע. לכן, מאוד לא מומלץ להשתמש בישות קלט הטקסט כטריגר לאוטומציות או ליצור ממנה חיישני משנה. 237 | 238 | ## אימות פונקציונליות החיישן ופתרון בעיות ב-AppDaemon 239 | כדי להבטיח שהחיישן פועל כהלכה, מומלץ לבצע את השלבים הבאים לאחר התקנת הסקריפט: 240 | 1. גשו לממשק של AppDaemon, אותו ניתן למצוא בעמוד הראשי של התוסף ב-Home Assistant, ניתן לגשת לדף זה מהרשת המקומית בקישור הבא: http://homeassistant.local:5050/aui/index.html#/state?tab=apps (אם הקישור שבור, החלף את "homeassistant.local" עם כתובת ה-IP של Home Assistant שלך). 241 | 2. בתוך דף STATE, ניתן לנטר את החיישן כדי לבדוק אם הוא פועל כמצופה. 242 | ![Untitled-1](https://github.com/idodov/RedAlert/assets/19820046/664ece42-52bb-498b-8b3c-12edf41aaedb) 243 | 244 | ## חיישן בינארי binary_sensor.oref_alert 245 | ניתן להשתמש ו/או להציג כל תכונה בחיישן. לדוגמה, כדי להציג את הכותרת בכרטיסיית lovelace, יש להשתמש בתחביר הקוד הזה: 246 | ```{{ state_attr('binary_sensor.oref_alert', 'title') }}``` 247 | 248 | | שם הערך | משמעות | דוגמא | 249 | | ----- | ----- | ----- | 250 | | cat | מספר קטגוריה מ-1 עד 13 | 1 | 251 | | title | כותרת סוג ההתרעה | ירי רקטות וטילים | 252 | | data | רשימת ערים | תל אביב - מרכז העיר | 253 | | areas | רשימת אזורים | גוש דן | 254 | | desc | הסבר התגוננות | היכנסו למרחב המוגן ושהו בו 10 דקות | 255 | | duration | מספר שניות נדרש להיות במרחב המוגן | 600 | 256 | | id | מזהה התרעה מפיקוד העורף | 133413399870000000 | 257 | | data_count | מספר הערים המותקפות כעת | 1 | 258 | | emoji | צלמית| 🚀 | 259 | | prev_* | ערך האחרון שהתקבל | מידע זה יוצג לאחר שתהיה התרעה פעילה כלשהי | 260 | 261 | לאחר ההפעלה החיישן יהיה זמין לשימוש. תחילה החיישן יהיה במצב כבוי ללא נתונים, עד אשר תתקבל התרעה מפיקוד העורף. 262 | ## דוגמאות 263 | יש מספר דרכים להגדיר חיישנים נוספים או טריגרים לתרחישים. מאוד חשוב לשמור על כללי כתיבת הקוד, אחרת החיישן לא יעבוד תקין. 264 | ### עיר / איזור בעיר 265 | ``` 266 | {{ "יבנה" in state_attr('binary_sensor.oref_alert', 'data').split(', ') }} 267 | ``` 268 | ### מספר ערים / איזורים 269 | ``` 270 | {{ "אירוס" in state_attr('binary_sensor.oref_alert', 'data').split(', ') 271 | or "בית חנן" in state_attr('binary_sensor.oref_alert', 'data').split(', ') 272 | or "גן שורק" in state_attr('binary_sensor.oref_alert', 'data').split(', ') }} 273 | ``` 274 | ### ערים המחולקות לאזורים 275 | במידה ורוצים לקבל התרעה בכל האזורים בעיר (בישראל 11 ערים המחולקות לאזורים) 276 | ``` 277 | {{ state_attr('binary_sensor.oref_alert', 'data') | regex_search("תל אביב") }} 278 | ``` 279 | ## שימושים 280 | ### כרטיסייה 281 | לדוגמא לקוד המציג מידע על מספר התרעות פעילות, סוג ההתרעה, ערים והסבר התגוננות. 282 | ![TILIM](https://github.com/idodov/RedAlert/assets/19820046/f8ad780b-7e64-4c54-ab74-79e7ff56b780) 283 | 284 | ```yaml 285 | type: markdown 286 | content: >- 287 |

{% if state_attr('binary_sensor.oref_alert', 'data_count') > 0 %} 288 | כרגע יש {% if state_attr('binary_sensor.oref_alert', 'data_count') > 1 %}{{ 289 | state_attr('binary_sensor.oref_alert', 'data_count') }} התרעות פעילות{% elif 290 | state_attr('binary_sensor.oref_alert', 'data_count') == 1 %} התרעה פעילה אחת{% 291 | endif %}{% else %} אין התרעות פעילות{% endif %}

292 | 293 | {% if state_attr('binary_sensor.oref_alert', 'data_count') > 0 %}

{{ 294 | state_attr('binary_sensor.oref_alert', 'emoji') }} {{ 295 | state_attr('binary_sensor.oref_alert', 'title') }}

296 |

{{ state_attr('binary_sensor.oref_alert', 'data') }}

297 | **{{ state_attr('binary_sensor.oref_alert', 'desc') }}** {% endif %}
298 | title: Red Alert 299 | ``` 300 | ## תרחיש לדוגמא 301 | אפשר באמצעות החיישן לייצר מגוון רחב של תרחישים, לדוגמא - לשלוח התרעה למסך LED MATRIX כמו בדוגמא בתמונה. 302 | ![20231013_210149](https://github.com/idodov/RedAlert/assets/19820046/0f88c82c-c87a-4933-aec7-8db425f6515f) 303 | 304 | ### שליחת התרעה לטלפון בכל אירוע צבע אדום 305 | ```yaml 306 | alias: Notify attack 307 | description: "Real-time Attack Notification" 308 | trigger: 309 | - platform: state 310 | entity_id: 311 | - binary_sensor.oref_alert 312 | from: "off" 313 | to: "on" 314 | condition: [] 315 | action: 316 | - service: notify.mobile_app_#your phone# 317 | data: 318 | message: "{{ state_attr('binary_sensor.oref_alert', 'data') }}" 319 | title: "{{ state_attr('binary_sensor.oref_alert', 'emoji') }} {{ state_attr('binary_sensor.oref_alert', 'title') }}" 320 | mode: single 321 | ``` 322 | ### שינוי צבע האורות בבית במידה ויש אזעקה בעיר המחולקת לאזורים 323 | ![20231013_221552](https://github.com/idodov/RedAlert/assets/19820046/6e60d5ca-12a9-4fd2-9b10-bcb19bf38a6d) 324 | ```yaml 325 | alias: Alert in TLV 326 | description: "When an alert occurs in Tel Aviv, the lights will cyclically change to red and blue for a duration of 30 seconds, after which they will revert to their previous states" 327 | trigger: 328 | - platform: template 329 | id: TLV 330 | value_template: >- 331 | {{ state_attr('binary_sensor.oref_alert', 'data') | regex_search("תל אביב") }} 332 | condition: [] 333 | action: 334 | - service: scene.create 335 | data: 336 | scene_id: before_oref_alert 337 | snapshot_entities: 338 | - light.#light-1# 339 | - light.#light-2# 340 | - light.#light-3# 341 | - repeat: 342 | count: 30 343 | sequence: 344 | - service: light.turn_on 345 | data: 346 | color_name: blue 347 | target: 348 | entity_id: 349 | - light.#light-1# 350 | - light.#light-2# 351 | - light.#light-3# 352 | - delay: 353 | hours: 0 354 | minutes: 0 355 | seconds: 0 356 | milliseconds: 500 357 | - service: light.turn_on 358 | data: 359 | color_name: red 360 | target: 361 | entity_id: 362 | - light.#light-1# 363 | - light.#light-2# 364 | - light.#light-3# 365 | - delay: 366 | hours: 0 367 | minutes: 0 368 | seconds: 0 369 | milliseconds: 500 370 | - service: scene.turn_on 371 | data: {} 372 | target: 373 | entity_id: scene.before_oref_alert 374 | mode: single 375 | ``` 376 | -------------------------------------------------------------------------------- /info.md: -------------------------------------------------------------------------------- 1 | # Installation Instructions 2 | 1. Install the **AppDaemon** addon in Home Assistant by going to Settings > Add-ons > Ad-on-store and search for **AppDaemon**. 3 | 2. Once AppDaemon is installed, enable the **Auto-Start** and **Watchdog** options. 4 | 3. **Start** the add-on 5 | 4. In file editor open **\addon_configs\appdaemon\appdaemon.yaml** and make the changes under *appdeamon* section as described: 6 | > [!IMPORTANT] 7 | > You can locate your own coordinates (latitude & longitude) here: https://www.latlong.net/ 8 | > * `latitude: 31.9837528` 9 | > * `longitude: 34.7359077` 10 | > * `time_zone: Asia/Jerusalem`. 11 | > * If you install this script via HACS - **Specify the apps directory in `app_dir: /homeassistant/appdaemon/apps/`.** 12 | > * Also, remember to **transfer** all files from `/addon_configs/a0d7b954_appdaemon/apps/` to `/homeassistant/appdaemon/apps/`. 13 | > ```yaml 14 | > #/addon_configs/a0d7b954_appdaemon/appdaemon.yaml 15 | > --- 16 | > secrets: /homeassistant/secrets.yaml 17 | > appdaemon: 18 | > app_dir: /homeassistant/appdaemon/apps/ # If you install this script via HACS 19 | > latitude: 31.9837528 20 | > longitude: 34.7359077 21 | > elevation: 2 22 | > time_zone: Asia/Jerusalem 23 | > plugins: 24 | > HASS: 25 | > type: hass 26 | > http: 27 | > url: http://127.0.0.1:5050 28 | > admin: 29 | > api: 30 | > hadashboard: 31 | 32 | ### Manual Download 33 | 1. Download the Python file from [This Link](https://github.com/idodov/RedAlert/blob/main/apps/red_alerts_israel/red_alerts_israel.py). 34 | 2. Place the downloaded file inside the `appdaemon/apps` directory and proceed to the final step 35 | ### HACS Download 36 | 1. In Home Assistant: Navigate to `HACS > Automation` 37 | * If this option is not available, go to `Settings > Integrations > HACS > Configure` and enable `AppDaemon apps discovery & tracking`. After enabling, return to the main HACS screen and select `Automation` 38 | 2. Navigate to the `Custom Repositories` page and add the following repository as `Appdaemon`: `https://github.com/idodov/RedAlert/` 39 | 3. Return to the `HACS Automation` screen, search for `Red Alerts Israel`, click on `Download` and proceed to the final step 40 | ### Final Step 41 | In the `/appdaemon/apps/apps.yaml` file, add the following code. **Make sure to replace the city_names values as described below and save the file:** 42 | 43 | ```yaml 44 | #/appdaemon/apps/apps.yaml 45 | red_alerts_israel: 46 | module: red_alerts_israel 47 | class: Red_Alerts_Israel 48 | interval: 2 49 | timer: 120 50 | sensor_name: "red_alert" 51 | save_2_file: True 52 | city_names: 53 | - תל אביב - מרכז העיר 54 | - כיסופים 55 | ``` 56 | 57 | | Parameter | Description | Example | 58 | |---|---|---| 59 | | `interval` | The interval in seconds at which the script runs | `2` | 60 | | `timer` | The duration, in seconds, for which the sensor remains on after an alert | `120` | 61 | | `sensor_name` | The name of the primary binary sensor in Home Assistant (`binary_sensor.#sensor_name#`) | `red_alert` | 62 | | `save_2_file` | An option to save the alerts information in a text file | `True` | 63 | | `city_names` | The names of the cities that activate the second binary sensor that will be named `binary_sensor.#sensor_name#_city`. You can add as many cities you want | `תל אביב - מרכז העיר` | 64 | _______ 65 | ## YOU ARE ALL SET! 66 | Upon restarting the AppDaemon add-on, Home Assistant will create four entities: 67 | * The primary entity, `binary_sensor.red_alert`, activates when there’s a Red Alert in Israel and deactivates otherwise. This sensor also includes various attributes such as category, ID, title, data, description, the count of active alerts, and emojis. 68 | * The second entity, `binary_sensor.red_alert_city`, stores PIKUD-HA-OREF data and only activates if the defined city is included in the alert cities. 69 | * The third entity, `input_text.red_alert`, is mainly for recording historical alert data on the logbook screen. Please note that Home Assistant has a character limit of 255 for text entities. This means that during significant events, like large-scale attacks involving multiple areas or cities, some data might be truncated or lost. Hence, it’s not recommended to use this text input entity as a trigger for automations or to create sub-sensors from it. 70 | * The final entity, `input_boolean.red_alert`, when toggled on, sends false data to the sensor, which activates it for the period you defined in the `timer` value. 71 | 72 | ![red-alerts-sensors](https://github.com/idodov/RedAlert/assets/19820046/e0e779fc-ed92-4f4e-8e36-4116324cd089) 73 | 74 | > [!TIP] 75 | > To ensure the history of sensors is maintained after a restart in Home Assistant, it’s advisable to establish input text and boolean helpers. It’s best to do this prior to installation. Here’s how you can proceed: 76 | > 1. Open `configuration.yaml`. 77 | > 2. Add this lines and restart Home Assistant: 78 | > ```yaml 79 | > #/homeassistant/configuration.yaml 80 | > input_text: 81 | > red_alert: 82 | > name: Last Alert in Israel 83 | > min: 0 84 | > max: 255 85 | > 86 | > input_boolean: 87 | > red_alert_test: 88 | > name: Test Alert 89 | > icon: mdi:alert-circle 90 | > ``` 91 | --------------------------------------------------------------------------------