-
Notifications
You must be signed in to change notification settings - Fork 74
/
const.py
1181 lines (1166 loc) · 36.6 KB
/
const.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
"""Constants for Mail and Packages."""
from __future__ import annotations
from typing import Final
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntityDescription,
)
from homeassistant.components.sensor import SensorDeviceClass, SensorEntityDescription
from homeassistant.helpers.entity import EntityCategory
DOMAIN = "mail_and_packages"
DOMAIN_DATA = f"{DOMAIN}_data"
VERSION = "0.0.0-dev" # Now updated by release workflow
ISSUE_URL = "http://github.com/moralmunky/Home-Assistant-Mail-And-Packages"
PLATFORM = "sensor"
PLATFORMS = ["binary_sensor", "camera", "sensor"]
DATA = "data"
COORDINATOR = "coordinator_mail"
OVERLAY = ["overlay.png", "vignette.png", "white.png"]
SERVICE_UPDATE_FILE_PATH = "update_file_path"
CAMERA = "cameras"
# Attributes
ATTR_AMAZON_IMAGE = "amazon_image"
ATTR_COUNT = "count"
ATTR_CODE = "code"
ATTR_ORDER = "order"
ATTR_TRACKING = "tracking"
ATTR_TRACKING_NUM = "tracking_#"
ATTR_IMAGE = "image"
ATTR_IMAGE_PATH = "image_path"
ATTR_SERVER = "server"
ATTR_IMAGE_NAME = "image_name"
ATTR_EMAIL = "email"
ATTR_SUBJECT = "subject"
ATTR_BODY = "body"
ATTR_PATTERN = "pattern"
ATTR_USPS_MAIL = "usps_mail"
# Configuration Properties
CONF_ALLOW_EXTERNAL = "allow_external"
CONF_CAMERA_NAME = "camera_name"
CONF_CUSTOM_IMG = "custom_img"
CONF_CUSTOM_IMG_FILE = "custom_img_file"
CONF_FOLDER = "folder"
CONF_PATH = "image_path"
CONF_DURATION = "gif_duration"
CONF_SCAN_INTERVAL = "scan_interval"
CONF_IMAGE_SECURITY = "image_security"
CONF_IMAP_TIMEOUT = "imap_timeout"
CONF_GENERATE_MP4 = "generate_mp4"
CONF_AMAZON_FWDS = "amazon_fwds"
CONF_AMAZON_DAYS = "amazon_days"
CONF_VERIFY_SSL = "verify_ssl"
CONF_IMAP_SECURITY = "imap_security"
CONF_AMAZON_DOMAIN = "amazon_domain"
# Defaults
DEFAULT_CAMERA_NAME = "Mail USPS Camera"
DEFAULT_NAME = "Mail And Packages"
DEFAULT_PORT = "993"
DEFAULT_FOLDER = '"INBOX"'
DEFAULT_PATH = "custom_components/mail_and_packages/images/"
DEFAULT_IMAGE_SECURITY = True
DEFAULT_IMAP_TIMEOUT = 60
DEFAULT_GIF_DURATION = 5
DEFAULT_SCAN_INTERVAL = 30
DEFAULT_GIF_FILE_NAME = "mail_today.gif"
DEFAULT_AMAZON_FWDS = "(none)"
DEFAULT_ALLOW_EXTERNAL = False
DEFAULT_CUSTOM_IMG = False
DEFAULT_CUSTOM_IMG_FILE = "custom_components/mail_and_packages/images/mail_none.gif"
DEFAULT_AMAZON_DAYS = 3
DEFAULT_AMAZON_DOMAIN = "amazon.com"
# Amazon
AMAZON_DOMAINS = [
"amazon.com",
"amazon.ca",
"amazon.co.uk",
"amazon.in",
"amazon.de",
"amazon.it",
"amazon.com.au",
"amazon.pl",
"amazon.es",
"amazon.fr",
"amazon.ae",
"amazon.nl",
]
AMAZON_DELIVERED_SUBJECT = [
"Delivered: Your",
"Consegna effettuata:",
"Dostarczono:",
"Geliefert:",
"Livré",
"Entregado:",
"Bezorgd:",
]
AMAZON_SHIPMENT_TRACKING = [
"shipment-tracking",
"conferma-spedizione",
"confirmar-envio",
"versandbestaetigung",
"confirmation-commande",
"verzending-volgen",
"update-bestelling",
]
AMAZON_EMAIL = [
"order-update@",
"update-bestelling@",
]
AMAZON_PACKAGES = "amazon_packages"
AMAZON_ORDER = "amazon_order"
AMAZON_DELIVERED = "amazon_delivered"
AMAZON_IMG_PATTERN = (
"(https://)([\\w_-]+(?:(?:\\.[\\w_-]+)+))([\\w.,@?^=%&:/~+#-;]*[\\w@?^=%&/~+#-;])?"
)
AMAZON_HUB = "amazon_hub"
AMAZON_HUB_CODE = "amazon_hub_code"
AMAZON_HUB_EMAIL = [
"thehub@amazon.com",
"order-update@amazon.com",
"amazonlockers@amazon.com",
]
AMAZON_HUB_SUBJECT = "ready for pickup from Amazon Hub Locker"
AMAZON_HUB_SUBJECT_SEARCH = "(a package to pick up)(.*)(\\d{6})"
AMAZON_HUB_BODY = "(Your pickup code is <b>)(\\d{6})"
AMAZON_TIME_PATTERN = [
"will arrive:",
"estimated delivery date is:",
"guaranteed delivery date is:",
"Arriving:",
"Arriverà:",
"arriving:",
"Dostawa:",
"Zustellung:",
"Entrega:",
"A chegar:",
"Arrivée :",
"Verwachte bezorgdatum:",
]
AMAZON_TIME_PATTERN_END = [
"Previously expected:",
"This contains",
"Track your",
"Per tracciare il tuo pacco",
"View or manage order",
"Acompanhar",
"Seguimiento",
"Verfolge deine(n) Artikel",
"Lieferung verfolgen",
"Ihr Paket verfolgen",
"Suivre",
"Volg je pakket",
"Je pakket volgen",
]
AMAZON_EXCEPTION_SUBJECT = "Delivery update:"
AMAZON_EXCEPTION_BODY = "running late"
AMAZON_EXCEPTION = "amazon_exception"
AMAZON_EXCEPTION_ORDER = "amazon_exception_order"
AMAZON_PATTERN = "[0-9]{3}-[0-9]{7}-[0-9]{7}"
AMAZON_LANGS = [
"it_IT",
"it_IT.UTF-8",
"pl_PL",
"pl_PL.UTF-8",
"de_DE",
"de_DE.UTF-8",
"es_ES",
"es_ES.UTF-8",
"pt_PT",
"pt_PT.UTF-8",
"pt_BR",
"pt_BR.UTF-8",
"",
]
# Sensor Data
SENSOR_DATA = {
# USPS
"usps_delivered": {
"email": ["auto-reply@usps.com"],
"subject": ["Item Delivered"],
},
"usps_delivering": {
"email": ["auto-reply@usps.com"],
"subject": ["Expected Delivery on", "Out for Delivery"],
"body": ["Your item is out for delivery"],
},
"usps_exception": {
"email": ["auto-reply@usps.com"],
"subject": ["Delivery Exception"],
},
"usps_packages": {},
"usps_tracking": {"pattern": ["9[2345]\\d{15,26}"]},
"usps_mail": {
"email": [
"USPSInformedDelivery@usps.gov",
"USPSInformeddelivery@email.informeddelivery.usps.com",
"USPSInformeddelivery@informeddelivery.usps.com",
"USPS Informed Delivery",
],
"subject": ["Your Daily Digest"],
},
"usps_mail_delivered": {
"email": [
"USPSInformedDelivery@usps.gov",
"USPSInformeddelivery@email.informeddelivery.usps.com",
"USPSInformeddelivery@informeddelivery.usps.com",
"USPS Informed Delivery",
],
"subject": ["Your Mail Was Delivered"],
},
# UPS
"ups_delivered": {
"email": ["mcinfo@ups.com"],
"subject": [
"Your UPS Package was delivered",
"Your UPS Packages were delivered",
"Your UPS Parcel was delivered",
"Your UPS Parcels were delivered",
],
},
"ups_delivering": {
"email": ["mcinfo@ups.com"],
"subject": [
"UPS Update: Package Scheduled for Delivery Today",
"UPS Update: Follow Your Delivery on a Live Map",
"UPS Pre-Arrival: Your Driver is Arriving Soon! Follow on a Live Map",
"UPS Update: Parcel Scheduled for Delivery Today",
],
},
"ups_exception": {
"email": ["mcinfo@ups.com"],
"subject": ["UPS Update: New Scheduled Delivery Date"],
},
"ups_packages": {},
"ups_tracking": {"pattern": ["1Z?[0-9A-Z]{16}"]},
# FedEx
"fedex_delivered": {
"email": ["TrackingUpdates@fedex.com", "fedexcanada@fedex.com"],
"subject": [
"Your package has been delivered",
"Your packages have been delivered",
],
},
"fedex_delivering": {
"email": ["TrackingUpdates@fedex.com", "fedexcanada@fedex.com"],
"subject": [
"Delivery scheduled for today",
"Your package is scheduled for delivery today",
"Your package is now out for delivery",
"out for delivery today",
],
},
"fedex_packages": {},
"fedex_tracking": {"pattern": ["\\d{12,20}"]},
# Canada Post
"capost_delivered": {
"email": [
"donotreply@canadapost.postescanada.ca",
"donotreply-nepasrepondre@notifications.canadapost-postescanada.ca",
],
"subject": [
"Delivery Notification",
],
},
"capost_delivering": {},
"capost_packages": {},
"capost_tracking": {},
# DHL
"dhl_delivered": {
"email": [
"donotreply_odd@dhl.com",
"NoReply.ODD@dhl.com",
"noreply@dhl.de",
"pl.no.reply@dhl.com",
"support@dhl.com",
],
"subject": [
"DHL On Demand Delivery",
"Powiadomienie o przesyłce",
"Paket wurde zugestellt",
"DHL Shipment Notification",
],
"body": [
"has been delivered",
"została doręczona",
"ist angekommen",
'Notification for shipment event group "Delivered',
" - Delivered - ",
],
},
"dhl_delivering": {
"email": [
"donotreply_odd@dhl.com",
"NoReply.ODD@dhl.com",
"noreply@dhl.de",
"pl.no.reply@dhl.com",
"support@dhl.com",
],
"subject": [
"DHL On Demand Delivery",
"Paket kommt heute",
"Paket wird gleich zugestellt",
"Powiadomienie o przesyłce",
"DHL Shipment Notification",
],
"body": [
"scheduled for delivery TODAY",
"zostanie dziś do Państwa doręczona",
"wird Ihnen heute",
" - Shipment is out with courier for delivery - ",
"Shipment is scheduled for delivery",
"voraussichtlich innerhalb",
],
},
"dhl_packages": {},
"dhl_tracking": {"pattern": ["\\d{10,11}"]},
# Hermes.co.uk
"hermes_delivered": {
"email": ["donotreply@myhermes.co.uk"],
"subject": ["Hermes has successfully delivered your"],
},
"hermes_delivering": {
"email": [
"donotreply@myhermes.co.uk",
"noreply@paketankuendigung.myhermes.de",
],
"subject": [
"parcel is now with your local Hermes courier",
"Ihre Hermes Sendung",
],
"body": [
"Voraussichtliche Zustellung",
],
},
"hermes_packages": {},
"hermes_tracking": {"pattern": ["\\d{11,20}"]},
# Royal Mail
"royal_delivered": {
"email": ["no-reply@royalmail.com"],
"subject": ["has been delivered"],
},
"royal_delivering": {
"email": ["no-reply@royalmail.com"],
"subject": ["is on its way", "to be delivered today"],
},
"royal_packages": {},
"royal_tracking": {"pattern": ["[A-Za-z]{2}[0-9]{9}GB"]},
# Poczta Polska SA
"poczta_polska_delivered": {},
"poczta_polska_delivering": {
"email": ["informacja@poczta-polska.pl", "powiadomienia@allegromail.pl"],
"subject": ["Poczta Polska S.A. eINFO"],
},
"poczta_polska_packages": {},
"poczta_polska_tracking": {
# http://emonitoring.poczta-polska.pl/?numer=00359007738913296666
"pattern": ["\\d{20}"]
},
# InPost.pl
"inpost_pl_delivered": {
"email": [
"powiadomienia@inpost.pl",
"info@paczkomaty.pl",
"powiadomienia@allegromail.pl",
],
"subject": [
"InPost - Potwierdzenie odbioru",
"InPost - Paczka umieszczona w Paczkomacie",
],
},
"inpost_pl_delivering": {
"email": [
"powiadomienia@inpost.pl",
"info@paczkomaty.pl",
"powiadomienia@allegromail.pl",
],
"subject": [
"Kurier InPost: Twoja paczka jest w drodze",
"prawie u Ciebie",
],
},
"inpost_pl_packages": {},
"inpost_pl_tracking": {
# https://inpost.pl/sledzenie-przesylek?number=520113017830399002575123
"pattern": ["\\d{24}"]
},
# DPD Poland
"dpd_com_pl_delivered": {
"email": [
"KurierDPD0@dpd.com.pl",
"KurierDPD1@dpd.com.pl",
"KurierDPD2@dpd.com.pl",
"KurierDPD3@dpd.com.pl",
"KurierDPD4@dpd.com.pl",
"KurierDPD5@dpd.com.pl",
"KurierDPD6@dpd.com.pl",
"KurierDPD7@dpd.com.pl",
"KurierDPD8@dpd.com.pl",
"KurierDPD9@dpd.com.pl",
"KurierDPD10@dpd.com.pl",
"powiadomienia@allegromail.pl",
],
"subject": ["została doręczona"],
},
"dpd_com_pl_delivering": {
"email": [
"KurierDPD0@dpd.com.pl",
"KurierDPD1@dpd.com.pl",
"KurierDPD2@dpd.com.pl",
"KurierDPD3@dpd.com.pl",
"KurierDPD4@dpd.com.pl",
"KurierDPD5@dpd.com.pl",
"KurierDPD6@dpd.com.pl",
"KurierDPD7@dpd.com.pl",
"KurierDPD8@dpd.com.pl",
"KurierDPD9@dpd.com.pl",
"KurierDPD10@dpd.com.pl",
"powiadomienia@allegromail.pl",
],
"subject": [
"Bezpieczne doręczenie",
"przesyłka została nadana",
],
"body": ["Dziś doręczamy", "DPD Polska"],
},
"dpd_com_pl_packages": {},
"dpd_com_pl_tracking": {
# https://tracktrace.dpd.com.pl/parcelDetails?p1=13490015284111
"pattern": [
"\\d{13}[A-Z0-9]{1,2}",
],
},
# DPD
"dpd_delivered": {
"email": [
"noreply@service.dpd.de",
],
"subject": [
"Ihr Paket ist da!",
],
},
"dpd_delivering": {
"email": [
"noreply@service.dpd.de",
],
"subject": [
"Bald ist ihr DPD Paket da",
],
"body": [
"Paketnummer",
],
},
"dpd_packages": {},
"dpd_tracking": {
# https://tracktrace.dpd.com.pl/parcelDetails?p1=13490015284111
"pattern": [
"\\d{11,20}",
],
},
# GLS
"gls_delivered": {
"email": [
"noreply@gls-group.eu",
"powiadomienia@allegromail.pl",
],
"subject": [
"informacja o dostawie",
"wurde durch GLS zugestellt",
],
"body": [
"została dzisiaj dostarczona",
"Adresse erfolgreich zugestellt",
],
},
"gls_delivering": {
"email": [
"noreply@gls-group.eu",
"powiadomienia@allegromail.pl",
],
"subject": [
"paczka w drodze",
"ist unterwegs",
],
"body": [
"Zespół GLS",
"GLS-Team",
],
},
"gls_packages": {},
"gls_tracking": {
# https://gls-group.eu/GROUP/en/parcel-tracking?match=51687952111
"pattern": ["\\d{11,12}"]
},
# Australia Post
"auspost_delivered": {
"email": ["noreply@notifications.auspost.com.au"],
"subject": ["Your shipment has been delivered"],
},
"auspost_delivering": {
"email": ["noreply@notifications.auspost.com.au"],
"subject": ["is on its way", "is coming today"],
},
"auspost_packages": {},
"auspost_tracking": {"pattern": ["\\d{7,10,12}|[A-Za-z]{2}[0-9]{9}AU "]},
# Evri
"evri_delivered": {
"email": ["do-not-reply@evri.com"],
"subject": ["successfully delivered"],
},
"evri_delivering": {
"email": ["do-not-reply@evri.com"],
"subject": ["is now with your local Evri courier for delivery"],
},
"evri_packages": {},
"evri_tracking": {"pattern": ["H[0-9A-Z]{15}"]},
# DHL Parcel NL
"dhl_parcel_nl_delivered": {
"email": ["noreply@dhlparcel.nl"],
"subject": ["Je pakket is bezorgd"],
},
"dhl_parcel_nl_delivering": {
"email": ["noreply@dhlparcel.nl"],
"subject": ["We staan vandaag", "We staan vanavond"],
},
"dhl_parcel_nl_packages": {},
"dhl_parcel_nl_tracking": {"pattern": ["[0-9A-Z]{12,24}"]},
# Bonshaw Distribution Network
"bonshaw_distribution_network_delivered": {
"email": ["parcel_tracking@bonshawdelivery.com"],
"subject": ["Parcel Delivered! Commande Livrée!"],
},
"bonshaw_distribution_network_delivering": {
"email": ["parcel_tracking@bonshawdelivery.com"],
"subject": ["Parcel Out for Delivery! En attente de livraison!"],
},
"bonshaw_distribution_network_packages": {
"email": ["parcel_tracking@bonshawdelivery.com"],
"subject": ["Your package has been received!"],
},
"bonshaw_distribution_network_tracking": {"pattern": ["BNI[0-9]{9}"]},
# Purolator
"purolator_delivered": {
"email": ["NotificationService@purolator.com"],
"subject": ["Purolator - Your shipment is delivered"],
},
"purolator_delivering": {
"email": ["NotificationService@purolator.com"],
"subject": ["Purolator - Your shipment is out for delivery"],
},
"purolator_packages": {
"email": ["NotificationService@purolator.com"],
"subject": ["Purolator - Your shipment has been picked up"],
},
"purolator_tracking": {"pattern": ["\\d{12,15}"]},
# Intelcom
"intelcom_delivered": {
"email": ["notifications@intelcom.ca"],
"subject": ["Your order has been delivered!"],
},
"intelcom_delivering": {
"email": ["notifications@intelcom.ca"],
"subject": ["Your package is on the way!"],
},
"intelcom_packages": {
"email": ["notifications@intelcom.ca"],
"subject": ["Your package has been received!"],
},
"intelcom_tracking": {"pattern": ["INTLCMD[0-9]{9}"]},
# Walmart
"walmart_delivering": {
"email": ["help@walmart.com"],
"subject": ["Out for delivery"],
},
"walmart_delivered": {
"email": ["help@walmart.com"],
"subject": [
"Your order was delivered",
"Some of your items were delivered",
"Delivered:",
],
},
"walmart_exception": {
"email": ["help@walmart.com"],
"subject": ["delivery is delayed"],
},
"walmart_tracking": {"pattern": ["#[0-9]{7}-[0-9]{7,8}"]},
# BuildingLink
"buildinglink_delivered": {
"email": ["notify@buildinglink.com"],
"subject": [
"Your Amazon order has arrived",
"delivery has arrived",
"You have a package delivery",
"You have a delivery at the front desk",
"You have a DHL delivery",
"You have an envelope",
],
},
"buildinglink_tracking": {},
# Post NL
"post_nl_delivering": {
"email": ["noreply@notificatie.postnl.nl"],
"subject": ["Je pakket is onderweg", "De chauffer is onderweg"],
},
"post_nl_exception": {
"email": ["noreply@notificatie.postnl.nl"],
"subject": ["We hebben je gemist"],
},
"post_nl_delivered": {
"email": ["noreply@notificatie.postnl.nl"],
"subject": ["Je pakket is bezorgd"],
},
"post_nl_packages": {},
"post_nl_tracking": {"pattern": ["3S?[0-9A-Z]{14}"]},
# Post DE
"post_de_delivering": {
"email": [
"ankuendigung@brief.deutschepost.de",
],
"subject": [
"Ein Brief kommt in Kürze bei Ihnen an",
"Ein Brief ist unterwegs zu Ihnen",
],
},
"post_de_delivered": {},
"post_de_packages": {},
"post_de_tracking": {},
}
# Sensor definitions
SENSOR_TYPES: Final[dict[str, SensorEntityDescription]] = {
"mail_updated": SensorEntityDescription(
name="Mail Updated",
icon="mdi:update",
key="mail_updated",
entity_category=EntityCategory.DIAGNOSTIC,
device_class=SensorDeviceClass.TIMESTAMP,
),
# USPS
"usps_mail": SensorEntityDescription(
name="Mail USPS Mail",
native_unit_of_measurement="piece(s)",
icon="mdi:mailbox-up",
key="usps_mail",
),
"usps_delivered": SensorEntityDescription(
name="Mail USPS Delivered",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="usps_delivered",
),
"usps_delivering": SensorEntityDescription(
name="Mail USPS Delivering",
native_unit_of_measurement="package(s)",
icon="mdi:truck-delivery",
key="usps_delivering",
),
"usps_exception": SensorEntityDescription(
name="Mail USPS Exception",
native_unit_of_measurement="package(s)",
icon="mdi:archive-alert",
key="usps_exception",
),
"usps_packages": SensorEntityDescription(
name="Mail USPS Packages",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="usps_packages",
),
# UPS
"ups_delivered": SensorEntityDescription(
name="Mail UPS Delivered",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="ups_delivered",
),
"ups_delivering": SensorEntityDescription(
name="Mail UPS Delivering",
native_unit_of_measurement="package(s)",
icon="mdi:truck-delivery",
key="ups_delivering",
),
"ups_exception": SensorEntityDescription(
name="Mail UPS Exception",
native_unit_of_measurement="package(s)",
icon="mdi:archive-alert",
key="ups_exception",
),
"ups_packages": SensorEntityDescription(
name="Mail UPS Packages",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="ups_packages",
),
# FedEx
"fedex_delivered": SensorEntityDescription(
name="Mail FedEx Delivered",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="fedex_delivered",
),
"fedex_delivering": SensorEntityDescription(
name="Mail FedEx Delivering",
native_unit_of_measurement="package(s)",
icon="mdi:truck-delivery",
key="fedex_delivering",
),
"fedex_packages": SensorEntityDescription(
name="Mail FedEx Packages",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="fedex_packages",
),
# Amazon
"amazon_packages": SensorEntityDescription(
name="Mail Amazon Packages",
native_unit_of_measurement="package(s)",
icon="mdi:package",
key="amazon_packages",
),
"amazon_delivered": SensorEntityDescription(
name="Mail Amazon Packages Delivered",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="amazon_delivered",
),
"amazon_exception": SensorEntityDescription(
name="Mail Amazon Exception",
native_unit_of_measurement="package(s)",
icon="mdi:archive-alert",
key="amazon_exception",
),
"amazon_hub": SensorEntityDescription(
name="Mail Amazon Hub Packages",
native_unit_of_measurement="package(s)",
icon="mdi:package",
key="amazon_hub",
),
# Canada Post
"capost_delivered": SensorEntityDescription(
name="Mail Canada Post Delivered",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="capost_delivered",
),
"capost_delivering": SensorEntityDescription(
name="Mail Canada Post Delivering",
native_unit_of_measurement="package(s)",
icon="mdi:truck-delivery",
key="capost_delivering",
),
"capost_packages": SensorEntityDescription(
name="Mail Canada Post Packages",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="capost_packages",
),
# DHL
"dhl_delivered": SensorEntityDescription(
name="Mail DHL Delivered",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="dhl_delivered",
),
"dhl_delivering": SensorEntityDescription(
name="Mail DHL Delivering",
native_unit_of_measurement="package(s)",
icon="mdi:truck-delivery",
key="dhl_delivering",
),
"dhl_packages": SensorEntityDescription(
name="Mail DHL Packages",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="dhl_packages",
),
# Hermes
"hermes_delivered": SensorEntityDescription(
name="Mail Hermes Delivered",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="hermes_delivered",
),
"hermes_delivering": SensorEntityDescription(
name="Mail Hermes Delivering",
native_unit_of_measurement="package(s)",
icon="mdi:truck-delivery",
key="hermes_delivering",
),
"hermes_packages": SensorEntityDescription(
name="Mail Hermes Packages",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="hermes_packages",
),
# Royal Mail
"royal_delivered": SensorEntityDescription(
name="Mail Royal Mail Delivered",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="royal_delivered",
),
"royal_delivering": SensorEntityDescription(
name="Mail Royal Mail Delivering",
native_unit_of_measurement="package(s)",
icon="mdi:truck-delivery",
key="royal_delivering",
),
"royal_packages": SensorEntityDescription(
name="Mail Royal Mail Packages",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="royal_packages",
),
# Australia Post
"auspost_delivered": SensorEntityDescription(
name="Mail AusPost Delivered",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant",
key="auspost_delivered",
),
"auspost_delivering": SensorEntityDescription(
name="Mail AusPost Delivering",
native_unit_of_measurement="package(s)",
icon="mdi:truck-delivery",
key="auspost_delivering",
),
"auspost_packages": SensorEntityDescription(
name="Mail AusPost Packages",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="auspost_packages",
),
# Poczta Polska SA
# "poczta_polska_delivered": SensorEntityDescription(
# name="Poczta Polska Delivered",
# native_unit_of_measurement="package(s)",
# icon="mdi:package-variant",
# key="poczta_polska_delivered",
# ),
"poczta_polska_delivering": SensorEntityDescription(
name="Mail Poczta Polska Delivering",
native_unit_of_measurement="package(s)",
icon="mdi:truck-delivery",
key="poczta_polska_delivering",
),
"poczta_polska_packages": SensorEntityDescription(
name="Mail Poczta Polska Packages",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="poczta_polska_packages",
),
# InPost.pl
"inpost_pl_delivering": SensorEntityDescription(
name="Mail InPost.pl Delivering",
native_unit_of_measurement="package(s)",
icon="mdi:truck-delivery",
key="inpost_pl_delivering",
),
"inpost_pl_delivered": SensorEntityDescription(
name="Mail InPost.pl Delivered",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant",
key="inpost_pl_delivered",
),
"inpost_pl_packages": SensorEntityDescription(
name="Mail InPost.pl Packages",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="inpost_pl_packages",
),
# DPD Poland
"dpd_com_pl_delivering": SensorEntityDescription(
name="Mail DPD.com.pl Delivering",
native_unit_of_measurement="package(s)",
icon="mdi:truck-delivery",
key="dpd_com_pl_delivering",
),
"dpd_com_pl_delivered": SensorEntityDescription(
name="Mail DPD.com.pl Delivered",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant",
key="dpd_com_pl_delivered",
),
"dpd_com_pl_packages": SensorEntityDescription(
name="Mail DPD.com.pl Packages",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="dpd_com_pl_packages",
),
# DPD
"dpd_delivering": SensorEntityDescription(
name="Mail DPD Delivering",
native_unit_of_measurement="package(s)",
icon="mdi:truck-delivery",
key="dpd_delivering",
),
"dpd_delivered": SensorEntityDescription(
name="Mail DPD Delivered",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant",
key="dpd_delivered",
),
"dpd_packages": SensorEntityDescription(
name="Mail DPD Packages",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="dpd_packages",
),
# GLS
"gls_delivering": SensorEntityDescription(
name="Mail GLS Delivering",
native_unit_of_measurement="package(s)",
icon="mdi:truck-delivery",
key="gls_delivering",
),
"gls_delivered": SensorEntityDescription(
name="Mail GLS Delivered",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant",
key="gls_delivered",
),
"gls_packages": SensorEntityDescription(
name="Mail GLS Packages",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="gls_packages",
),
# Evri
"evri_delivered": SensorEntityDescription(
name="Mail Evri Delivered",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="evri_delivered",
),
"evri_delivering": SensorEntityDescription(
name="Mail Evri Delivering",
native_unit_of_measurement="package(s)",
icon="mdi:truck-delivery",
key="evri_delivering",
),
"evri_packages": SensorEntityDescription(
name="Mail Evri Packages",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="evri_packages",
),
# DHL Parcel NL
"dhl_parcel_nl_delivering": SensorEntityDescription(
name="DHL Parcel NL Delivering",
native_unit_of_measurement="package(s)",
icon="mdi:truck-delivery",
key="dhl_parcel_nl_delivering",
),
"dhl_parcel_nl_delivered": SensorEntityDescription(
name="DHL Parcel NL Delivered",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant",
key="dhl_parcel_nl_delivered",
),
"dhl_parcel_nl_packages": SensorEntityDescription(
name="DHL Parcel NL Packages",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="dhl_parcel_nl_packages",
),
# Bonshaw Distribution Network
"bonshaw_distribution_network_delivered": SensorEntityDescription(
name="Mail Bonshaw Distribution Network Delivered",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant",
key="bonshaw_distribution_network_delivered",
),
"bonshaw_distribution_network_delivering": SensorEntityDescription(
name="Mail Bonshaw Distribution Network Delivering",
native_unit_of_measurement="package(s)",
icon="mdi:truck-delivery",
key="bonshaw_distribution_network_delivering",
),
"bonshaw_distribution_network_packages": SensorEntityDescription(
name="Mail Bonshaw Distribution Network Packages",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="bonshaw_distribution_network_packages",
),
# Purolator
"purolator_delivered": SensorEntityDescription(
name="Mail Purolator Delivered",
native_unit_of_measurement="package(s)",
icon="mdi:package-variant",
key="purolator_delivered",
),
"purolator_delivering": SensorEntityDescription(