Wireless Sensors Displayed Direct to Android Phone on Node-Red Dashboard

I am trying to set up a wireless sensor system for a project idea and need to be able to have sensor data show up on my android phone somewhat like a digital dashboard/instrument cluster.
I would like to use ESPHome, Node-Red and or Home Assistant to do this (because i am familiar with them) but not married to that idea.
So far this is what i have done:

  1. Flashed my esp8266 d1 mini with ESPHome .
  2. Installed “MQTT Broker App” from google play store.
  3. Installed “RedMobil” from google play store.
  4. Setup my d1 mini to communicate via mqtt with info from here
    MQTT Client Component — ESPHome
  5. Put my phone in Hotspot mode and disconected from my local network and set the “wifi:” perimeters in esphome to match my phones hotspot connection. And reflashed the d1 mini.

At this point i have an mqtt broker running on my phone as well as Node-Red and the d1 mini is connected to my phones wifi hotspot. I have tested communication between node-red and the mqtt broker running on my phone using “mqtt in” and “mqtt out” nodes in node-red and they are communicating great.
The broker is running at 0.0.0.0:1983 and Node-Red is running at 127.0.0.1:2083 and i set up esphome code to point at the broker but i cant see the messages being sent from the d1 mini in the broker or node red.
I tested the setup using my existing local network broker and node-red instance and can see the messages coming from the d1 mini and even setup a dashboard showing some temp and humidity info so i know the d1 mini is sending the messages but it says it cant connect to the broker when connected to my phones hotspot.
I am almost there and i am sure its something to do with the ip addresses but i am stumped at this point.
Again i just want a direct connection between my phone and the d1 mini so that i can set up a dashboard to show sensor data on my phone with no local network or internet.
Sooo Sorry for the long post but i do not know how else to word it and give all info needed.

Any Ideas?
Thanks in advance for any help!

These are in two completely different subnets - did you type them incorrectly?

Also I think what you are trying is doomed to fail.

Those are loopback addresses - supplied by the apps I assume? When you turn on hotspot on your phone it effectively turns off wifi access for your phone’s apps.

Not 100% sure but I suggest you ask the question on an Android phone forum.

[quote="zoogara, post:2, top

Yes you are correct, the apps applied those addresses. Thanks for the info, I’ve never seen the 0.0.0.0 address before but it worked for node red so I figured what the heck. I will ask on an Android forum as well, was really hoping that it was something that I was missing in hotspot network setting. Thanks again for the help.

There may be another way to do what you want - just testing… :slight_smile:

Ok - I thought maybe you could use the built in AP Mode and Web Interface for ESPHome, but it seems that it is specifically designed to let you connect to a Wifi network and not much else. Was worth a try I suppose. :slight_smile:

I built an ESP32 based device that presents it’s sensors to a mobile, but that is using C++ and creates it’s own AP and web server. The link is below but the documentation never got finished so it may be a challenge to modify for your purposes - sorry. If you have developed code for Arduino before then you may find it useful.

Wow !! I love the idea for the level, I would love to have that setup for my rv! Unfortunately I think it above my skill level. My actual code experience is limited to yaml (very limited),lol.
Thank you soo much for taking the time to try and help. I really thought it was gonna be easy when the broker installed, hooked up to node red and started talking with almost no effort at all. Oh well, maybe ill find something by changing my focus to android rather than esphome. Thanks Again!

Woo Hoo !! I knew it had to be something simple! Thanks to @zoogara for getting the wheels turning!
All you have to do to make this work is follow the steps outlined in my first post except when flashing the d1 mini with mqtt instructions replace the 0.0.0.0 ip address of the mqtt broker (FYI This address means all addresses on host device.) with the address found by opening your android phone settings, scroll to the bottom, select “about phone” , select “Status Information”, your brokers address will be the first address listed under “ip address” (be sure you are disconnected from wifi and hotspot has been on for about 30 sec). Make sure you have the fallback hotspot installed on the d1 mini before flashing incase something goes wrong! Now I can build my Node-Red dashboard and get sensor values or operate switches wifi-direct/p2p from my android phone with no local wifi router or internet!After i try this out for a few days i will write follow up. Thanks again @zoogara

1 Like

Good to see and what’s more I have learned something about wifi on android…

I’m sorry I haven’t read the full thread… so may be jumping to conclusions here…

Can’t you push data to Home Assistant then use the Home Assistant android app and use the widgets to set up a custom home page?

The android widgets are actually quite useful.