Closed n0bisuke closed 6 years ago
元のコード.ino
#include <WiFi.h>
#include <esp8266-google-home-notifier.h>
#define LIGHT_SIG A0
const char* ssid = "xxxxx";
const char* password = "xxxxx";
GoogleHomeNotifier ghn;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("");
Serial.print("connecting to Wi-Fi");
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(250);
Serial.print(".");
}
Serial.println("");
Serial.println("connected.");
Serial.print("IP address: ");
Serial.println(WiFi.localIP()); //Print the local IP
}
void loop() {
// put your main code here, to run repeatedly:
int sensorValue = analogRead(LIGHT_SIG);
Serial.println(sensorValue);
if(sensorValue <= 600){
const char displayName[] = "オフィス";
Serial.println("connecting to Google Home...");
if (ghn.device(displayName , "ja") != true) {
Serial.println(ghn.getLastError());
return;
}
Serial.print("found Google Home(");
Serial.print(ghn.getIPAddress());
Serial.print(":");
Serial.print(ghn.getPort());
Serial.println(")");
if (ghn.notify("kuroba kyo no tenki wa") != true) {
Serial.println(ghn.getLastError());
return;
}
Serial.println("Done.");
delay(10000);
}
delay(1000);
}
0,1.0,1.1系でもためしてみたけど
Arduino:1.8.5 (Mac OS X), ボード:"Nefry Icing, 115200, None"
ビルドオプションが変更されました。全体をリビルドしています。
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp: In function 'void _on_sys_event(system_event_t*)':
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:48:41: error: 'mdns_handle_system_event' was not declared in this scope
mdns_handle_system_event(NULL, event);
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp: In member function 'bool MDNSResponder::begin(const char*)':
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:57:18: error: too few arguments to function 'esp_err_t mdns_init(tcpip_adapter_if_t, mdns_server_t**)'
if(mdns_init()){
^
In file included from /Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.h:46:0,
from /Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:42:
/Users/n0bisuke/Library/Arduino15/packages/Nefry(ESP32)/hardware/esp32/0.6.0/tools/sdk/include/mdns/mdns.h:59:11: note: declared here
esp_err_t mdns_init(tcpip_adapter_if_t tcpip_if, mdns_server_t ** server);
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:61:31: error: invalid conversion from 'void (*)(system_event_t*)' to 'WiFiEventCb {aka void (*)(system_event_id_t)}' [-fpermissive]
WiFi.onEvent(_on_sys_event);
^
In file included from /Users/n0bisuke/Library/Arduino15/packages/Nefry(ESP32)/hardware/esp32/0.6.0/libraries/WiFi/src/WiFiSTA.h:28:0,
from /Users/n0bisuke/Library/Arduino15/packages/Nefry(ESP32)/hardware/esp32/0.6.0/libraries/WiFi/src/WiFi.h:32,
from /Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:43:
/Users/n0bisuke/Library/Arduino15/packages/Nefry(ESP32)/hardware/esp32/0.6.0/libraries/WiFi/src/WiFiGeneric.h:43:10: note: initializing argument 1 of 'void WiFiGenericClass::onEvent(WiFiEventCb, system_event_id_t)'
void onEvent(WiFiEventCb cbEvent, system_event_id_t event = SYSTEM_EVENT_MAX);
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:64:34: error: 'mdns_hostname_set' was not declared in this scope
if(mdns_hostname_set(hostName)) {
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp: In member function 'void MDNSResponder::end()':
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:72:15: error: too few arguments to function 'void mdns_free(mdns_server_t*)'
mdns_free();
^
In file included from /Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.h:46:0,
from /Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:42:
/Users/n0bisuke/Library/Arduino15/packages/Nefry(ESP32)/hardware/esp32/0.6.0/tools/sdk/include/mdns/mdns.h:67:6: note: declared here
void mdns_free(mdns_server_t * server);
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp: In member function 'void MDNSResponder::setInstanceName(String)':
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:77:43: error: 'mdns_instance_name_set' was not declared in this scope
if(mdns_instance_name_set(name.c_str())){
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp: In member function 'void MDNSResponder::enableArduino(uint16_t, bool)':
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:85:5: error: 'mdns_txt_item_t' was not declared in this scope
mdns_txt_item_t arduTxtData[4] = {
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:92:57: error: 'arduTxtData' was not declared in this scope
if(mdns_service_add(NULL, "_arduino", "_tcp", port, arduTxtData, 4)) {
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:96:82: error: 'mdns_service_txt_item_set' was not declared in this scope
if(auth && mdns_service_txt_item_set("_arduino", "_tcp", "auth_upload", "yes")){
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp: In member function 'void MDNSResponder::disableArduino()':
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:102:46: error: cannot convert 'const char*' to 'mdns_server_t* {aka mdns_server_s*}' for argument '1' to 'esp_err_t mdns_service_remove(mdns_server_t*, const char*, const char*)'
if(mdns_service_remove("_arduino", "_tcp")) {
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp: In member function 'void MDNSResponder::enableWorkstation(wifi_interface_t)':
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:113:65: error: too many arguments to function 'esp_err_t mdns_service_add(mdns_server_t*, const char*, const char*, uint16_t)'
if(mdns_service_add(NULL, "_workstation", "_tcp", 9, NULL, 0)) {
^
In file included from /Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.h:46:0,
from /Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:42:
/Users/n0bisuke/Library/Arduino15/packages/Nefry(ESP32)/hardware/esp32/0.6.0/tools/sdk/include/mdns/mdns.h:108:11: note: declared here
esp_err_t mdns_service_add(mdns_server_t * server, const char * service, const char * proto, uint16_t port);
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:115:79: error: 'mdns_service_instance_name_set' was not declared in this scope
} else if(mdns_service_instance_name_set("_workstation", "_tcp", winstance)) {
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp: In member function 'void MDNSResponder::disableWorkstation()':
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:121:50: error: cannot convert 'const char*' to 'mdns_server_t* {aka mdns_server_s*}' for argument '1' to 'esp_err_t mdns_service_remove(mdns_server_t*, const char*, const char*)'
if(mdns_service_remove("_workstation", "_tcp")) {
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp: In member function 'void MDNSResponder::addService(char*, char*, uint16_t)':
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:140:59: error: too many arguments to function 'esp_err_t mdns_service_add(mdns_server_t*, const char*, const char*, uint16_t)'
if(mdns_service_add(NULL, _name, _proto, port, NULL, 0)) {
^
In file included from /Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.h:46:0,
from /Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:42:
/Users/n0bisuke/Library/Arduino15/packages/Nefry(ESP32)/hardware/esp32/0.6.0/tools/sdk/include/mdns/mdns.h:108:11: note: declared here
esp_err_t mdns_service_add(mdns_server_t * server, const char * service, const char * proto, uint16_t port);
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp: In member function 'bool MDNSResponder::addServiceTxt(char*, char*, char*, char*)':
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:159:59: error: 'mdns_service_txt_item_set' was not declared in this scope
if(mdns_service_txt_item_set(_name, _proto, key, value)) {
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp: In member function 'IPAddress MDNSResponder::queryHost(char*, uint32_t)':
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:170:55: error: 'mdns_query_a' was not declared in this scope
esp_err_t err = mdns_query_a(host, timeout, &addr);
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp: In member function 'int MDNSResponder::queryService(char*, char*)':
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:190:40: error: 'mdns_query_results_free' was not declared in this scope
mdns_query_results_free(results);
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:207:65: error: 'mdns_query_ptr' was not declared in this scope
esp_err_t err = mdns_query_ptr(srv, prt, 3000, 20, &results);
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:221:16: error: invalid conversion from 'const mdns_result_s*' to 'mdns_result_t* {aka mdns_result_s*}' [-fpermissive]
r = r->next;
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp: In member function 'mdns_result_t* MDNSResponder::_getResult(int)':
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:234:26: error: invalid conversion from 'const mdns_result_s*' to 'mdns_result_t* {aka mdns_result_s*}' [-fpermissive]
result = result->next;
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp: In member function 'String MDNSResponder::hostname(int)':
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:245:27: error: 'mdns_result_t {aka struct mdns_result_s}' has no member named 'hostname'
return String(result->hostname);
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp: In member function 'IPAddress MDNSResponder::IP(int)':
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:254:5: error: 'mdns_ip_addr_t' was not declared in this scope
mdns_ip_addr_t * addr = result->addr;
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:254:22: error: 'addr' was not declared in this scope
mdns_ip_addr_t * addr = result->addr;
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:256:31: error: 'MDNS_IP_PROTOCOL_V4' was not declared in this scope
if(addr->addr.type == MDNS_IP_PROTOCOL_V4){
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp: In member function 'IPv6Address MDNSResponder::IPv6(int)':
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:270:5: error: 'mdns_ip_addr_t' was not declared in this scope
mdns_ip_addr_t * addr = result->addr;
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:270:22: error: 'addr' was not declared in this scope
mdns_ip_addr_t * addr = result->addr;
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:272:31: error: 'MDNS_IP_PROTOCOL_V6' was not declared in this scope
if(addr->addr.type == MDNS_IP_PROTOCOL_V6){
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp: In member function 'int MDNSResponder::numTxt(int)':
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:295:20: error: 'mdns_result_t {aka struct mdns_result_s}' has no member named 'txt_count'
return result->txt_count;
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp: In member function 'bool MDNSResponder::hasTxt(int, const char*)':
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:305:23: error: 'mdns_result_t {aka struct mdns_result_s}' has no member named 'txt_count'
while(i < result->txt_count) {
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:306:35: error: request for member 'key' in '*(result->mdns_result_s::txt + ((sizetype)i))', which is of non-class type 'const char'
if (strcmp(result->txt[i].key, key) == 0) return true;
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp: In member function 'String MDNSResponder::txt(int, const char*)':
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:319:23: error: 'mdns_result_t {aka struct mdns_result_s}' has no member named 'txt_count'
while(i < result->txt_count) {
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:320:35: error: request for member 'key' in '*(result->mdns_result_s::txt + ((sizetype)i))', which is of non-class type 'const char'
if (strcmp(result->txt[i].key, key) == 0) return result->txt[i].value;
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:320:73: error: request for member 'value' in '*(result->mdns_result_s::txt + ((sizetype)i))', which is of non-class type 'const char'
if (strcmp(result->txt[i].key, key) == 0) return result->txt[i].value;
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp: In member function 'String MDNSResponder::txt(int, int)':
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:332:27: error: 'mdns_result_t {aka struct mdns_result_s}' has no member named 'txt_count'
if (txtIdx >= result->txt_count) return "";
^
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/ESPmDNS.cpp:333:32: error: request for member 'value' in '*(result->mdns_result_s::txt + ((sizetype)txtIdx))', which is of non-class type 'const char'
return result->txt[txtIdx].value;
^
「WiFi.h」に対して複数のライブラリが見つかりました
使用済:/Users/n0bisuke/Library/Arduino15/packages/Nefry(ESP32)/hardware/esp32/0.6.0/libraries/WiFi
未使用:/Applications/Arduino.app/Contents/Java/libraries/WiFi
exit status 1
ボードNefry Icingに対するコンパイル時にエラーが発生しました。
「ファイル」メニューの「環境設定」から
「より詳細な情報を表示する:コンパイル」を有効にすると
より詳しい情報が表示されます。
esp8266-google-home-notifier の src にある ESPmDNS.cpp/h を削除
Arduino:1.8.5 (Mac OS X), ボード:"Nefry BT R2 / R3, 921600, None"
ビルドオプションが変更されました。全体をリビルドしています。
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/esp8266-google-home-notifier.cpp: In member function 'boolean GoogleHomeNotifier::device(const char*, const char*, int)':
/Users/n0bisuke/dotstudio/Arduino/libraries/esp8266-google-home-notifier/src/esp8266-google-home-notifier.cpp:44:33: error: 'class MDNSResponder' has no member named 'txt'
if (strcmp(name, MDNS.txt(i, "fn").c_str()) == 0) {
^
「WiFi.h」に対して複数のライブラリが見つかりました
使用済:/Users/n0bisuke/Library/Arduino15/packages/Nefry(ESP32)/hardware/esp32/1.2.2/libraries/WiFi
未使用:/Applications/Arduino.app/Contents/Java/libraries/WiFi
exit status 1
ボードNefry BT R2 / R3に対するコンパイル時にエラーが発生しました。
「ファイル」メニューの「環境設定」から
「より詳細な情報を表示する:コンパイル」を有効にすると
より詳しい情報が表示されます。
原因は、esp32ツールのバージョンの問題です。 mdns周りのインターフェースが、2018年1月辺りに変更になってます。
Nefry でもコンパイルできるようにするには、
のどれかの対応が必要か。
@wamisnet さんの 「なんとか」に期待。 https://twitter.com/wamisnet/status/1007511422828343296
Nefry の方に、mDNS で txt レコードが取れるようにする PR を出しました。
これがマージされれば、version 1.0.4 (ESP32 の mDNS は、コアライブラリにお任せバージョン) で Nefry から GoogleHome を喋らせることができると思います。
閉じます
Nefryライブラリ1.2.2です。
ボードでESP32 Dev Moduleを指定した場合はエラーにならないけどNefryBTだとエラーに...