logo elektroda
logo elektroda
X
logo elektroda

Integrating MEW-01 into Domoticz without using Node-RED: Daemon in Perl for energy savings

witekp04 618 0
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 20265558
    witekp04
    Level 2  
    Hello,
    Domoticz is a solution with low CPU usage, which is why I use it. This has consequences. One of the excellent regulars here (xury) wrote that Domoticz without Node-RED is a baby (somehow) - he's right. It's just that Node-RED is javascript and a very advanced use of it. It's great, but for those who also care about every mW of energy on the central device of their home automation might be interested in this post.

    I made a daemon two days ago that can use non-flat (flat, that's simple JSON supported by domoticz, that's not the case with MEW-01) server topics and update domoticz devices. For the purposes of this post, I have made it as understandable as possible. It is attached. The daemon is written in Perl. In theory, it doesn't require additional libraries to be installed (this is the case in Debian). It's different on rasberry, because it's a truncated/altered distribution of it.
    I wrote the configuration information in the "energiamqtt.conf" file included in the archive (you have to put it in /etc). There you also have "energiamqtt.service", which you need to put in the "/etc/systemd/system" of your distribution. How to use the daemon in turn:
    (a) Installing the required libraries
    Search google for your distribution and install (search for "perl <distribution name> <library>"): LWP::UserAgent, MIME::Base64, Sys::Syslog.
    (b) Download to the target archive host and in the directory to which you downloaded execute:
    sudo tar -xzf ./energiamqtt.tgz -C /opt
    .
    sudo mv /opt/energiamqtt/energiamqtt.conf /etc
    .
    sudo mv /opt/energiamqtt/energiamqtt.service /etc/systemd/
    .
    c) Edit the /etc/energiamqtt.conf file - customize it to your needs, add the required dummy devices in domoticz - there are descriptions in the file
    d) Start the daemon:
    sudo /opt/energiamqtt/energiamqtt.pl start
    .
    e) Observe in domoticz the device with the idx daemonstatusidx (set in the configuration) and other devices, if you have done well it should update well. To stop the daemon:
    sudo /opt/energiamqtt/energiamqtt.pl stop
    .
    To start the daemon:
    sudo /opt/energiamqtt/energiamqtt.pl restart
    .
    To reload the daemon (re-read the configuration file without rebooting):
    sudo /opt/energiamqtt/energiamqtt.pl reload
    .
    (f) Add daemon to systemctl:
    sudo systemctl enable energiamqtt.service 
    .
    After that "start", "restart", "reload" you can execute via systemctl.
    Well, and I forgot, I add, it's worth showing how it looks in domoticz (this is not the view according to the default configuration - there are ballanced ones there too):
    Integrating MEW-01 into Domoticz without using Node-RED: Daemon in Perl for energy savings .
  • ADVERTISEMENT
ADVERTISEMENT