Mosquitto get data from another MQTT Broker - lollipop camera

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!

1 Like

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

1 Like

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:

  1. Add a mqqt out node into a flow in NodeRed.
  2. Double click it to edit.
  3. From the Server drop-down list select Add new mqtt-broker... and then click edit.
  4. From the 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.
  5. Enable Connect automatically.
  6. Enable Use TLS.
  7. Select Add new tls-config... and click edit
  8. From the Add 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).
  9. Give it a name (eg: Lollipop Certificate).
  10. Click Add to save and close the panel.
  11. Repeat, and you should now be back at the 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?

The certificate does not contain a private key.
My Lollipop’s firmware is a few years old (2021080500-g6056a09).

ah ok that is why. With the 202302 firmware they started requiring authentication. That is what we are trying to crack

1 Like

Ah, understood. Yeah I’m not planning to upgrade.

By initial RTSP request do you mean on first time connecting via the app or during initial camera setup? I’ve tried both but don’t seem to see any credentials captured in my PCAPDroid RTSP logs. I can find the rtsp://192.168.0.XXX:554/live/long_hex_code/ch00_0 address in these logs, but don’t seem to have a username or password jumping out at me. Was there a specific part of the RTSP logs that you needed to look at to glean this info - or a particular way of triggering that initial unencrypted exchange of credentials? Apologies if this is obvious in the other site input you referred to from James - but I couldn’t find a link to that or any hits from a web search.

Really hoping to get the RTSP packet capture method working, but as a side note - would you be able to share the form of the username/password (i.e. the character types used, length, etc.) - in case I need to try and brute force crack the credentials?

Cheers

A detailed guide on how to get the rstp stream is available here:

Just tested with the latest firmware 2024013000-g9fd07da
Has anyone had progress on how to connect to the MQTT server?
Thanks!