Good question. Perhaps
connection_messages true
see mosquitto.conf man page | Eclipse Mosquitto for all options. Also I am not 100% sure if “all” includes “debug”.
Good question. Perhaps
connection_messages true
see mosquitto.conf man page | Eclipse Mosquitto for all options. Also I am not 100% sure if “all” includes “debug”.
hmmm it’s odd but I’m not getting the bridge showing up at all in the logs. It’s in my mosquitto.conf file and I know it’s picking all of the details from that file so unclear what is wrong.
Here is my mosquitto.conf. Am I doing something wrong? Is there any way to
persistence true
persistence_location /mosquitto/data/
listener 1883
log_dest file /mosquitto/log/mosquitto.log
log_type debug
log_timestamp_format %Y-%m-%dT%H:%M:%S
connection_messages true
## Authentication ##
#allow_anonymous false
password_file /mosquitto/config/password.txt
connection lollipop_mqtt
address 192.168.1.208:1883
bridge_insecure true
notifications false
try_private false
bridge_cafile /mosquitto/certs/lollipop.cer
local_username <username>
local_password <password>
topic # in 0 lollipop/ MElFAuie5o/
I’ve replaced my username and password with and
I probably don’t know enough about mqtt bridging to be any more help.
EDIT: maybe here Mosquitto MQTT Bridge-Usage and Configuration
For me its still working.
I have all files in share/mosquito folder and this link is in .conf file
bridge_cafile /share/mosquitto/certs/lollipop.crt
im not sure, but when you change mosquitto addon config (active true in customize section), .conf file need to be in share\mosquitto folder.
whats your files location?
thanks - I’m running HA core so have MQTT set up in a separate docker instance as opposed to within HA as an add-on (that option doesn’t exist for HA Core)
I can see the bridge in the logs now but it just says:
2022-09-14T21:05:37: Connecting bridge lollipop_mqtt (192.168.1.208:1883)
There’s no other logs and I have it on log_type debug. it’s very odd
ok - so turned out to be an issue w/ the new version of MQTT. I’ve downgraded to 2.0.14 and it works fine… sorry for the trouble
Out of interest, what version gave you trouble.
2.0.15 (latest)
See discussion here: 2.0.15 regression: bridge is not created, with "Expiring client local.xxx due to timeout" · Issue #2634 · eclipse/mosquitto · GitHub
First of all thanks to this thread so I could configure my Home Assistant instance and Mosquitto to receive the messages from the camera.
I went one step further, because I wanted to have a Switch in Home Assistant to enable/disable Sleep Mode on the camera, and guess what: it’s done by MQTT.
The first thing is that with the configuration provided in this thread, the bridge between the two MQTT servers is only one direction (from lollipop to your Mosquitto server). So you receive the messages from the camera to your Mosquitto topic, but if you send messages to that topic, the camera doesn’t receive them.
To enable bi-directional bridge the only thing needed to change is the last line:
topic # in 0 lollipop/ <main camera topic>/
to
topic # both 0 lollipop/ <main camera topic>/
Now the messages sent to the lollipop/
topic in your Mosquitto server will be received by the camera.
Next step we need to configure the Switch by itself, that means: sending the ON and OFF commands to enable and disable the Sleep Mode, and also getting the status of the Sleep Mode. Everything can be achieved using MQTT.
To enable/disable the sleep mode we need to send a json message to the lollipop/camSetting
topic.
The message should be something like:
{"method": "camSetting", "params": { "standby_mode": false }, "id": 14}
The id
attribute can have any numeric value, the only thing that changes between enabling and disabling sleep mode is the boolean value of standby_mode
attribute.
Now we need the status of the Sleep mode, we can get this from the lollipop/cameraStatus/return
topic, it publishes messages like:
42["messageReply",{"method":"cameraStatus","id":20,"params":{"appSessionId":null,"info":"owner"},"result":{"status":1,"bindSensor":"","bindSensorName":"","bindStatus":1,"temp":-1000.0,"humidity":-1000.0,"noise":60.159999999999997,"air":-1000.0,"wifiSsid":"MyWiFi","wifiQuality":82.0,"playingMusic":false,"firmwareVersion":"2022041400-g5bca956","standby_mode":false,"privacyMode":false}}]
As you can see, this is something similar to a JSON message, but it’s not exactly a JSON.
Last thing: as the messages on this topic are not retained, we need to publish a message on the lollipop/cameraStatus
topic to get the status on the previous topic. The message should be like:
{"params": { "info": "owner" }, "id": 20, "method": "cameraStatus" }
Every time you publish this message to the topic, then it returns the status on the previous topic.
So now that we know how it works, it’s time to configure the Switch!
In your configuration.yaml
, you can define it in mqtt/switch section like:
- name: "Lollipop Sleep Mode"
state_topic: "lollipop/cameraStatus/return"
value_template: "{{ 'ON' if (value[18:-1]|from_json).result.standby_mode else 'OFF' }}"
json_attributes_topic: "lollipop/cameraStatus/return"
json_attributes_template: "{{ (value[18:-1]|from_json).result|tojson }}"
command_topic: "lollipop/camSetting"
state_on: "ON"
state_off: "OFF"
payload_off: '{"method": "camSetting", "params": { "standby_mode": false }, "id": 14}'
payload_on: '{"method": "camSetting", "params": { "standby_mode": true }, "id": 14}'
unique_id: "lollipop_sleep_mode"
As you can see, the only “tricky” thing is that we need to do a substring of the returned status message to get the json formatted content, everything else is exactly what we talked before.
Only one thing remains: Create an automation to keep the status always updated.
So the triggers for the automation must be two:
lollipop/camSetting/return
The second is because, every time the standby_mode
changes (from Home Assistant or from the app), a message is sent to that topic.
No conditions are needed for this automation.
And the action must be publish a MQTT Message to lollipop/cameraStatus
as we’ve seen before:
{"params": { "info": "owner" }, "id": 20, "method": "cameraStatus" }
After this, we can reboot Home Assistant and we’ll have a Switch to control the Sleep Mode of the camera.
I hope this can be useful to somebody!
@XPatt
Thanks Xavi! This is very interesting. Is there a way to start the music via this method? Do you know what the payload needs to be?
If anybody is interested, I’ve managed to get this to work using the starting point from @XPatt in terms of the mqtt set up.
For the switch, I used the below code:
mqtt:
switch:
- name: "Lollipop Music Mode"
state_topic: "lollipop/musicStatus/return"
value_template: "{{ (value[17:-1]|from_json).result.playStatus }}"
json_attributes_topic: "lollipop/musicStatus/return"
json_attributes_template: "{{ (value[17:-1]|from_json).result|tojson }}"
command_topic: "lollipop/controlMusic"
state_on: "play"
state_off: "pause"
payload_off: '{"method": "controlMusic", "params":{"playStatus":"pause","repeatStatus":"one"},"id": 0}'
payload_on: '{"method":"controlMusic","params":{"playStatus":"play","repeatStatus":"one"},"id":0}'
unique_id: "lollipop_control_music"
I didn’t seem to need to run the automation / use the CameraStatus mechanism as I found the musicStatus topic seems to load / update automatically.
Thanks for the idea!
Nice job @gerardsyd!
Sorry, I didn’t know how to do it because I never use the music functionality.
It seems that everything can be managed through MQTT!
Hi everyone - just wanted to check if your connection is still working? I can’t see lollipop in my MQTT broker any more. Haven’t changed any settings so not sure what is going on. Tried re-downloading the certificate but doesn’t seem to have made a difference. Just checking if anyone else is having issues? using Mosquitto 2.0.14 as per before - haven’t changed any other settings
Hi,
Same here, it doesn’t work anymore since the last update.
Even in MQTT explorer, I can’t connect to the lollipop camera.
Hi !
Found this in another site (from James)
Just a quick note – it seems there was a firmware update recently which introduced authentication on the MQTT and RTSP connections. Thankfully I was able to packet capture the lollipop app using PCAPDroid, and find the credentials on the initial RTSP request (since it’s still unencrypted) and add them to HomeAssistant to get it working again.
And from another person ( Tyler)
For anyone with HTTP digest auth that can’t get the login off a packet trace, the full URL (including username/password) is available if you have a rooted Android phone. In com.aoitek.lollipop\databases\LollipopProvider.db you’ll find the baby_camera table with a internal_live_url column.
Hope this can help
Thanks - this seems to be more for the RTSP video feed. I’ve tried multiple ways to get this to work for mqtt and can’t see to get it to work.
Hello
Since 10 days the MQTT transmission does not work anymore. Yesterday I updated the firmware and now even the Gneric Camera transmission no longer works. Does anyone have an idea or workaround?
I followed the steps from @caear1987 and it seems like my Lolipop bridge is running based on the Mosquitto log messages:
2023-06-29 09:40:17: Connecting bridge lollipop_mqtt (192.168.1.112:1883)
2023-06-29 09:40:17: mosquitto version 2.0.15 running
But I am unable to receive the topic data. Is there something wrong with my configurations?
mosquitto.conf:
connection lollipop_mqtt:
address 192.168.1.112:1883
bridge_insecure true
notifications false
try_private false
bridge_cafile /share/mosquitto/certs/lollipop.cer
topic # in 0 lollipop/ xdTfzt0UaA/
configuration.yaml:
mqtt:
sensor:
- name: "Lollipop Noise"
state_topic: "lollipop/liveNote"
value_template: "{{ value_json.result.noise | round(1) }}"
Full Mosquitto log:
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/mosquitto.sh
[09:40:15] INFO: Certificates found: SSL is available
cont-init: info: /etc/cont-init.d/mosquitto.sh exited 0
cont-init: info: running /etc/cont-init.d/nginx.sh
cont-init: info: /etc/cont-init.d/nginx.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun mosquitto (no readiness notification)
services-up: info: copying legacy longrun nginx (no readiness notification)
s6-rc: info: service legacy-services successfully started
[09:40:17] INFO: Starting NGINX for authentication handling...
[09:40:17] INFO: Starting mosquitto MQTT broker...
1688020817: Loading config file /share/mosquitto/mosquitto.conf
1688020817: Warning: Bridge lollipop_mqtt using insecure mode.
2023-06-29 09:40:17: Warning: Mosquitto should not be run as root/administrator.
[09:40:19] INFO: Successfully send discovery information to Home Assistant.
[09:40:20] INFO: Successfully send service information to the Supervisor.
2023-06-29 09:40:17: mosquitto version 2.0.15 starting
2023-06-29 09:40:17: Config loaded from /etc/mosquitto/mosquitto.conf.
2023-06-29 09:40:17: Loading plugin: /usr/share/mosquitto/go-auth.so
2023-06-29 09:40:17: ├── Username/password checking enabled.
2023-06-29 09:40:17: ├── TLS-PSK checking enabled.
2023-06-29 09:40:17: └── Extended authentication not enabled.
2023-06-29 09:40:17: Opening ipv4 listen socket on port 1883.
2023-06-29 09:40:17: Opening ipv6 listen socket on port 1883.
2023-06-29 09:40:17: Opening websockets listen socket on port 1884.
2023-06-29 09:40:17: Opening ipv4 listen socket on port 8883.
2023-06-29 09:40:17: Opening ipv6 listen socket on port 8883.
2023-06-29 09:40:17: Opening websockets listen socket on port 8884.
2023-06-29 09:40:17: Connecting bridge lollipop_mqtt (192.168.1.112:1883)
2023-06-29 09:40:17: mosquitto version 2.0.15 running
I ended up getting it working by switching over to Node-Red:
mqqt out
node into a flow in NodeRed.Server
drop-down list select Add new mqtt-broker...
and then click edit.Add new mqtt-broker config node
panel, enter a name (eg: Lollipop MQTT
) and the Lollipop server (eg: 192.168.1.123
) with port 1883
.Connect automatically
.Use TLS
.Add new tls-config...
and click editAdd new tls-config node
panel, click the Upload
button for Certificate
and browse your computer for your saved Lollipop’s certificate (refer to caear1987’s post above for extracting the certificate).Lollipop Certificate
).Add
to save and close the panel.Edit mqtt out node
panel. Set the Topic
to: [YOUR_CAMERA_TOPIC]/liveNote
(again, refer to caear1987’s post above for obtaining your camera topic name).Are you not using private key for the exported cert? What firmware is your camera running?