487 有OFFER 52萬 20% 自備 80% 貸款-->不錯,可以考慮啊,不過請注意一下,如果要做1031 exchange的開始第一步驟前要做什麼 我大概都算好了,如果可以貸款50%買土地,那賣487剩下的錢正好可以拿去換成土地, 那480 cash out的錢,就可以拿去做建築貸款(約6700呎85萬)的downpay(約20-30%)約25-30萬, 因為不要白花太多利息,所以土地要找已有permit,馬上可以建房子的才行, 而且施工時間也要愈快愈好(最好是6-9個月內完成), 現在賣487,大概要交15%聯邦+10%州的稅約3萬左右,等於是買一台新車的錢, 加上如果土地,建築和後續的資金都決定好了,那就一定要一氣呵成做1031 exchange, 不然太浪費了 我已經找了很久,也都有仔細計算,目前這2個土地,都有現成的permit,而且最適合我們目前的資金運作,總投資也最划算: Land-A.)在Norwalk 地段一般 $690,000 可蓋連排condo 1350呎 x 5U = 6750呎 https://www.zillow.com/homedetails/12025-Orange-St-Norwalk-CA-90650/21396076_zpid/?fullpage=true Land-B.)在Long Beach 地段不錯 $699,000 可蓋獨棟appartment 1678呎 x 4U = 6711呎 https://www.zillow.com/homedetails/1719-Cedar-Ave-Long-Beach-CA-90813/21235487_zpid/?fullpage=true 黃給的8個物件,我的分析意見如下: 1.)1001 Abajo Dr 我之前看過,沒有permit(還早的很),那麼好的地段還賣那麼低價,而且owner還可貸50%,肯定有問題 2.)5316 Rosemead Bl 現成的4U appartment,目前不考慮,因為沒有升值空間了 3.)7505 Marsh Av 沒有permit,如果要申請不知何年何月才下來,而且95萬我們也沒那麼多資金 4.)0 Badillo St 很畸形的問題土地,連parcel都要自已去查, Can potentially build four homes on the land. -->不但沒有permit,連plan都還沒做,zone code多少也不知 5.)13644 13646 Earlham Dr # 4 現成的怪4U,一共7間房,總租金也才不到5千元,太貴了,不划算而且也沒有升值空間了 6.)1913 W Olympic Bl 3U,各2B1bath,總租金更少才4千元,可能連利息都不夠,太貴也不會再漲多少了 7.)952 E 9th St Large lot includes 2 parcels in prime location with Conditionally Used Permit approved by the city to build 11 condo units over 3 buildings. 看起來不錯,3棟11U的地,可是不懂已有了什麼permit?又說不保證叫buyer自已去查?不過總投資也很大,我們現在的錢應該不太夠吧 8.)17133 E Francisquito Av 只能蓋3U x 3000-4000呎豪宅的地,沒有permit,就算蓋好了不好租也不好賣,現在也沒那麼多錢投資,自已去申請permit 另外,請先幫我問一下以下不同人不同的問題 A.)黃小姐: 1.)請問有沒有認識能做1031的escrow公司 2.)請問有建屋permit的空地是否可以辦貸款? 3.)如果可以請問downpay大概是多少?利率大概是多少?50%-5-8% 4.)請問在買的時侯申請貸款或是先用現金買了之後再辦CASH OUT,哪一種比較容易申請? B.)487中介劉小姐 1.)請問有沒有認識能做1031的escrow公司 2.)請問有建屋permit的空地是否可以辦貸款? 3.)如果可以請問downpay大概是多少?利率大概是多少? 4.)請問在買的時侯申請貸款或是先用現金買了之後再辦CASH OUT,哪一種比較容易申請? C.)李小姐 1.)請問有沒有認識能做1031的escrow公司 2.)請問如果2018年度使用1031報稅,州稅的部分是不是也可以轉移到新property不用交? 3.)請問如果2018年度將DM AQUA公司的股份賣出,並且產生虧隕,是不是可以作為long term captital gain的減項,少交所得稅? D.)辦理建築貸款的中介或公司(例黃小姐,黃小姐女兒,銀行等) 1.)請問申請建築貸款是不是必需提供土地做抵押擔保? 2.)如果要提供土地抵押擔保,需要是第一順位或是第二順位也可以? 3.)請問downpay大概是多少?利率大概是多少? 4.)請問需要具備哪些必要的條件才可申請?例如:哪些permit?建築商要求?監理公司? 5.)大概從申請到通過大概要多久時間? E.)辦理1031 exchange的ESCROW公司 1.)請問現在已找中介開始listing售屋了,如果要進行1031的exchange流程,最遲必需在哪一個環節進行之前開始才可以? 例如:收買方訂金前? 或買方簽合約前? 或要開始ESCROW前? 2.)請問如果2018年度使用1031報稅,州稅的部分是不是也可以轉移到新property不用交? F.)建築商(原來建482的那家還可以問他嗎?或是找其他新的問也可以,只是要抓個大概) 1.)請問如果是買一塊帶完整permit的空地,要跟賣方要求轉移哪些permit才能開始動工? 2.)請問如果以6700呎的建築面積計算,蓋appartment或是condo有什麼不同? 3.)請問如果以6700呎的建築+10個車位的面積計算,大概價格是多少?施工到permit下來時間大概多久? 4.)請問有沒有做過有建築貸款的工程? 5.)請問有沒有認識可以辦理建築貸款的? G.)土地的seller(如果可以請2個都問下) 1.)是不是可以接受賣方辦理土地貸款? 2.)是不是可以接受賣方辦理1031 exchange? 3.)是不是可以移轉所有完整的permit,就可以立即開工? 480/482 轉貸有下列新選擇 A)apprasal 的60% 利息 約5.5% loan fee lander 0.5% 黃S 1% 無法保證apprasal 的估值是否高於95萬 B)apprasal 的70% 利息8.99% 1-2年綁約 提前還$要罰1% loan fee lander $1955 黃S 1% 可用前一家ㄉ估價報告95萬來做,因為我們現在是叫CASHOUT(還掉前貸款又多弄錢出來) 最多能貸 apprasal 的50% ($522000) 用這家可先貸出66.5萬(95*0.7) 半年後罰1% 解約後再跟其他銀行作refinance 就是100%轉貸 黃很賊,一直推這ㄍ(廢話 他可以賺2次LOAN FEE) C)apprasal 的65% 利息6.99% (1-6 month)1% 黃S 1% 利息7.5% (7-12 month) loan fee lander 利息7.99% (13-24month) 超過 18.99% 請確定B)apprasal 的70% 1.)可以貸到66.5萬 2.)半年後立刻可以解約,而且只罰6650元 3.)半年後黃那裡如果要refinance難不難,會不會又要準備很多資料和條件 河神 一起同过窗 司马懿大将军之军师联盟 那年花开月正圆 使徒行者 九州·海上牧云记 无证之罪 少年有点酷 大唐荣耀 春风十里不如你 致我们单纯的小美好 权利的游戏第七季 你好,旧时光 颤抖吧,阿部! 杀不死 花间提壶方大厨 一,我们会介绍说最起码我们的水知道哪里来的水; 二,我们的水又可以现场试喝; 三,我们的水客户打的多公司会有优惠,我们私人又可以另送一桶至二桶 四,我们的水又是井水,经过公司人员常期会把水带回去抽检化验,保证我们的以提供最优质的水质 五,我们的水是经过电源插电,带消毒的,顾客打五升的水,我们就去掉六成不良的水排出来,只有四成的水,而且我们的水并不像水管那么大的水想出多大就有多大 之所以我们的机器不卖的原因, 我们的机器里面的过滤器是经过我们的水质来安装过滤器的,并不像市场卖的一仟多的那么便宜的过滤器的 你換下一家也沒辦法預測一定能有估值超過95萬 而且我已經準備二個月的時間和精力 就此放棄 下一次不知道又要什麼稀奇古怪的文件 李小姐那邊也花了二百開了CPA letter 487已把房課趕走 現在要油漆 二月初就開始賣了 我知道這次估值過低 那請問你想貸多少才滿意 只能有55% SELECT *,sum(`GiftUnit`) FROM `wr_fanggift` WHERE `FangId`='6' group by `GiftType` 20-30 sec 第一次拔SIM卡 AT Ready AST_POWERON 第2次以後拔SIM卡 Device Will Restart... AT Ready AST_POWERON 連上 +STATUS: MQTT READY +STATUS: MQTT CONNECT OK Subscribe OK 中斷自連 +STATUS: MQTT CLOSE +STATUS: MQTT CONNECT OK Subscribe OK 計算機管理->設備管理器->(黃三角形)Prolific USB-to-Serial Comm Port->更新驅動程序軟件->瀏覽計算機以查找->從計算機的驅動程序列表中選取->版3.3.10.104(2009/11/19) ATI->查固件 IOT_Ltd IOT_M35 Revision: MQTT_B5_R05_A10_D171205 AT+GSN->查IMEI 352425023962841 AT+CPIN?->查SIM卡 +CPIN:READY AT+CSQ->查信號 +CSQ: 24,99 ATE0->設停止echo AT+IPPORT=119.29.34.98,18883->設ip+port AT+USERPWD=user2,u2234->設ID+PSW AT+STATUS->查MQTT狀態 AT+AUTOSUB=1,R769000009,2->auto subscript 所有的命令配置完后,需要保存(AT&W)再重启才能生效(重启AT+CFUN=1,1 命令)。 AT&W->保存 AT+CFUN=1,1->重启 AT+SUBSCRIBE=R769000009,2->subscript topic: R769000009,11 tR769000009(無enter) AT+PUBLISH=R769,10->publish >1234567890(enter送出) mosquitto_sub -h 119.29.34.98 -p 18883 -u user2 -P u2234 -t R769 mosquitto_pub -h 119.29.34.98 -p 18883 -u user1 -P u1234 -t R769000009 -m tR769000009 水機問題原因列表: 1.)水機常自動1秒內連續回報閥on/off->?4號機4分進水閥+壓力桶+r01改QoS=2(20171231) 2.)mq_flow記錄多於wr_fetch->出水流量計裝在電磁閥與壓力桶之間,因此在造水時會隨壓力漸增而轉動,產生記錄回報(20180101) 3.)水機MQTT常自動掉線重連,出現很多i->?r01改QoS=2(20180101) 白色卡托 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-(R769000002) 20171126 開通 黑色卡托 Gate0001 + 1353879297 ICCD 8986 0617 0800 2246 3333 PUK 0490 4834-(R769000003) 20171126 開通 黑色卡托 Gate0001 + 1353879297 公众号:“欧申物联”几米充值-联通查询,查询卡号是卡套上的8986开头的ICCID号就是了,输入时不用输最后那个字母 物联卡有锁定功能,只能识别第一个设备,再装其他设备时会自动锁了停用,一个卡只能解锁三次(“欧申物联”几米充值-聯通卡解鎖") ICCD 8986 0617 0800 5754 782N PUK 9191 3935-(R769000004) 20171224 開通 黑色卡托 Gate0001 + 1353879297 ICCD 8986 0617 0800 5754 704N PUK 6544 6074-(R769000005) 20180101 開通 白色卡托 Gate0002 + 1866687760 Mosquitoo 密碼表 /etc/mosquitto/mqtt.acl 要加上允許的topic,否則無法收發 user user1 topic readwrite R769 topic readwrite R769000001 topic readwrite R769000002 topic readwrite R769000003 topic readwrite R769000004 topic readwrite R769000005 topic readwrite R769000006 topic readwrite R769000007 topic readwrite R769000008 topic readwrite R769000009 topic readwrite R769000010 再 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 -p 18883 -d ps aux|grep -i 'bish-bosh' kill r01 再重新執行 /bin/bash /www/web/default/bish-bosh/t01 /www/web/default/bish-bosh/t01->每隔1分鐘檢查r01 如果=1(中斷)則重新run r01 + 判斷如果>4(重覆多支r01)則全砍 /var/spool/cron/crontabs/root 加 * * * * * /bin/bash /www/web/default/bish-bosh/t01 /www/web/zjr/public_html/dv-m/mqtt-tool-tds.php->每天00:30定時發出TDS請求 /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 /etc/init.d/cron restart -> 重新啟動 to test if mos OK mosquitto_sub -h 119.29.34.98 -p 18883 -u user2 -P u2234 -t R769000010 mosquitto_pub -h 119.29.34.98 -p 18883 -u user1 -P u1234 -t R769000010 -m tR769000010 Mosquitoo 20171117 改 listsen port 1883->18883 + port 1883 mapping ->18883 ps aux|grep -i 'bish-bosh' (查出執行 kill -9 id數字) ps aux|grep -c 'bish-bosh/r01' (查出執行的行數1=中斷,4=運用中) /bin/bash /www/web/default/bish-bosh/t01 if r01 dup 先加時間Stamp echo -ne $(date "+%Y-%m-%d %H:%M:%S")'\n' >>/www/web/default/bish-bosh/bb_err_log ps aux | grep /www/web/default/bish-bosh/r01 | awk '{print $2}' | xargs kill -9 (這行 r01 會全殺) if r01 stop 先加時間Stamp 背景執行後按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 & 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->抽完后返回 SQL 觸發器-蔡海濤 1.)取水表取水毫升 ??? SELECT field INTO var ............ 不可加@ CREATE DEFINER = root@localhost TRIGGER fetch_updae_userWM_fang AFTER UPDATE ON wr_fetch begin DECLARE Discnt FLOAT(3,2); DECLARE UntPri 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); DECLARE FangOpenId VARCHAR(32); 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 @Discnt FROM wr_user WHERE openid = NEW.openid; SELECT UnitPrice INTO @UntPri FROM wr_mach WHERE MachId = NEW.MachId; set Summoney = NEW.FlowMl/1000*@Discnt*@UntPri; UPDATE wr_user SET Money=Money-Summoney WHERE openid = NEW.openid; end if; SELECT FangId INTO ComFangId FROM wr_mach WHERE MachId = NEW.MachId; SELECT SaleCommRate INTO SalComRat FROM wr_fang WHERE FangId = ComFangId; SELECT openid INTO FangOpenId FROM wr_fang WHERE FangId = ComFangId; if NEW.openid<>FangOpenId then 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 if; end 2.)個人水庫錢包小於0校正歸0 --> X ?? 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 4.)充水庫更新個人水庫餘額 CREATE DEFINER = root@localhost TRIGGER insert_user_water AFTER INSERT ON wr_buywater begin if NEW.types=2 then update wr_user set Water=Water+new.waterMl where openid=new.openid; end if; end CREATE DEFINER = root@localhost TRIGGER update_user_water AFTER UPDATE ON wr_buywater begin if NEW.types=1 and NEW.wxpay_prepay_id is not null and OLD.wxpay_prepay_id is null then update wr_user set Water=Water+new.waterMl where openid=new.openid; end if; end 5.)充錢包更新個人錢包餘額 CREATE DEFINER = root@localhost TRIGGER insert_user_money AFTER INSERT ON wr_moneylog begin if NEW.state=1 and NEW.types=2 then update wr_user set Money=Money+new.money where openid=new.openid; elseif NEW.state=-1 and NEW.types=2 then update wr_user set Money=Money-new.paymoney where openid=new.openid; end if; end CREATE DEFINER = root@localhost TRIGGER update_user_money AFTER UPDATE ON wr_moneylog begin if NEW.state=1 and NEW.types=1 AND NEW.wxpay_prepay_id is not null AND OLD.wxpay_prepay_id is null then update wr_user set Money=Money+new.money where openid=new.openid; end if; 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/(CntRatOut*60) ml/cnt CREATE DEFINER = root@localhost TRIGGER mq_bank_out AFTER UPDATE ON mq_flow begin if NEW.EndTmk<>'' then SELECT CntRatOut INTO @CountRateOut FROM water_cht.wr_mach WHERE MachNum=NEW.GateId; UPDATE water_cht.wr_mach SET BankStock=BankStock-round((NEW.Cnt*1000/(@CountRateOut*60)),0) WHERE MachNum=NEW.GateId; UPDATE water_cht.wr_fetch SET MqFlowId=NEW.MqFlowId,FlowMl=round((NEW.Cnt*1000/(@CountRateOut*60)),0) WHERE MachNum=NEW.GateId AND MqFlowId IS NULL AND FlowMl IS NULL ORDER BY addtime DESC LIMIT 1; end if; end 3.)水箱進水 1000/(CntRatIn*60) ml/cnt CREATE DEFINER = root@localhost TRIGGER mq_bank_in AFTER INSERT ON mq_flow_in begin if NEW.RepTmk<>'' then SELECT CntRatIn INTO @CountRateIn FROM water_cht.wr_mach WHERE MachNum=NEW.GateId; UPDATE water_cht.wr_mach SET BankStock=BankStock+round((NEW.Cnt*1000/(@CountRateIn*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<>'' AND NEW.Tds0<>0 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 AND MqFlowId IS NULL AND FlowMl IS NULL 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 (近螺絲孔-自來水TDS) JP4-D5-TDS1 (遠螺絲孔-純淨水TDS) JP5-24V JP6-D6-Valve0 JP7-D1-Meter0 out (遠螺絲孔-4分出水龍頭流量計) JP8-D2-Meter income (近螺絲孔-2分進水箱流量計) 新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