GASでおんどとりWeb Storage APIを利用する。
Python版はこちら
こんどはGASでおんどとりWEB STORAGE APIを利用してみた。
function temps(){ const url = "https://api.webstorage.jp/v1/devices/current" const api_key = "【API_KEY】" const login_id ="【ID】" const password = "【PASSWORD】" const furo_temp = () => { var paylord = {'api-key':api_key,"login-id":login_id,'login-pass':password} var headers = { "X-HTTP-Method-Override":'GET', "Content-Type" : "application/json",} var options = { "method" : "post", "payload" : JSON.stringify(paylord), "headers" : headers, "muteHttpExceptions":true } return UrlFetchApp.fetch(url,options); } return JSON.parse(furo_temp()) } Logger.log(temps())
後はお好きにすると良いと思います。
家で一番簡単にSpotifyをブロードキャストする方法
以前はChromecast Audioという物があったのですが、現在は販売停止になっていて結構高くなっちゃってたので。
必要なもの
1.Chromecast (5,000円くらい)
2.HDMI分離器 (2,500円くらい)
この2個があれば後はGoogle Homeでオーディオグループを作成するだけ。
意外と簡単に行けたのでオススメ
AsteriskとOG410Xaをつなぐ
長かった・・・
結論からいうと
ID:10(内線番号)
Pass:なし
でsip.confに書くだけっぽい。
これでOG410Xaがよしなにやってくれるみたいだった。
あとはExtensions.confに外線発信用のコンテクストを書くだけ、だと思う。
ということで
【OG410Xa側】
ここはid:admin Pass:akisky-HARUSKY48
これで管理画面にログインし、
『電話設定』→『着信番号設定』を
以上のようにする。
するとIP Phone2に着信が飛ぶようになる。
OG側の設定はこれくらい。あとはDHCP除外設定でAsteriskサーバーのIPアドレスを固定にしておくと後で何かと楽にはなる。
【Asterisk側】
sip.conf
[general] maxexpirey=3600 defaultexpirey=3600 context=default bindport=5060 bindaddr=0.0.0.0 srvlookup=yes disallow=all allow=ulaw allow=alaw allow=gsm language=ja canreinvite = no match_auth_username=yes defaultexpiery=3600 maxexpiery=3600 register => 11:pass@192.168.1.1/800 [asterisk] type=friend username=1000 canreinvite=no context=front insecure=port,invite host=【AsteriskのIPアドレス】 dtmfmode=auto allowsubscribe=no
192.168.1.1は デフォルトゲートウェイのIPアドレス。
register =>11:pass@~/800
というところだがこれで内線電話としてAsteriskが登録される。800は登録されたOG410から着信があった場合の着信番号を記述する
extensions.confも普通に
[inandout] exten => 800,1,Dial(SIP/100,30,tT) exten => 800,n,Hangup() exten => _0.,1,Set(CALLERID(num)=${MYNUMBER}) exten => _0.,n,Set(CALLERID(name)=${MYNUMBER}) exten => _0.,n,Dial(SIP/${EXTEN}@asterisk,120,T)
こんな感じでコンテキストをDefaultとかに追記するくらいでOK。
このままだと無限に外線が取れるのでsip.confに
[example] type = friend username= 【username】 secret = 【password】 host=dynamic dtmfmode=auto context = front nat=force_rport,comedia call-limit = 1
と call-limitの表記をつけて1つ以上取れないようにすればOK。ただしgeneralに表記せず、各sipアカウントの中に入れて記述しないと反映されない。
【Beds24】Beds24のgetBookingjsonにPythonからアクセスする
A4の部屋割表の作成を自動化するために、まずはBeds24 からその日の予約をピックアップしてみる。
import requests import json #必要なところはこの辺にまとめる url = "https://www.beds24.com/api/json/getBookings" username = "" api_key = "" prop_key = "" datefrom = "20191013" dateto = "20191013" paylord = { "authentication": { "apiKey": api_key, "propKey": prop_key }, "includeInvoice":False, "includeInfoItems": False, "arrivalFrom":datefrom, "arrivalTo":dateto } res = requests.post(url,data = json.dumps(paylord), headers = {"content-type": "application/json"}) data = res.json()
変数data
の中にJsonになった予約データがあるのでこれをよしなに加工していくといい感じになるのかもしれない。
supercolliderから音が出なかった。
PythonでFoxDotをインストールして使おうと思ったらバックグラウンドのSuperColliderから音が出なかった。 OS: Ubuntu 18.04 USBアンプ使用
SuperColliderでServerOptions.devices;
としてみたら
ERROR: A primitive was not bound. 0 711 Instance of Method { (0x5576a0a4a6c0, gc=01, fmt=00, flg=11, set=04) instance variables [15] raw1 : Float 0.000000 00000000 0080000C raw2 : Float 0.000000 00000300 03020003 code : instance of Int8Array (0x5576a0a4a9c0, size=4, set=2) selectors : nil constants : nil prototypeFrame : instance of Array (0x5576a0a4a900, size=3, set=2) context : nil argNames : instance of SymbolArray (0x5576a0a4a840, size=3, set=2) varNames : nil sourceCode : nil ownerClass : class Meta_ServerOptions (0x5576a0a40e00) name : Symbol 'prListDevices' primitiveName : Symbol '_ListAudioDevices' filenameSymbol : Symbol '/usr/share/SuperCollider/SCClassLibrary/Common/Control/Server.sc' charPos : Integer 4472 } ERROR: Primitive 'none' failed. Failed. RECEIVER: nil CALL STACK: MethodError:reportError 0x5576a20b4f78 arg this = <instance of PrimitiveFailedError> Nil:handleError 0x5576a2086318 arg this = nil arg error = <instance of PrimitiveFailedError> Thread:handleError 0x5576a20b2f78 arg this = <instance of Thread> arg error = <instance of PrimitiveFailedError> Object:throw 0x5576a1ffe618 arg this = <instance of PrimitiveFailedError> Object:primitiveFailed 0x5576a20b1498 arg this = nil Interpreter:interpretPrintCmdLine 0x5576a2073758 arg this = <instance of Interpreter> var res = nil var func = <instance of Function> var code = "ServerOptions.devices;" var doc = nil var ideClass = <instance of Meta_ScIDE> Process:interpretPrintCmdLine 0x5576a208d1a8 arg this = <instance of Main> ^^ The preceding error dump is for ERROR: Primitive 'none' failed. Failed. RECEIVER: nil
というメッセージが出た。USBのアンプ使ってるからかな?とは思うもののとりあえず色々してみた。
ぐぐってみたらココと同じ症状だった。
多分オーディオコントロールがJackというものを使わないといけないらしい。
ということで具体的にやったこと。
sudo usermod -aG [YOURNAME] audio
する。←これはいるのかわからない
qjackctlを起動する
設定のところを
として
開始ボタンを押した。
この状態でSuperCollider起動してFoxDot起動したらうまく音がなった。