Closed juanka99 closed 1 year ago
Can you telnet to 192.168.1.223 from you computer? telnet 192.168.1.223 Put in "help" and get an answer?
Check if infos are written to MQTT. Use a tool like MQTTExplorer. If you connect to your MQTT server (192.168.1.82) you should see entries on top level named "pytes". There must be also a top level Entry named "homeassistant" for HA auto discovery.
In HA there must be the integration "MQTT" installed. This integration has an auto discovery feature which looks in "homeassistant" in MQTT.
Is it mandatory to have the RS232 adapter connected for the mqtt connection to work? I only have the ESP32. I haven't received the RS232 adapter yet...
Without an RS232 adapter you don't get entities but the error Message should not show up if MQTT server is available and properly configured.
Looks like your MQTT IP or USER or PASSWORD is not correct.
Normally Homeassitant IP and an Homeassistant User and his Password. And you have "Mosquito Broker" installed as an agent in Homeassistant.
Without an RS232 adapter you don't get entities but the error Message should not show up if MQTT server is available and properly configured.
Looks like your MQTT IP USER or PASSWORD is not correct.
Normally Homeassitant IP and an Homeassistant User and his Password. And you have "Mosquito Broker" installed as an agent in Homeassitant.
IP, USER and PASSWORD are correct. The same I use in MQTT Explorer:
If MQTT explorer works, the ESP32 should also.
Double check user and pasword please.
Looks like all is on the same network (192.168.1.x). MQTT uses a normal TCP/IP connection on port 1883 on default. Can you ping/telnet the ESP32 from homeassistant console?
If you remove the comment from line 1 in src/main.cpp you enable SIMULATION and no serial is needed.
If MQTT explorer works, the ESP32 should also.
Double check user and pasword please.
Looks like all is on the same network (192.168.1.x). MQTT uses a normal TCP/IP connection on port 1883 on default. Can you ping/telnet the ESP32 from homeassistant console?
If you remove the comment from line 1 in src/main.cpp you enable SIMULATION and no serial is needed.
I have check 3 times user and password. And I ping the ESP32 from Homeassistant without problem:
Hi again,
My ESP32 is like this. Could be this the problem?
Or the mqttServer IP?
You are right, I was totally out of my mind coding the mqttServer config.
Please adjust line 78 for now for your needs. I'll will fix the code these days.
You are right, I was totally out of my mind coding the mqttServer config.
Please adjust line 78 for now for your needs. I'll will fix the code these days.
Ok. I'll do it this afternoon when I get home. I'll let you know how the change has gone.
You are right, I was totally out of my mind coding the mqttServer config.
Please adjust line 78 for now for your needs. I'll will fix the code these days.
I adjust line 78 with IPAddress mqttServer(192, 168, 1, 82); and all it´s same. It doesn´t work
Is there anything else I have to edit to make it work?
I'm about to give up :-(
Please change line 766 to your user and password. As i said forgot to use the configured values for MQTT. Sorry.
Otherwise there should be time on weekend to fix and debug it myself.
Please change line 766 to your user and password. As i said forgot to use the configured values for MQTT. Sorry.
Otherwise there should be time on weekend to fix and debug it myself.
Line changed and now this is MQTT Explorer test:
MQTT is now connected. :-)
If you wanna see simulated data as long you have no serial connected remove the "//" in line 1 to define SIMULATION
MQTT is now connected. :-)
If you wanna see simulated data as long you have no serial connected remove the "//" in line 1 to define SIMULATION
Done!
Only this:
You have to connect RX and TX via wire on the ESP32 for SIMULATION to work. Or wait for your level shifter. Simulation writes to pytes2 instead of pytes. And auto discover to pytes2_discover instead of homeassistant.
You have to connect RX and TX via wire on the ESP32 for SIMULATION to work. Or wait for your level shifter. Simulation writes to pytes2 instead of pytes. And auto discover to pytes2_discover instead of homeassistant.
RX and TX connected via wire, but no new entities in homeassistant:
I need more info of your background. Are you new to HA and MQTT?
Homeassistant is mostly plug and play but you need to know some basics. The MQTT integration in Homeassistant (HA) looks in the "homeassistant" topic in MQTT for autodiscovery. The simulation intentionally writes to "pytes2_discover" instead of "homeassistant" otherwise tye entities will show up in your HA and need to get rid of them in your history afterwards. If you want to see them in your HA change the string "pytes2_discover" to "homeassistant".
The simulation was intented for me to see if the MQTT topics are filled in correct and the communication works.
MQTT is an universal tool. If you don't to use HA you can easily use any other home atomation system subscribing to the pytes(2) topics "pytes2/bat/1/volt" for example like NodeRed.
You have to get the whole picture. eboxToMqtt -> MQTT (topics: "homeassistant" for autodiscovery and "pytes" for values) -> homeassitant: MQTT integration
Hi again!
I have received the level shifter, I have connected it to the ESP32 and the Pytes, and the entities still do not appear in HA. I think there must be some other parameter in the configuration that needs to be changed and you don't remember it... Could this be?
It is important to check the whole dataflow
Put the "//" back in before line 1 SIMULATION. build and reflash the ESP32.
Delete PYTES2 stuff in MQTT explorer
check with telnet if you get an answer on "help" comand from PYTES. If not: RX and TX has to be swapped.
You should have an pytes topic in MQTT with actual values "pytes/bat/1/1/volt". There should be an homeassistant topic in MQTT "homeassistant/sensor/pytes_bat_1_1/volt/config".
containing:
{ "name": "pytes_bat_1_1_volt", "unique_id": "pytes/bat/1/1/volt", "state_topic": "pytes/bat/1/1/volt", "device_class": "voltage", "state_class": "measurement", "qos": 0, "unit_of_measurement": "V", "value_template": "{{ value_json.value }}", "availability_mode": "all", "device": { "identifiers": [ "pytes/bat/1/1/volt" ], "name": "pytes bat1 1 (volt)", "sw_version": "" } }
You need to have the MQTT intergration added in HA:
:-)
SIMULATION was already disabled
Could you tell me exactly what command I have to use to know if there is communication with the batteries?
No homeassistant topic appears. Only the one in the following image:
I don't know what else :to try anymore. I am totally heartbroken :-((
Before you can go further Step 2 has to function. Otherwise no data will be filled in MQTT and due to this there are no entitys in HA.
This is the help direct from your battery's.
If this doesn't work the Serial connection is not established.
I checked your ESP32 photo. You used the wrong pins. You have to use the serial Interface on the ESP32. On your ESP32 Board it is on the pins marked RXD and TXD not G16 and G17.
https://medesign.seas.upenn.edu/uploads/Guides/NodeMCUPinout.png
If it doesn't work just switch the RX and TX Cable and give it a try.
Try put in "help" as command in telnet and press ENTER. If you get help youre nearly done. I'll bet the is the last problem. If "help" worked and no entities showing up please show the content of "homeassistant" in MQTT explorer.
A doubt:
I checked your ESP32 photo. You used the wrong pins. You have to use the serial Interface on the ESP32. On your ESP32 Board it is on the pins marked RXD and TXD not G16 and G17.
https://medesign.seas.upenn.edu/uploads/Guides/NodeMCUPinout.png
If it doesn't work just switch the RX and TX Cable and give it a try.
Try put in "help" as command in telnet and press ENTER. If you get help youre nearly done. I'll bet the is the last problem. If "help" worked and no entities showing up please show the content of "homeassistant" in MQTT explorer.
Any change here?
Sorry i also have mixed up things. G16 and G17 on you board is correct! If "help" doesn't work just try connecting them the other way round.
Can you send detailed photos of ESP32, level shifter, western connector and your pytes front panel?
Sorry i also have mixed up things. G16 and G17 on you board is correct! If "help" doesn't work just try connecting them the other way round.
Can you send detailed photos of ESP32, level shifter, western connector and your pytes front panel?
All tests done. Everything remains the same. The "help" command still doesn't work.
I rechecked the serial pins with your kind of ESP32 board these are correct (G16 and G17).
The last thing i see, is Green and Green/White are the other way round on my connection on the level shifter and Yellow and Green are the other way round.
so: 16/green on txd on ttl side of level shifter 17/yellow on rxd on ttl side of level shifter
green on txd on rs232 side of level shifter green/white on rxd on rs232 side of level shifter
Working!!!
Here was the problem:
Thank you for all!!!
Yeah !!! Congrats to try so hard.
MQTT config is fixed
I have flashed the ESP32 and this is the captive portal:
No sensors appairs in Home Assistant mqtt... What I have to do?