This is my config. If there is no entity created something must be wrong where you put the sensor (in which yaml under which part). Even if the state_topic or the device_id is wrong an entity would be created and the beacon would just not be found as i remember in my first steps with mqtt_room.
So this one has to be in the sensors: section where all the other sensors are when not using a sensors.yaml and not !include sensors.yaml.
Got it working.
Seems my config.yaml needed some serious tidying up.
Thanks for your help.
Now, I’ve got to figure out how to get ESPresense to update quicker.
Hey @madface how can I achieve quick and fast change of detection? I have followed what you have done on the companion app but my status between 2 rooms which are 3m apart takes easily 30second and sometime 2 minutes.
To be honest, i’m using it for presence detection at home but not for room level, so i don’t have experience how fast it changes between the rooms. I did a short test and sometimes it jumps between the rooms and sometimes it takes about 20 seconds the sensor changes, even if im 50cm in front of the sensor i walked to.
I think the problem relies to the distance espresense reports, when you walk it does not submit the really new distance but more a meridian of the last 10-20 distances (you can see the distance slowly in- / decreases in mqtt messages).
I’am using the device_tracker.see service, here is an example:
- id: devtrac_set_mike_bt_room_home_nothome
alias: DEVTRAC - Mike BT Room home or not home # device tracker mike_bt_room auf home/not_home setzen
initial_state: true
trigger:
- platform: state
entity_id: sensor.ibeacon_handy_mike
to: 'az'
id: 'home'
- platform: state
entity_id: sensor.ibeacon_handy_mike
to: 'not_home'
id: 'not_home'
action:
- choose:
- conditions:
- condition: trigger
id: 'home'
sequence:
- service: device_tracker.see
data:
dev_id: mike_bt_room
location_name: 'home'
source_type: bluetooth
default:
- service: device_tracker.see
data:
dev_id: mike_bt_room
location_name: 'not_home'
source_type: bluetooth
This device tracker can be used for the person integration.
Disadvantage is that the device tracker does not survice a restart (i doesn’t remember the last state). I am setting it with another automation which sets it according to my gps tracker of the companion app when system restarts.
If anyone knows a better way i would be happy.
No, this ist an automation which sets the device tracker every time the mqtt sensor changes. For every room you need one trigger, for example:
- platform: state
entity_id: sensor.ibeacon_handy_mike
to: 'livingroom'
id: 'home'
- platform: state
entity_id: sensor.ibeacon_handy_mike
to: 'kitchen'
id: 'home'
It uses the device_tracker.see service to create a “template” device tracker which can be used for the person intregration.
Hoping for some help; running into the same issue getting the tracking entity to update with the information coming from MQTT. I can see the data in MQTT Explorer coming through in the right place (state: front_entry and distance 0.06). But clearly something wrong with my beacon entity because it’s not showing up with any information. State says “not_home” and distance says “null”.
How does yours look? The device_id in the mqtt sensor must match the id, in my case it would be the hole iBeacon:8f3328a6-eacc-4f4a-8219-ffffffff-100-1
And my state topic is espresense/rooms only with s without a c.
Yup, totally my fault. Didn’t match the spelling of “presense”…change the c to s and everything works just fine. Thanks for catching that…I can’t believe I missed it.
Yesterday I tried to setup ESPresense in Home Assistant to track room occupancy.
It worked quite well, as I have the MQTT-sensor of the ESP32 and the sensor of my tracking device which is a Fitbit Inspire 2.
The Fitbit is NOT connected to any mobile device as we just use it as a device tracker. I found the device in the MQTT-Explorer with its device_id.
But my problem is, that espresense doesn’t update the device state regularely. When I restart Home Assistant, the device detected and the distance is quite correct. But when I leave the room for maybe a meter, the distance remains the same and the sensor still says living room.
At the moment we are 15km away from our home and in home assistant it still says that the fitness tracker is in the living room. But it’s definitely not, it’s here with us.
So where is my fault? I’d really appreciate your help.
Thank you.
I have now been googling for the last 2 days as I don’t get across my problem. I’ve tried to set up Espresense with my HA and have used exactly the ID I’m seeing in MQTT Explorer for the configuration.yaml configuration of the device I want to see:
All my BT devices are sending data to my HA Mosquitto Broker and I can also see them in MQTT Explorer - so it’s something that’s related to the set-up in configuration.yaml.
This is an excerpt of the messages I’m seeing in MQTT Explorer for my phone, which I’d like to add as an entity in HA:
As you can see:
I have used the exact same device_id as shown in MQTT Explorer
I have used the exact same state_topic as shown in MQTT Explorer
I’ve tried many different ways to make this device appear in HA and have also tried very long timeouts- but no additional entity is added in HA / MQTT even though the code seems to be correct?
Does any one have any clue what could still be wrong here?
I thought I had to use the same state_topic as the one I’m seeing in MQTT Explorer. But with “espresense/rooms” it does indeed work now. Yay!!! Thank you