Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for mqtt credentials #29

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 0 additions & 90 deletions README

This file was deleted.

50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Why this fork?
==============

This is my fork of cornetp/eagle-owl. Eagleowl is already a fantastic piece of software, but it's quite oriented to be
executed as a desktop program. Since what I need are just get the power values from a Raspberry Pi, in order to send them
to external services, I've made some changes to the code:

- Removed Sqlite DB support amb web interface.
- Removed most debug output and file writing, in order to not tear down SD cards.
- Added several different configurable outputs:
- Text file: Power readings will be written to a simple text file, one per line.
- MQTT: Publish power values to a MQTT host
- System command: Custom command to be executed for every power value (NOT IMPLEMENTED YET)
- Updated configuration file syntax, in order to support all new options, and use standard config file parsing mechanisms
(libconfig)

Those new output options allow things impossible to achieve with official version, like minimal disk writing, or even no
disk writing at all (using MQTT to publish power values), thus allowing eagle-owl to be executed from a read only file
system. Text file support also makes easier to get raw power values, without the need of sqlite queries or complex shell
script acrobatics (using screen or similar tools).

What's changed
==============

Usage is more or less the same as the mainstream version. Main difference is the config file, which should be now
something like this:

```
# eagleowl configuration file

# Execute a command for every consumption value (NOT YET IMPLEMENTED)
#system_command=""

# Output consumption values to a file in disk. Disabled by default
#output_file=""

# MQTT broker connection information for publishing values as a MQTT topic
#mqtt_host="mqttbroker"
#mqtt_port=1883
#mqtt_topic="eagleowl/w"

# install_path: path where the eagleowl software is installed
install_path="/opt/eagleowl"
```

It's still needed to specify install path, and then some output method should be activated by uncommenting the corresponding
lines and filling the right values, which are pretty straightforward.

Jesús Jiménez <[email protected]>

15 changes: 12 additions & 3 deletions etc/eagleowl.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
# eagleowl configuration file

# Execute a command for every consumption value (NOT YET IMPLEMENTED)
#system_command=""

# Output consumption values to a file in disk. Disabled by default
#output_file=""

# MQTT broker connection information for publishing values as a MQTT topic
#mqtt_host="mqttbroker"
#mqtt_port=1883
#mqtt_topic="eagleowl/w"

# install_path: path where the eagleowl software is installed
install_path=/opt/eagleowl
main_db_name=eagleowl.db
stat_db_name=eagleowl_stat.db
install_path="/opt/eagleowl"

13 changes: 3 additions & 10 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
CROSS_COMPILE ?=

CM160 = cm160
DB_IMPORT = db_import

CC := $(CROSS_COMPILE)gcc
LD := $(CROSS_COMPILE)gcc
CFLAGS := -W -Wall -Wno-multichar -O3 #-Werror
CFLAGS += -Isqlite-autoconf-3071300
LDFLAGS :=
LIBS := -lusb -lpthread -ldl
LIBS := -lusb -lconfig -lmosquitto -lpthread -ldl

OBJ_CM160 := cm160.o usb_utils.o db.o demonize.o sqlite-autoconf-3071300/sqlite3.o
OBJ_DBIMP := db_import.o db.o sqlite-autoconf-3071300/sqlite3.o
OBJ_CM160 := cm160.o usb_utils.o demonize.o

all: $(CM160) $(DB_IMPORT)

Expand All @@ -21,10 +18,6 @@ all: $(CM160) $(DB_IMPORT)
$(CM160): $(OBJ_CM160)
$(LD) $(LDFLAGS) -o $@ $(OBJ_CM160) $(LIBS)

$(DB_IMPORT): $(OBJ_DBIMP)
$(LD) $(LDFLAGS) -o $@ $(OBJ_DBIMP) $(LIBS)

clean:
-$(RM) *.o sqlite-autoconf-3071300/*.o
-$(RM) *.o
-$(RM) $(CM160)
-$(RM) $(DB_IMPORT)
Loading