mr-manuel / venus-os_dbus-mqtt-temperature

This Venus OS driver gets the data from MQTT and displays it as temperature sensor.
MIT License
9 stars 0 forks source link
battery dbus driver mqtt venusos venusos-device victron victronenergy

dbus-mqtt-temperature - Emulates a temperature sensor from MQTT data

GitHub repository: mr-manuel/venus-os_dbus-mqtt-temperature

Index

  1. Disclaimer
  2. Supporting/Sponsoring this project
  3. Purpose
  4. Config
  5. JSON structure
  6. Install / Update
  7. Uninstall
  8. Restart
  9. Debugging
  10. Compatibility
  11. Screenshots

Disclaimer

I wrote this script for myself. I'm not responsible, if you damage something using my script.

Supporting/Sponsoring this project

You like the project and you want to support me?

Purpose

The script emulates a temperature sensor in Venus OS. It gets the MQTT data from a subscribed topic and publishes the information on the dbus as the service com.victronenergy.temperature.mqtt_temperature with the VRM instance 100.

Config

Copy or rename the config.sample.ini to config.ini in the dbus-mqtt-temperature folder and change it as you need it.

JSON structure

Minimum required ```json { "temperature": 22.0 } ``` OR ```json { "value": 22.0 } ``` OR ```json 22.0 ```
Full ```json { "temperature": 22.0, "humidity": 62.927, "pressure": 102.104 } ```

Install / Update

  1. Login to your Venus OS device via SSH. See Venus OS:Root Access for more details.

  2. Execute this commands to download and copy the files:

    wget -O /tmp/download_dbus-mqtt-temperature.sh https://raw.githubusercontent.com/mr-manuel/venus-os_dbus-mqtt-temperature/master/download.sh
    
    bash /tmp/download_dbus-mqtt-temperature.sh
  3. Select the version you want to install.

  4. Press enter for a single instance. For multiple instances, enter a number and press enter.

    Example:

    • Pressing enter or entering 1 will install the driver to /data/etc/dbus-mqtt-temperature.
    • Entering 2 will install the driver to /data/etc/dbus-mqtt-temperature-2.

Extra steps for your first installation

  1. Edit the config file to fit your needs. The correct command for your installation is shown after the installation.

    • If you pressed enter or entered 1 during installation:

      nano /data/etc/dbus-mqtt-temperature/config.ini
    • If you entered 2 during installation:

      nano /data/etc/dbus-mqtt-temperature-2/config.ini
  2. Install the driver as a service. The correct command for your installation is shown after the installation.

    • If you pressed enter or entered 1 during installation:

      bash /data/etc/dbus-mqtt-temperature/install.sh
    • If you entered 2 during installation:

      bash /data/etc/dbus-mqtt-temperature-2/install.sh

    The daemon-tools should start this service automatically within seconds.

Uninstall

⚠️ If you have multiple instances, ensure you choose the correct one. For example:

Restart

⚠️ If you have multiple instances, ensure you choose the correct one. For example:

Debugging

⚠️ If you have multiple instances, ensure you choose the correct one.

The logs can be checked with tail -n 100 -f /data/log/dbus-mqtt-temperature/current | tai64nlocal

The service status can be checked with svstat svstat /service/dbus-mqtt-temperature

This will output somethink like /service/dbus-mqtt-temperature: up (pid 5845) 185 seconds

If the seconds are under 5 then the service crashes and gets restarted all the time. If you do not see anything in the logs you can increase the log level in /data/etc/dbus-mqtt-temperature/dbus-mqtt-temperature.py by changing level=logging.WARNING to level=logging.INFO or level=logging.DEBUG

If the script stops with the message dbus.exceptions.NameExistsException: Bus name already exists: com.victronenergy.temperatureinverter.mqtt_temperature" it means that the service is still running or another service is using that bus name.

Compatibility

This software supports the latest three stable versions of Venus OS. It may also work on older versions, but this is not guaranteed.

Screenshots

MQTT Temperature ![Temperature - device list](/screenshots/temperature_device-list.png) ![Temperature - device list - mqtt temperature 1](/screenshots/temperature_device-list_mqtt-temperature-1.png) ![Temperature - device list - mqtt temperature 2](/screenshots/temperature_device-list_mqtt-temperature-2.png) ## GuiMods ![Temperature - pages](/screenshots/temperature_pages_guimods.png)