8/17/2018

Home Assistant :: Home Assistant Send Mail Gmail SMTP

Home Assistant :: Home Assistant Send Mail Gmail SMTP
1. Config configuration.yaml
  1. cd /home/homeassistant/.homeassistant
  1. nano configuration.yaml


2. Insert code notification and set Gmail user password
  1. notify:
  2.   - name: "SendMail"
  3.     platform: smtp
  4.     server: smtp.gmail.com
  5.     port: 587
  6.     timeout: 15
  7.     sender: scivalve.suwit@gmail.com
  8.     encryption: starttls
  9.     username: scivalve.suwit@gmail.com
  10.     password: Password Gmail
  11.     recipient:
  12.       - suwit.jph@gmail.com
  13.       - komkid@gmail.com
  14.       - seksan.kamt56@gmail.com
  15.     sender_name: My Home Assistant
  16.  


3. Test Send mail select service menu and select service we create on stab 2.
insert Service Data Optional And click CALL SERVICE check mail.
  1. {"message":"Test mail"}

4. Set Automation for send mail when track device ping down.
  1. nano automations.yaml

Add this code.
  1. - id: '1534491838266'
  2.   alias: CheckPingDown
  3.   trigger:
  4.   - entity_id: device_tracker.sonoff
  5.     platform: state
  6.   condition:
  7.   - after: '8:00'
  8.     before: '18:00'
  9.     condition: time
  10.   - condition: state
  11.     entity_id: device_tracker.sonoff
  12.     state: not_home
  13.   action:
  14.   - data:
  15.       message: Can't connect sonoff Garden. Please Check WIFI Or Sonoff.
  16.     service: notify.sendmail


https://www.home-assistant.io/components/notify.smtp/

Firefox :: Firefox ถามรหัส Proxy บ่อย ๆ

Firefox :: Firefox ถามรหัส Proxy บ่อย ๆ ใส่ไปแล้วสักพักขึ้นมาถามอีก ทั้ง ๆ ที่ใส่ Username และ Password ถูก
https://kb.globalscape.com/KnowledgebaseArticle10522.aspx

Firefox repeatedly prompts for proxy authentication

THE INFORMATION IN THIS ARTICLE APPLIES TO:
EFT Server (All versions)

SYMPTOM
When using Firefox through an ISA server, Firefox repeatedly prompts for proxy authentication, even though the correct credentials have been entered and applied.

RESOLUTION

To resolve this issue:

1. Open Firefox.
2. In the address bar, type about:config. A warning appears.

3. Click I'll be careful. I promise! A variety of configuration options appears.
4. In the Filter box, type network.negotiate.
5. Double-click network.negotiate-auth.allow-proxies to toggle between true and false. The option must be set to false. (It seems counterintuitive, but you set it to false to make it work with the ISA proxy.)

6. Click the Home icon to close the configuration window.

Pi-Hole :: Pi-hole Update Version

Pi-Hole :: Pi-hole Update Version
1. Back Up Snapshots On Vmware
2. Run Command
  1. pihole -up




8/15/2018

Ubuntu :: Ubuntu set track ping to other host. For check online or down.

Ubuntu :: Ubuntu set track ping to other host. For check online or down.
Use php and bash shell run crontab. On Ubuntu 18.04
1. Install software.
  1. sudo apt-get install apache2

  1. sudo apt install php libapache2-mod-php

  1. sudo apt-get install ssmtp mailutils mpack


2. Set timezone.
List
  1. timedatectl list-timezones

Set
  1. timedatectl set-timezone Asia/Bangkok


3. Create file php.
  1. nano /var/www/check-sonoff.php

insert code
  1.  
  2. <?php
  3. $strDateTime = date("Y-m-d H:i:s");
  4.  
  5. $strToPost = "\nFrom Home Assistan : {$strDateTime} \n";
  6. $ret = mail("komkid@gmail.com,suwit.jph@gmail.com,seksan.kamt56@gmail.com", "Internet Test Speed is low. Please Check Internet Connection.", $strToPost, "From: Proxy Server\n");$
  7. //$ret = mail("suwit.jph@gmail.com", "Can't connect sonoff Garden. Please Check WIFI Or Sonoff.", $strToPost, "From: Home Assistan \n");
  8.  
  9. ?>


4. Config send mail.
backup original file.
  1. cp /etc/ssmtp/ssmtp.conf ssmtp.conf.backup
  1. nano /etc/ssmtp/ssmtp.conf

