/www/web/default/bish-bosh/bish-bosh --port 18883 --verbose 2 -- /www/web/default/bish-bosh/r01 & 1>>/www/web/default/bish-bosh/qqq1 2>>/www/web/default/bish-bosh/qqq2 mosquitto_pub -h 119.29.34.98 -p 18883 -u user1 -P u1234 -t R769000001 -m tR769000001 mosquitto_pub -h 119.29.34.98 -p 18883 -u user1 -P u1234 -t R769000002 -m tR769000002 Mosquitoo 20171117 改 listsen port 1883->18883 + port 1883 mapping ->18883 ps aux|grep -i 'bish-bosh' (查出執行 kill -9 第二排的id數字) 背景執行後按enter 要加--port (r01中要加user+psw,不可以有output echo否則ssh斷線就退出停止) 2>>bb_err_log 將stderr輸出到bb_err_log /www/web/default/bish-bosh/bish-bosh 2>>/www/web/default/bish-bosh/bb_err_log --port 18883 --verbose 2 -- /www/web/default/bish-bosh/r01 & Mosquitoo 密碼表 /etc/mosquitto/mqtt.acl 要加上允許的topic,否則無法收發 user user1 topic readwrite R769 topic readwrite R769000001 topic readwrite R769000002 topic readwrite R769000003 再 cp /www/web/default/bish-bosh/mqtt.acl /etc/mosquitto/mqtt.acl 重 run一次mosquitto ps aux|grep -i 'mos' 找到PID號碼(目前執行這個是 26531), kill 那個 pid, (kill 26531) 重新執行 /usr/local/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf -d /var/spool/cron/crontabs/root 加 30 0 * * * /www/wdlinux/apache_php-5.5.38/bin/php /www/web/zjr/public_html/dv-m/mqtt-tool-tds.php > /dev/null 2>&1 /www/web/zjr/public_html/dv-m/mqtt-tool-tds.php->每天00:30定時發出TDS請求 /etc/init.d/cron restart -> 重新啟動 A1,A2 吸頂路由 192.168.188.253 admin+admin->admin+aa223344 萬能中續模式->上(11)下(4)WIFI信道不可以相同 水星小路由 192.168.100.1 admin+admin->admin+aa22334 开启上网控制 缺省过滤规则 凡是符合已设上网控制规则的数据包,允许通过本路由器 三規則: 119.29.34.98 qq.com weixin.qq.com wx.qq.com suanok.com water.suanok.com wr_z_promo_log g10->g20->g21->g30->g31->g32->wallet 抽1->抽2->獎2->抽3手機->抽3->獎3->支付 g40->抽完后返回 白色卡托 WGate0001+1353879297 DV板D1 SSID:R769000001 + 1353879297300 聯通卡托 192.168.100.1 admin+aa223344 AP PSW 1234567890 -> 1353879297 SSID 3G uFI_XXX -> Gate0001禁用廣播 3G卡公眾號-深圳市达能信通电子有限公司 3個月2元每月5M共15M-20171026-20180126 (ICCD最後1碼為S) ICCD 8986 0617 0800 2246 3325 PUK 0951 8852-(Gate0001) ICCD 8986 0617 0800 2246 3333 PUK 0490 4834 SQL 觸發器-蔡海濤 1.)取水表取水毫升 ??? SELECT field INTO var ............ 不可加@ CREATE DEFINER = root@localhost TRIGGER fetch_updae_userWM AFTER UPDATE ON wr_fetch begin DECLARE Discount FLOAT(3,2); DECLARE UnitPrice FLOAT(4,2); DECLARE Summoney FLOAT(9,1); DECLARE OwnWater BIGINT(11); DECLARE ActOpenId VARCHAR(32); DECLARE ComFangId BIGINT(11); DECLARE SalComRat FLOAT(6,4); if NEW.FlowMl<>0 then if NEW.paytype=1 then SELECT Water INTO OwnWater FROM wr_user WHERE openid = NEW.openid; if OwnWater>0 then set ActOpenId = NEW.openid; else SELECT openid INTO ActOpenId FROM wr_userbind WHERE BindOpenid = NEW.openid; end if; UPDATE wr_user SET Water=Water-NEW.FlowMl WHERE openid = ActOpenId; end if; if NEW.paytype=2 then SELECT Discount INTO @Discount FROM wr_user WHERE openid = NEW.openid; SELECT UnitPrice INTO @UnitPrice FROM wr_mach WHERE MachId = NEW.MachId; set Summoney = NEW.FlowMl/1000*@Discount*@UnitPrice; UPDATE wr_user SET Money=Money-Summoney WHERE openid = NEW.openid; end if; SELECT RegFangId INTO ComFangId FROM wr_user WHERE openid = NEW.openid; SELECT SaleCommRate INTO SalComRat FROM wr_fang WHERE FangId = ComFangId; INSERT INTO wr_fangincome (FangId,FangIncomeDat,FangIncomeType,FangIncomeAmt,FangIncomeDatStamp) VALUES (ComFangId,date_format(NOW(),'%Y%m%d%H%i%s'),1,(NEW.FlowMl*SalComRat/1000),UNIX_TIMESTAMP()); end if; end 2.)個人水庫錢包小於0校正歸0 CREATE DEFINER = root@localhost TRIGGER bank_wallet_zero_correct BEFORE UPDATE ON wr_user begin if NEW.Water<0 then set NEW.Water=0; end if; if NEW.Money<0 then set NEW.Money=0; end if; end 3.)房東收益增/減變化 CREATE DEFINER = root@localhost TRIGGER fang_income_balance_update AFTER INSERT ON wr_fangincome begin UPDATE wr_fang SET IncomeBal=IncomeBal+NEW.FangIncomeAmt WHERE FangId=NEW.FangId; end DV-SQL 觸發器 1.)水箱空/滿 CREATE DEFINER = root@localhost TRIGGER mq_bank_empty_full AFTER INSERT ON mq_bank begin if NEW.BankStat='E' then UPDATE water_cht.wr_mach SET BankStock=0 WHERE MachNum=NEW.GateId; elseif NEW.BankStat='F' then UPDATE water_cht.wr_mach SET BankStock=6500 WHERE MachNum=NEW.GateId; end if; end 2.)水箱出水 1000/(7.5*60) ml/cnt CREATE DEFINER = root@localhost TRIGGER mq_bank_out AFTER UPDATE ON mq_flow begin if NEW.EndTmk<>'' then UPDATE water_cht.wr_mach SET BankStock=BankStock-round((NEW.Cnt*1000/(7.5*60)),0) WHERE MachNum=NEW.GateId; UPDATE water_cht.wr_fetch SET MqFlowId=NEW.MqFlowId,FlowMl=round((NEW.Cnt*1000/(7.5*60)),0) WHERE MachNum=NEW.GateId ORDER BY addtime DESC LIMIT 1; end if; end 3.)水箱進水 1000/(24*60) ml/cnt CREATE DEFINER = root@localhost TRIGGER mq_bank_in AFTER INSERT ON mq_flow_in begin if NEW.RepTmk<>'' then UPDATE water_cht.wr_mach SET BankStock=BankStock+round((NEW.Cnt*1000/(24*60)),0) WHERE MachNum=NEW.GateId; end if; end 4.)閥開關 CREATE DEFINER = root@localhost TRIGGER mq_valve_state AFTER INSERT ON mq_valve begin if NEW.ValveTmkStamp<>'' then UPDATE water_cht.wr_mach SET ValveStat=NEW.ValveStat,ValveTime=NEW.ValveTmkStamp WHERE MachNum=NEW.GateId; end if; if NEW.ValveStat='i' then UPDATE mq_flow SET EndTmk=NOW(),Cnt='0' WHERE GateId=NEW.GateId AND EndTmk IS NULL ; UPDATE water_cht.wr_fetch SET MqFlowId=0,FlowMl=0 WHERE MachNum=NEW.GateId AND MqFlowId IS NULL AND FlowMl IS NULL ; end if; end 5.)TDS CREATE DEFINER = root@localhost TRIGGER mq_tds_update AFTER INSERT ON mq_tds begin if NEW.TdsTmkStamp<>'' then UPDATE water_cht.wr_mach SET TdsIn=round((NEW.Tds0/20),0),TdsOut=round((NEW.Tds1/40),0),TdsTime=NEW.TdsTmkStamp WHERE MachNum=NEW.GateId; end if; end 6.)超時未取水 CREATE DEFINER = root@localhost TRIGGER mq_wait_timeout AFTER INSERT ON mq_flow begin if NEW.EndTmk<>'' AND NEW.Cnt=0 then UPDATE water_cht.wr_fetch SET MqFlowId=NEW.MqFlowId,FlowMl=0 WHERE MachNum=NEW.GateId ORDER BY addtime DESC LIMIT 1; end if; end FTP連98常中斷: 改FlashFXP 選項->參數選擇->連結->FTP->數據連結模式->主動模式(PORT) String.toInt()-> Long integers can be as large as 2147483647 and as low as -2147483648 Ko Command: Ko Pub -> Device topic R769000001 (R + area call + (10)gate id) 'c': // pipe N limit counter to stop: "c" + (10)gate id + (1)pipe id + (8)counter xxxxxxxx mosquitto_pub -h 119.29.34.98 -u user1 -P u1234 -t R769000001 -m cR769000001012345678 't': // require report 2 tds meter2: "t" + (10)gate id mosquitto_pub -h 119.29.34.98 -u user1 -P u1234 -t R769000001 -m tR769000001 's': // setup WaitFlowGap + NextUserGap + RepCnti: "s" + (10)gate id + (3)wait flow sec + (3)next user sec + (6)report income pure water counter mosquitto_pub -h 119.29.34.98 -u user1 -P u1234 -t R769000001 -m sR769000001020005002880 'v': // close valve pipe N : "v" + (10)gate id + (1)pipe id mosquitto_pub -h 119.29.34.98 -u user1 -P u1234 -t R769000001 -m vR7690000010 Device Report: Device Pub -> Ko topic R769 "i") # report start up "i" + (10)gate id mosquitto_pub -h 119.29.34.98 -t R769 -m iR769000001 "t") # report tds 0,1 "t" + (10)gate id + (5)tds 0 value + (5)tds 1 value mosquitto_pub -h 119.29.34.98 -t R769 -m tR7690000015555599999 "v") # report valve turn on/off "v" + (10)gate id + (1)pipe id + (1)"o"n / of"f" mosquitto_pub -h 119.29.34.98 -t R769 -m vR7690000010f "b") # report start flow "b" + (10)gate id + (1)pipe id mosquitto_pub -h 119.29.34.98 -t R769 -m bR7690000010 "e") # report stop flow "e" + (10)gate id + (1)pipe id + (8)counter xxxxxxxx mosquitto_pub -h 119.29.34.98 -t R769 -m eR769000001012345678 "z") # report zero flow wait flow expired "z" + (10)gate id + (1)pipe id mosquitto_pub -h 119.29.34.98 -t R769 -m zR7690000010 "I") # report income tap water counter "I" + (10)gate id + (8)counter xxxxxxxx mosquitto_pub -h 119.29.34.98 -t R769 -m IR76900000112345678 "E") # report water bank empty "E" + (10)gate id mosquitto_pub -h 119.29.34.98 -t R769 -m ER769000001 "F") # report water bank full "F" + (10)gate id mosquitto_pub -h 119.29.34.98 -t R769 -m FR769000001 Protel 99 SE E:\Program Files\Design Explorer 99 SE\Library\Sch 下先COPY要的ddb並rename 再到browse Sch->find->find now->找到新lib->Add to library list->ok DV電路板 JP3-D7-TDS0 JP4-D5-TDS1 JP5-24V JP6-D6-Valve0 JP7-D1-Meter0 JP8-D2-Meter income 新QQ云 119.29.34.98 SSH要先用個人帳號 ubuntu ; frevres0907 登入, 再打 su -l 切換成 root ; frevres0907 ps aux|grep -i 'bish-bosh' (查出執行 kill -9 第二排的id數字) /www/web/default/bish-bosh/bish-bosh --verbose 2 -- /www/web/default/bish-bosh/r01 & (背景執行後按 enter r01中不可以有output echo否則ssh斷線就退出停止) subscriber -> mosquitto_sub -h 119.29.34.98 -t R769000001 -u user1 -P u1234 KO command set valve counter -> mosquitto_pub -h 119.29.34.98 -t R769000001 -m cR769000001099999999 -u user1 -P u1234 KO command stop valve -> mosquitto_pub -h 119.29.34.98 -t R769000001 -m cR769000001000000000 -u user1 -P u1234 KO command get TDS -> mosquitto_pub -h 119.29.34.98 -t R769000001 -m tR769000001 -u user1 -P u1234 ID+PSW /etc/mosquitto/mosquitto.conf user1:u1234 user2:u2234 user3:u3234 看MQTT-log cat /var/log/mosquitto/mosquitto.log|perl -nwe's/^(\d+)/localtime($1)/e; print' 執行 mosquitto /usr/local/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf -d wcmp http://119.29.34.98:8080 -> http://119.29.34.98:33888 admin ; frevres0907, mysql root ; revres88 phpmyadmin http://119.29.34.98/pma_e07f4b62/ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ =============== TAPPURE-170917 ================================================================================================================================= D0 GPIO16 T1 純水TDS (外波形3P黑)-(下公XH2.54 白) D1 GPIO5 , SCL M1 熱水流量計(公SM-4P 藍)-(母SM-4P 藍)-(上公XH2.54 白) D2 GPIO4 , SDA M2 冰水流量計(公SM-4P 黑)-(母SM-4P 黑)-(上公XH2.54 黃) D3 GPIO0 , 10k Pull-up S1 熱水開關 (公SM-4P 紅)-(母SM-4P 紅)-(上公XH2.54 橙) (因為用3.3V-GPIO電位不穩,必須用 pin0 GPIO(high)-ground) D4 GPIO2 , 10k Pull-up, BUILTIN_LED S2 冰水開關 (公SM-4P 綠)-(母SM-4P 綠)-(上公XH2.54 綠) (因為用3.3V-GPIO電位不穩,必須用 pin2 GPIO(high)-ground) D5 GPIO14, SCK T2 進水TDS (內波形3P黑)-(下公XH2.54 藍)-(下公XH2.54 黃) D6 GPIO12, MISO V1 進水電磁閥(內繼電3P紅)-(下公XH2.54 橙) D7 GPIO13, MOSI V2 冰水電磁閥(外繼電3P紅)-(下公XH2.54 綠) D8 GPIO15, 10k Pull-down, SS H1 電熱繼電器(母SM-2P 紅)-(公SM-2P 紅)(因為pulldown,必須用大負載否則wemos開不了機) X X X 5V GN D4 D3 D2 D1 RX TX 紫 藍 綠 橙 黃 白 紅 黑 WEMOS 3V D8 D7 D6 D5 D0 A0 RS 紫 藍 綠 橙 黃 白 紅 黑 X X Wemos D1 mini D1 (上公XH2.54 白)-(母SM-4P 藍) D2 (上公XH2.54 黃)-(母SM-4P 黑) D3 (上公XH2.54 橙)-(母SM-4P 紅) D4 (上公XH2.54 綠)-(母SM-4P 綠) GN (上公XH2.54 藍)-(母SM-2P 黑) -(公SM-2P 黑) D0 (下公XH2.54 白)-(外波形3P黑) D5 (下公XH2.54 黃)-(內波形3P黑) D6 (下公XH2.54 橙)-(內繼電3P紅) D7 (下公XH2.54 綠)-(外繼電3P紅) D8 (下公XH2.54 藍)-(公SM-2P 紅) 3V (下公XH2.54 紫)-(母SM-2P 紅) 外波形模塊 GN (外波形3P黃)-(上公XH2.54 藍) D0 (外波形3P黑)-(下公XH2.54 白) 3V (外波形3P紅)-(下公XH2.54 紫) 內波形模塊 GN (內波形3P黃)-(上公XH2.54 藍) D5 (內波形3P黑)-(下公XH2.54 黃) 3V (內波形3P紅)-(下公XH2.54 紫) 內繼電模塊 GN (內繼電3P黃)-(上公XH2.54 藍) 3V (內繼電3P黑)-(下公XH2.54 紫) D6 (內繼電3P紅)-(下公XH2.54 橙) 外繼電模塊 GN (外繼電3P黃)-(上公XH2.54 藍) 3V (外繼電3P黑)-(下公XH2.54 紫) D7 (外繼電3P紅)-(下公XH2.54 綠) 61.220.188.84 -> 119.29.228.213 mosquitto -d (背景啟動 MQTT server ) subscriber -> mosquitto_sub -h 119.29.228.213 -t Ko001 publisher -> mosquitto_pub -h 119.29.228.213 -t Ko001 -m 12 ps aux|grep -i 'bish-bosh' (查出執行 kill -9 第二排的id數字) /www/web/default/bish-bosh/bish-bosh --verbose 2 -- /www/web/default/bish-bosh/q01 & (背景執行後按 enter q01中不可以有output echo否則ssh斷線就退出停止) Ko Command: Ko Pub -> Gate topic Ko001 1.) 8x limit counter to stop: "C" + gate id xxxxxxxx + counter 0~7 xxxxxxxx (8x8) mosquitto_pub -h 119.29.228.213 -t Ko001 -m CGate00010000000011111111222222223333333344444444555555556666666677777777 2.) 8x limit minisec to stop: "T" + gate id xxxxxxxx + timer 0~7 xxxxxxxxxxxx (12x8) mosquitto_pub -h 119.29.228.213 -t Ko001 -m TGate0001000000000000111111111111222222222222333333333333444444444444555555555555666666666666777777777777 3.) pipe N limit counter to stop: "c" + gate id xxxxxxxx + pipe id x + counter xxxxxxxx mosquitto_pub -h 119.29.228.213 -t Ko001 -m cGate0001712345678 4.) pipe N limit minisec to stop: "t" + gate id xxxxxxxx + pipe id x + timer xxxxxxxxxxxx mosquitto_pub -h 119.29.228.213 -t Ko001 -m tGate00017123456789012 Gate Report: Gate Pub -> Ko topic Dv001 2.) Gate Start Up: "i" + gate id xxxxxxxx + 9 digit 000000000 mosquitto_pub -h 119.29.228.213 -t Dv001 -m iGate0001000000000 2.) pipe N start flow counters: "b" + gate id xxxxxxxx + pipe id x + counter xxxxxxxx mosquitto_pub -h 119.29.228.213 -t Dv001 -m bGate0001712345678 3.) pipe N stop flow counters: "e" + gate id begin + pipe id x + counter xxxxxxxx mosquitto_pub -h 119.29.228.213 -t Dv001 -m eGate0001712345678 4.) pipe N now flow counters: "c" + gate id xxxxxxxx + pipe id x + counter xxxxxxxx mosquitto_pub -h 119.29.228.213 -t Dv001 -m cGate0001712345678 ======================= qq cloud MQTT ========================================= ps aux|grep -i 'bish-bosh' (查出執行 kill -9 第二排的id數字) /home/httpd/www/html/bish-bosh/bish-bosh --verbose 2 -- /home/httpd/www/html/bish-bosh/q01 & (背景執行後按 enter q01中不可以有output echo否則ssh斷線就退出停止) Ko Command: Ko Pub -> Gate topic Ko001 1.) 8x limit counter to stop: "C" + gate id xxxxxxxx + counter 0~7 xxxxxxxx (8x8) mosquitto_pub -h 61.220.188.84 -t Ko001 -m CGate00010000000011111111222222223333333344444444555555556666666677777777 2.) 8x limit minisec to stop: "T" + gate id xxxxxxxx + timer 0~7 xxxxxxxxxxxx (12x8) mosquitto_pub -h 61.220.188.84 -t Ko001 -m TGate0001000000000000111111111111222222222222333333333333444444444444555555555555666666666666777777777777 3.) pipe N limit counter to stop: "c" + gate id xxxxxxxx + pipe id x + counter xxxxxxxx mosquitto_pub -h 61.220.188.84 -t Ko001 -m cGate0001712345678 4.) pipe N limit minisec to stop: "t" + gate id xxxxxxxx + pipe id x + timer xxxxxxxxxxxx mosquitto_pub -h 61.220.188.84 -t Ko001 -m tGate00017123456789012 5.) pipe N limit counter + minisec to stop: "p" + gate id xxxxxxxx + pipe id x + counter xxxxxxxx + timer xxxxxxxxxxxx mosquitto_pub -h 61.220.188.84 -t Ko001 -m pGate0001712345678123456789012 Gate Report: Gate Pub -> Ko topic Dv001 2.) Gate Start Up: "i" + gate id xxxxxxxx + 9 digit 000000000 mosquitto_pub -h 61.220.188.84 -t Dv001 -m iGate0001000000000 2.) pipe N start flow counters: "b" + gate id xxxxxxxx + pipe id x + counter xxxxxxxx mosquitto_pub -h 61.220.188.84 -t Dv001 -m bGate0001712345678 3.) pipe N stop flow counters: "e" + gate id begin + pipe id x + counter xxxxxxxx mosquitto_pub -h 61.220.188.84 -t Dv001 -m eGate0001712345678 4.) pipe N now flow counters: "c" + gate id xxxxxxxx + pipe id x + counter xxxxxxxx mosquitto_pub -h 61.220.188.84 -t Dv001 -m cGate0001712345678 振荡电路参考这个,其中R2就是探针之间的水电阻 1、求出探针之间的水电阻 2、根据探针的间距、横截面面积获得L/S 3、根据上面两个值获得探针之间的电导率 4、根据电导率获得TDS TDS= (0.55~0.7)电导率 两根针间距是5.2mm,针长度是5.5mm,针个直径是1mm /home/httpd/www/html/bish-bosh/bish-bosh --verbose 2 -- /home/httpd/www/html/bish-bosh/q01 & (背景執行 不可以有output echo否則ssh中斷就退出) ps aux|grep -i 'bish-bosh' (查出執行 kill -9 第二排的id數字) cd /home/httpd/www/html/bish-bosh ./bish-bosh --verbose 2 -- q01 mosquitto_pub -h 61.220.188.84 -t Dv001 -m Gate0001700000001 (gate id xxxxxxxx + pipe 0-7 + counter xxxxxxxx -> 00000001/begin 00000000/end else/counter) change valve publisher(84) -> mosquitto_pub -h 61.220.188.84 -t Ko001 -m Gate000100000010 (GateId + 8 valve on/off) 604,523,637 1,2,3 760 600,527,617 1,2,3 800 607,457,651 1,2,3 800,710,820 520,500,513 2,3,1 740 708,682,692 3,1,2 1050 1766 1544 1234 1,2,3 700 1514-870 1532-860 joe /usr/bin/dv01 chmod 777 /usr/bin/dv01 #!/bin/bash mxi=60*5 for (( i = 0; i < $mxi; i++ )); do dat=$(date "+%Y%m%d%H%M%S") echo $dat mosquitto_pub -h 61.220.188.84 -t Gate0001 -m $dat $(php '/home/httpd/www/html/mq.php') sleep 1 done exit 0 方 主板 rm /home/httpd/www/html/dv02 subscriber(84) -> mosquitto_sub -h 61.220.188.84 -t Gate0001 > /home/httpd/www/html/dv02 change valve publisher(84) -> mosquitto_pub -h 61.220.188.84 -t Master -m Gate00010000111 (GateId + 8 valve on/off) timer(84) -> /usr/bin/dv01 -> (mosquitto_pub -h 61.220.188.84 -t Gate0001 -m 20170720202311 + php '/home/httpd/www/html/mq.php') 電磁閥7 流量計7(電源旁) x-publisher(84) -> mosquitto_pub -h 61.220.188.84 -t Master -m 11118 (valve 3 ON 11117 OFF) systemctl restart mosquitto.service RSSI Wifi 訊號 0 - (-55)dbm 满格(4格)信号 (-55) - (-70)dbm 3格信号 (-70) - (-85)dbm 2格信号 (-85) - (-100)dbm 1格信号 =========== C language ===================== char *xxx = ""; -> 一定要先給值後才可以用array去改值 C++ string xxx.length() 字符串長度 char *xxx 沒有預留空間, char xxx[100] 才有 char[x+1] 至少要比字串多1,才不會影嚮下一個未串 ""->string ''->char ============================================ http://61.220.188.84/dv-m/mq-1.php -->從KO送DATA去wemos http://61.220.188.84/dv-m/mq-2.php -->查KO的SQL最後10筆 wemos傳給KO的DATA david@NB3 MINGW64 /f/WX-Water/Arduino/hardware $ cd esp8266com david@NB3 MINGW64 /f/WX-Water/Arduino/hardware/esp8266com $ git clone https://github.com/wemos/Arduino_D1.git esp8266 Cloning into 'esp8266'... remote: Counting objects: 13742, done. Receiving objects: 18% (2606/13742), 1.71 MiB | 8.00 KiB/s s david@NB3 MINGW64 /f/WX-Water/Arduino/hardware/esp8266com $ cd esp8266/tools david@NB3 MINGW64 /f/WX-Water/Arduino/hardware/esp8266com/esp8266/tools (master) $ python get.py Platform: i686-mingw32 Downloading esptool-0.4.9-win32.zip Done Extracting dist/esptool-0.4.9-win32.zip Renaming esptool-0.4.9-win32/ to esptool Downloading win32-xtensa-lx106-elf-gb404fb9-2.tar.gz Done Extracting dist/win32-xtensa-lx106-elf-gb404fb9-2.tar.gz Downloading mkspiffs-0.1.2-windows.zip Done Extracting dist/mkspiffs-0.1.2-windows.zip Renaming mkspiffs-0.1.2-windows/ to mkspiffs david@NB3 MINGW64 /f/WX-Water/Arduino/hardware/esp8266com/esp8266/tools (master) $ wemos MQTT broker(84) -> mosquitto -v subscriber(103-esp) -> 固定send outTopic + 收到callback inTopic publisher(84) -> mosquitto_pub -h 61.220.188.84 -t inTopic -m 111111111111 upload speed 115200 COM5 wemos D1 & mini AVRISP mkII D1接GND + RST接GND Wemos Installing Hardware package cd /f/WX-Water/Arduino/hardware/esp8266com git clone https://github.com/wemos/Arduino_D1.git esp8266 cd esp8266/tools python get.py MQTT broker(84) -> mosquitto -v subscriber(104-pi) -> mosquitto_sub -h 61.220.188.84 -t dv01 publisher(84) -> mosquitto_pub -h 61.220.188.84 -t dv01 -m 12 --------------------- raspberry pi ------------------------------------------- 控制gpio18亮燈 (104-pi) -> sudo python simple.py (84) -> mosquitto_pub -h 61.220.188.84 -t dv01 -m "{\"pin\":18,\"value\":1}" apache-php 加權限才可執行shell sudo visudo 加一行 www-data ALL=(ALL:ALL) NOPASSWD:ALL php 必須用 sudo 去執行shell bash 安裝 PHP + APACHE apt-get install apache2 php5 libapache2-mod-php5 安裝 vsftpd apt-get install vsftpd ftp 修改匿名設定才能上傳檔案 joe /etc/vsftpd.conf write_enable=YES anonymous_enable=YES anon_upload_enable=YES anon_mkdir_write_enable=YES ftp 修改上傳檔案欋限自動變為666 (777?) local_umask=000 讀取 TDS 模塊 minicom -H -S /usr/local/bin/dv02 -C /usr/local/bin/dv03 dv02----------------- #!/bin/sh print "\n" send \0374\0374\0374 dv03----------------- fd 5e 00 fd fd fe 24 01 fe fe raspberry pi 接 USB-串口 接 TDS 產生Hex的 FD FD FD 檔案 > dv01 echo -e "\0375\0375\0375" > dv01 進入minicom -H 顯示十六進位 ctrl-A -> S -> ascii -> /usr/local/bin/dv01 上傳檔案 dv01 當作發送 FD FD FD TDS 雙路 9600 8N1 停止位 1 TX-RX,RX-TX 交換接 TDS 二直突條正面4P孔向上,左->右,接wemos GRN-RX-TX-5V 发送FC FC FC 返回 FD TDSL1 TDSH1 FD FD FE TDSL2 TDSH2 FE FE IC盒探針線向上 右1左2 TDS 單路 9600 8N1 停止位 1 TX-TX,RX-RX 對接 發送 FD FD FD 返回 FD 低位 高位 FD FD ssh -NfR 8080:192.168.100.104:22 root@61.220.188.84 先 apt-get update 再 apt-get install minicom 工作文件區 /usr/local/bin/ ...... gpio18 設定方式 echo 18 > /sys/class/gpio/export echo out > /sys/class/gpio/gpio18/direction echo 1 > /sys/class/gpio/gpio18/value 取消設定 echo 18 > /sys/class/gpio/unexport apt-get install joe apt-get remove xxx pi + raspberry (已改) -> frevres0907 -> su + frevres0907 ====================================== 20170531 New WX Water ===================================================== https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx7fe291f76cf93354&secret=d8fd277920bba0cfddc1fd8f5eacf937 {"access_token":"y-RkXsDVDdxRaMTBybYL8hj5YREkUJmG6hLkGM4E_JkcNmq1pClejE5gF9mTJrmI5qc4Jf2elQf2aD7OBmgx22sWoaZrtArDxAa3A6RWQa8","expires_in":7200} 微信公眾平台 lee@dacomputing.com aa2233zz AppID(应用ID) wx7fe291f76cf93354 AppSecret(应用密钥) d8fd277920bba0cfddc1fd8f5eacf937 weixin.qq.com 101.227.131.102, 101.226.76.175 BIOS 中的南橋USB->8 ports, USB2.0->disable 才不會常常抓不到USB0 BIOS設少8小時->如果linux多8小時 為了確定 wifi AP 是否存在用 ping wifi AP 192.168.188.253 開機增加/etc/sysconfig/network-scripts/ifcfg-eth0:4 --> 192.168.188.100 date -s 2015-01-15 date -s 09:41:30 hwclock -w 把date 寫入 BIOS 點煙器的黃線在中間藍靠主板咖啡靠面板 如果timer_3g卡死,flag-3g-busy將一直存在 ps -ef 列出defunct 僵屍 kill -9 xxxx 進程號 /usr/bin/autossh -M 5678 -NfR 8080:192.168.100.99:22 root@61.220.188.84 ipad-saferi