Skip to content
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
2 changes: 1 addition & 1 deletion InverterMsg.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def temperature(self):
@property
def power(self):
"""Power output"""
print self.__get_short(59)
return self.__get_short(59)

@property
def e_total(self):
Expand Down
11 changes: 9 additions & 2 deletions config-org.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[general]
# General:enabled_plugins
# Choose which outputs to use
# Possible options: MysqlOutput,PVoutputOutput,ConsoleOutput,CSVOutput
# Possible options: MysqlOutput,PVoutputOutput,ConsoleOutput,CSVOutput,MQTTOutput
enabled_plugins =

[inverter]
Expand All @@ -16,7 +16,7 @@ port = 8899
# S/N of the wifi kit
wifi_sn = 602123456
#use temperature of inverter for pvoutput
use_temperature = true
use_temperature = false

[mysql]
# Host where the mysql server is active
Expand Down Expand Up @@ -46,3 +46,10 @@ level = debug
# Log:filename
# Output file for file logger
filename = omnik-export.log

[mqtt]
# Host where the mqtt server is, incudling user/pass authentication
host = 127.0.0.1
port = 1883
user = pascal
pass = pascal
29 changes: 29 additions & 0 deletions outputs/MQTTOutput.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import PluginLoader
from datetime import datetime
import paho.mqtt.client as mqtt

class MWTTOutput(PluginLoader.Plugin):
"""Outputs the data from the Omnik inverter to an MQTT server """

def process_message(self, msg):
client = mqtt.Client("Omnik Solar Inverter")
client.username_pw_set( self.config.get('mqtt', 'user'),
self.config.get('mqtt', 'pass'))
client.connect( self.config.get('mqtt', 'host'),
self.config.get('mqtt', 'port'))

client.publish("power/solar/e_total", msg.e_total)
client.publish("power/solar/e_today", msg.e_today)
client.publish("power/solar/h_total", msg.h_total)
client.publish("power/solar/power", msg.power)
client.publish("power/solar/temp", msg.temperature)

for x in [1,2,3]:
client.publish("power/solar/v_pv" + str(x), msg.v_pv(x))
client.publish("power/solar/v_ac" + str(x), msg.v_ac(x))
client.publish("power/solar/i_ac" + str(x), msg.i_ac(x))
client.publish("power/solar/f_ac" + str(x), msg.f_ac(x))
client.publish("power/solar/p_ac" + str(x), msg.p_ac(x))

client.loop(2)
client.disconnect()