Giter Club home page Giter Club logo

Comments (8)

OttoWinter avatar OttoWinter commented on August 21, 2024

there is a warning about ESPmDNS - do I have to fix that?

Nope, that's just because of the library loading system and arduino-esp32.

Do I have to specify the host including port like this >app.init_mqtt("hassio.local:1883")?

No, there's a second argument for init_mqtt that you can use for ports. The call would then look like this:

app.init_mqtt("hassio.local", 1883, "USERNAME", "PASSWORD");

(but port 1883 is the default anyway, so you can just leave the 1883 out)

In the configuration I added >discovery: True< and >discovery_prefix: discovery<, is anything else needed?

No, that should do the trick.

I can also load the code to my board but Mosquitto Broker doesn't show anything.

Hmm, that's weird... could you look at the serial monitor logs (with baud rate 115200) and see what's being outputted there? Thanks!

from esphome-core.

ameerkamp avatar ameerkamp commented on August 21, 2024

from esphome-core.

ameerkamp avatar ameerkamp commented on August 21, 2024

I now erased the board and loaded your example. I now get this output in the serial monitor:

I (3544) wifi: connected with FRITZBox_AME, channel 11
␛[0;37m[V][wifi_component.cpp:87] on_wifi_event(): [WiFi event] STA IsConnected (4)␛[0m
␛[0;37m[V][wifi_component.cpp:87] on_wifi_event(): [WiFi event] STA got IP (7)␛[0m
␛[0;37m[V][wifi_component.cpp:113] wait_for_connection(): .␛[0m
␛[0;37m[V][wifi_component.cpp:116] wait_for_connection(): WiFi connected.␛[0m
␛[0;37m[V][wifi_component.cpp:117] wait_for_connection(): IP Address: 192.168.178.63␛[0m
␛[0;36m[D][mqtt_client_component.cpp:29] setup(): Setting up MQTT...␛[0m
␛[0;37m[V][mqtt_client_component.cpp:33] setup(): Server Address: hassio.local:1883␛[0m
␛[0;37m[V][mqtt_client_component.cpp:34] setup(): Username: 'mqtt_admin'␛[0m

␛[0;37m[V][mqtt_client_component.cpp:35] setup(): Password: 'Ha-waii1'␛[0m
␛[0;37m[V][mqtt_client_component.cpp:37] setup(): Client ID: 'livingroom-30aea422a46c'␛[0m
␛[0;37m[V][mqtt_client_component.cpp:103] reconnect(): Reconnecting to MQTT...␛[0m
␛[0;37m[V][mqtt_client_component.cpp:106] reconnect(): Attempting MQTT connection...␛[0m
I (6518) wifi: pm start, type:0

␛[0;33m[W][mqtt_client_component.cpp:130] reconnect(): failed, rc=-2␛[0m
␛[0;33m[W][mqtt_client_component.cpp:131] reconnect(): Try again in 1 second␛[0m
␛[0;37m[V][mqtt_client_component.cpp:106] reconnect(): Attempting MQTT connection...␛[0m

So in Homeassistant I can't see it while my Sonoff Switch with tasmota software works fine.

from esphome-core.

OttoWinter avatar OttoWinter commented on August 21, 2024

Hmmm, it seems like the MQTT broker isn't accepting your connection. At least PubSubClient (the library that's used here to send/receive MQTT messages) is saying there's a return code -2 (MQTT_CONNECT_FAILED). It's especially puzzling to me since Sonoff-Tasmota and esphomelib both use PubSubClient under the hood...

From what I see, you're using hassio.local as the server address. Could you maybe check for me if there's something in the hass.io logs. Could you maybe also try using an IP instead of hassio.local?

Also, I see your serial monitor isn't set up to handle the color codes ([0;37m and so on) . If you're on a unix machine, you can use platformio device monitor --raw [...] to have beautiful color coded log messages like this:
screen shot 2018-03-24 at 12 15 02

from esphome-core.

ameerkamp avatar ameerkamp commented on August 21, 2024

After using the ip adress it works somehow:

1521890939: New connection from 192.168.178.63 on port 1883.
1521890939: New client connected from 192.168.178.63 as livingroom-30aea422a46c (c1, k15, u'mqtt_admin').
1521891547: New connection from 192.168.178.63 on port 1883.
1521891547: Client livingroom-30aea422a46c already connected, closing old connection.
1521891547: Client livingroom-30aea422a46c disconnected.
1521891547: New client connected from 192.168.178.63 as livingroom-30aea422a46c (c1, k15, u'mqtt_admin').

But I can't see it in Homeassistant. My Sonoff is shown in the Overview as well as in the States window.

from esphome-core.

OttoWinter avatar OttoWinter commented on August 21, 2024

Ok, some progress πŸ˜… (I will look into the IP thing later, it should definitely be fixed)

First, what version of esphomelib are you using? In 1.1.0 I changed the default discovery_prefix to Home Assistant's default: homeassistant/, so you might need to remove discovery_prefix if you have updated the library with platformio lib update.

Next, do you have a program with which you can see the MQTT messages under a specific topic? Then you could see what's under homeassistant/+/livingroom/# (or discovery/+/livingroom/# if you're using 1.0.0)

Thanks very much!

from esphome-core.

ameerkamp avatar ameerkamp commented on August 21, 2024

I think its something within my Hassio installation. In the log I find these messages and I will try to fix these first before another attempt with your lib:

2018-03-25 15:20:03 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: (sqlite3.DatabaseError) database disk image is malformed (Background on this error at: http://sqlalche.me/e/4xp6) (retrying in 3 seconds)
2018-03-25 15:20:06 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: (sqlite3.DatabaseError) database disk image is malformed (Background on this error at: http://sqlalche.me/e/4xp6) (retrying in 3 seconds)
2018-03-25 15:20:09 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: (sqlite3.DatabaseError) database disk image is malformed (Background on this error at: http://sqlalche.me/e/4xp6) (retrying in 3 seconds)
2018-03-25 15:20:11 WARNING (MainThread) [homeassistant.setup] Setup of recorder is taking over 10 seconds.
2018-03-25 15:20:12 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: (sqlite3.DatabaseError) database disk image is malformed (Background on this error at: http://sqlalche.me/e/4xp6) (retrying in 3 seconds)
2018-03-25 15:20:15 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: (sqlite3.DatabaseError) database disk image is malformed (Background on this error at: http://sqlalche.me/e/4xp6) (retrying in 3 seconds)
2018-03-25 15:20:19 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: (sqlite3.DatabaseError) database disk image is malformed (Background on this error at: http://sqlalche.me/e/4xp6) (retrying in 3 seconds)
2018-03-25 15:20:22 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: (sqlite3.DatabaseError) database disk image is malformed (Background on this error at: http://sqlalche.me/e/4xp6) (retrying in 3 seconds)
2018-03-25 15:20:25 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: (sqlite3.DatabaseError) database disk image is malformed (Background on this error at: http://sqlalche.me/e/4xp6) (retrying in 3 seconds)
2018-03-25 15:20:28 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: (sqlite3.DatabaseError) database disk image is malformed (Background on this error at: http://sqlalche.me/e/4xp6) (retrying in 3 seconds)
2018-03-25 15:20:31 ERROR (Recorder) [homeassistant.components.recorder] Error during connection setup: (sqlite3.DatabaseError) database disk image is malformed (Background on this error at: http://sqlalche.me/e/4xp6) (retrying in 3 seconds)
2018-03-25 15:20:31 ERROR (MainThread) [homeassistant.setup] Setup failed for recorder: Component failed to initialize.
2018-03-25 15:20:31 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of history. Setup failed for dependencies: recorder
2018-03-25 15:20:32 ERROR (MainThread) [homeassistant.setup] Setup failed for history: Could not setup all dependencies.
2018-03-25 15:20:33 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of logbook. Setup failed for dependencies: recorder
2018-03-25 15:20:33 ERROR (MainThread) [homeassistant.setup] Setup failed for logbook: Could not setup all dependencies.
2018-03-25 15:20:53 WARNING (SyncWorker_12) [netdisco.ssdp] Found malformed XML at http://192.168.178.32:9080: status=ok

from esphome-core.

ameerkamp avatar ameerkamp commented on August 21, 2024

I fixed that but it doesn't change anything. In the Mosquitto log I see that livingroom-30aea422a46c is found but in the states windows it doesn't show up. I will give up on this for now and maybe reinstall hassio at a later point in time. Thanks for your help!

from esphome-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.