replace all code.
  1. #
  2. # Config file for sSMTP sendmail
  3. #
  4. # The person who gets all mail for userids < 1000
  5. # Make this empty to disable rewriting.
  6. #root=postmaster
  7. root=scivalve.suwit@gmail.com
  8.  
  9. # The place where the mail goes. The actual machine name is required no
  10. # MX records are consulted. Commonly mailhosts are named mail.domain.com
  11. mailhub=mail
  12. mailhub=smtp.gmail.com:587
  13.  
  14. # Where will the mail seem to come from?
  15. #rewriteDomain=
  16.  
  17. # The full hostname
  18. #hostname=scivalve.suwit@gmail.com
  19. hostname=localhost
  20.  
  21. # Are users allowed to set their own From: address?
  22. # YES - Allow the user to specify their own From: address
  23. # NO - Use the system generated From: address
  24. #FromLineOverride=YES
  25.  
  26. AuthUser=MAIL GMAIL
  27. AuthPass=PASSWORD
  28. useSTARTTLS=YES
  29.  
  30. TLS_CA_File=/etc/ssl/certs/ca-certificates.crt


5. Test send mail.
  1. /usr/bin/php /var/www/check-sonoff.php


6. Create file for check ping to other server.
  1. nano check-sonoff.sh

insert code.
  1. #!/bin/bash
  2. SERVERIP=192.168.0.210
  3.  
  4. ping -c 3 $SERVERIP > /dev/null 2>&1
  5. if [ $? -ne 0 ]
  6. then
  7.    # Call php file send mail here:
  8.    /usr/bin/php /var/www/check-sonoff.php
  9. fi


7. Test sell.
  1. bash check-sonoff.sh


8. Set crontab. run bash file.
  1. #Check Ping Sonoff Every 1 Hours
  2. 0 8-18 * * 1-6 bash /check-sonoff.sh


https://unix.stackexchange.com/questions/56340/bash-script-to-detect-when-my-server-is-down-or-offline
https://askubuntu.com/questions/3375/how-to-change-time-zone-settings-from-the-command-line

Ubuntu :: PDFSam On Mint 19

Ubuntu :: PDFSam On Mint 19
1. ติดตั้ง PDFSam จาก Software Manager (ติดตั้งเสร็จจะ Run ไม่ได้) เพราะ ยังไม่ได้ติดตั้ง JAVA
ติดตั้งผ่านคำสั่งไม่ได้ ERROR Download File ไม่ได้
  1. apt-get install oracle-java8-installer

ต้องติดตั้งเอง Manual
2. Download java จาก เป็นตัว Ubuntu Linux x64
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
หรือ
\\datacenter\Software\#Freeware\Framework\Java8
ได้ไฟล์ jdk-8u181-linux-x64.tar.gz มา
3. Extract file
  1. [code]tar -zxvf jdk-8u181-linux-x64.tar.gz[/code]

4. Create folder.
  1. mkdir -p /opt/java

5. Move file to folder /opt/java
  1. mv jdk1.8.0_181/ /opt/java

6. Install Java
  1. update-alternatives --install "/usr/bin/java" "java" "/opt/java/jdk1.8.0_181/bin/java" 1

7. Make JDK system default.
update-alternatives --set java /opt/java/jdk1.8.0_181/bin/java
8. Test installed java version. Show this.
  1. java -version

java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

9. Test open PDFSam worked.

This Link:
https://community.linuxmint.com/tutorial/view/1372

Axapta :: Axapta เลือกข้อมูลหน้า Onhand หลาย ๆ แถว จาก InventSum หลาย ๆ แถว

Axapta :: Axapta เลือกข้อมูลหน้า Onhand หลาย ๆ แถว จาก InventSum หลาย ๆ แถว
Form อื่น Table อื่นเดิมใช้ Code แบบนี้แต่ใช้ กับ InventSum แล้วไม่ออกได้แถวเดียวบรรทัดสุดท้ายที่เลือก
  1.    InventSum               myInventSum;
  2.     ;
  3.     for (myInventSum = InventSum_ds.getFirst(true) ? InventSum_ds.getFirst(true) : InventSum_ds.cursor();
  4.          myInventSum;
  5.          myInventSum = InventSum_ds.getNext())
  6.     {
  7.         print myInventSum.ItemId;
  8.     }


Code ที่ใช้งานได้กับ Form Onhand InventSum กรณีต้องการ Select หลาย ๆ Item แล้วนำ Item ไปใช้งานต่อ
  1.    InventSum               myInventSum;
  2.     Common                  inventSumCommon;
  3.     ;
  4.     for(inventSumCommon = InventSum_ds.getFirst(1).TableId != tablenum(Common) ?
  5.         InventSum_ds.getFirst(1) : InventSum_ds.cursor();
  6.         inventSumCommon.TableId != tablenum(Common);
  7.         inventSumCommon = InventSum_ds.getNext())
  8.     {
  9.         myInventSum = inventSumCommon;
  10.         print myInventSum.ItemId;
  11.     }



https://axapta.mazzy.ru/forums/showthread.php?p=65533