Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Controllers
  3. Domoticz
  4. How to: set your power/watermeter for domoticz on rpi

How to: set your power/watermeter for domoticz on rpi

Scheduled Pinned Locked Moved Domoticz
3 Posts 2 Posters 3.5k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    fleinze
    wrote on last edited by fleinze
    #1

    This worked for me.
    All steps are done in command line, so you don't need screen/keyboard on the raspberry pi. To get to the commandline you need to open a ssh-session (command ssh pi@raspberrypi.local on linux and macos, use putty on windows)
    You can also do the same steps with a graphical sqlite-editor.

    1. Get a db-editor
      Download:
      wget --no-check-certificate https://www.sqlite.org/2016/sqlite-amalgamation-3100100.zip
      (please look which version is current on the sqlite page)
      unzip:
      unzip sqlite-amalgamation-3100100.zip
      Build:
      cd sqlite-amalgamation-3100100
      gcc shell.c sqlite3.c -lpthread -ldl
      Get a cup of tee, this takes a while... Don't close the ssh-session!
      When the compiler is done, it has created a file named a.out, i rename it for convenience:
      mv a.out sqlit3
      this is an executable file, you can move it wherever you want.

    2. make a copy of the domoticz database in case something goes wrong!
      you can find this in the domoticz web interface at setup->settings->backup or you can copy the file directly on the rpi (need admin-rights):
      sudo cp <path-to-domoticz>/domoticz.db <some-save-path>

    3. Get domoticz and the node ready:
      Stop domoticz:
      sudo <path-to-domoticz>/domoticz.sh stop or in the web interface. It this does not work you might need to make the script executable: chmod +x domoticz.sh
      Stop the power/watermeter node (e.g. unplug the power supply).
      Read the meter. Calculate the pulse-variable by multiplying the meter-reading with the pulse-factor.
      In this example the meter reads 1150.210 kWh, the pulse-factor is 500. The pulse-variable needs to be set to 575105.

    4. Do the edit.
      Open the domoticz.db:
      sudo ./sqlite3 <path-to-domoticz>/domoticz.db
      The table to edit is MySensorsVars.
      In this example the powermeter node has the id 12, the pulse variable is set to 575105.
      UPDATE MySensorsVars SET Value=575105 WHERE NodeID=12;
      Check the result with
      SELECT * FROM MySensorsVars;
      Exit sqlite with .quit

    5. Restart
      sudo <path-to-domoticz>/domoticz.sh start
      plug in the power/watermeter-node.

    Have Fun!

    1 Reply Last reply
    2
    • A Offline
      A Offline
      Adam McCartney
      wrote on last edited by
      #2

      you know you can install sqlite using apt?

      sudo apt-get install sqlite
      

      saves a LOT of compile time.

      1 Reply Last reply
      0
      • F Offline
        F Offline
        fleinze
        wrote on last edited by
        #3

        Well actually i didn't. Thanks a lot!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        15

        Online

        11.7k

        Users

        11.2k

        Topics

        113.1k

        Posts


        Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • MySensors
        • OpenHardware.io
        • Categories
        • Recent
        • Tags
        • Popular