Smart Home Automation with Linux- P18

Smart Home Automation with Linux- P18:I will end on a note of carefree abandon—learn to steal! Once you’ve learned the pieces of the puzzle and how to combine them, there is very little new to invent. Every new idea you discover is a mere permutation of the old ideas. And ideas are free! Every cool feature discussed on TV shows or presented in the brochures or web sites of commercial HA companies can be taken, adapted, and implemented with the information presented here using very little effort | CHAPTER 5 COMMUNICATION In Chapter 7 you ll learn how to extend this functionality to support a basic address book and multiple receivers. Autoprocessing E-mails Accepting e-mails on behalf of a program instead of a human user can be summed up in one word Procmail was a project begun in 1990 by Stephen R. van den Berg to control the delivery of email messages and although some consider it a dead project this makes it a stable project and one that s unlikely to break or introduce new complications anytime soon Procmail is triggered by the e-mail server an MTA such as Exim by passing each message for further processing to each of a series of recipes. If none of these recipes lays claim to the message it is delivered as normal. I ll begin by creating a simple example whereby you can e-mail your bedroom light switch. So create a user with the following and fill in all the necessary user details adduser bedroom Then create a .procmailrc file note the dot in their home directory and add the following recipe code 0 AFrom steev ASubject light on heyu turn bedroom_light on This requires that the sender is steev4 5 and that the subject is light on before it runs the heyu command to control the light. Both conditions must be met. You can and should extend these arguments to include the full e-mail address to prevent any steev from having control over the light and perhaps a regular expression to make the subject line case insensitive. But before we continue I ll break down those elements. Each recipe consists of three parts Mode This is generally 0 but can also include instructions for locking so that the recipe cannot be run multiple times simultaneously by appending another colon with the name of a lock file for example 0 mylock . Conditions Zero or more lines beginning with an asterisk indicating how the email must appear for processing to occur. This also supports regular expressions. Since every condition must be satisfied in an AND logical fashion you can .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
11    429    1    10-05-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.