Code Monkey home page Code Monkey logo

Comments (3)

PetrJakes avatar PetrJakes commented on May 31, 2024

When JSON configuration is published as retain, all works as expected (wifi-presence reads configuration from the retain on the MQTT broker, when OpenWrt starts).
So to keep this solution persistent, it is necessary to publish JSON with a retain parameter every time the MQTT broker is rebooted.
I have MQTT broker and Node-Red server outside the Home Assistant and I can write simple flow using NodeRed for this purpose.
Is this possible to do something similar within the Home Assistant (without the need to install NodeRed and MQTT broker there)?
I am just curious how to keep the solution consistent.
Is there an other approach how to achieve persistence?

from wifi-presence.

awilliams avatar awilliams commented on May 31, 2024

Thank you @PetrJakes for the report.

As you've described, the configuration in MQTT must be published with retain in order for it to persist. I will improve the README to make this more apparent.

It sounds as if your MQTT broker does not persist messages after restarts. Maybe there's a configuration setting to change this?

I use mosquitto MQTT broker and have these two lines in my config:

persistence true
persistence_location /mnt/mosquitto/data/

And since I run mosquitto as a Docker container, I mount the persistence_location to my local host:

docker run \
        --rm \
        -v /etc/mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf \
        -v /mnt/mosquitto:/mnt/mosquitto \
        eclipse-mosquitto

from wifi-presence.

PetrJakes avatar PetrJakes commented on May 31, 2024

I have Mosquitto MQTT broker as well.
I have checked mosquitto.conf and persistence is set to the true by default, so no further action is required if the JSON configuration is published as retain.
Thank you for your help.

from wifi-presence.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.