MQTT data transfer to openhab


#1

I use Iotawatt to measure house power

To being able to publish to MQTT i add at Node: IotaWatt Key: 16 Name: Verbrauch_gesamt a publish to MQTT process.

I controlled the output with a free MQTT client MQTTFX and get data every 10 seconds.

and i have definded in the openhab MMQTT,cfg file (from MQTT binding)

emonpi.url=tcp://192.168.x.xx:1883
emonpi.user=emonpi
emonpi.pwd=emonpimqtt2016
emonpi.qos=2

in openhab in my itemfile i defind following item:

Number Gesamtverbrauch { mqtt="[emonpi:emon/IotaWatt/Verbrauch_gesamt:state:default]" }

where emonpi is my MQTT ID from the binding

and then the following is documented

[basetopic]/[node]/[keyname]

emon is the base topic (found in the docu)
Iotawatt is my Node
Verbrauch_gesamt is my Topic which i will subscribe

But get no values to openhab ??

Don´t find the failure in my configuration

Maybe somwhere have done similar and could give my advice

Thanks


#2

Sorry forgot to say that my IotaWatt post his data to a local emonbase station (RPI3 from OEM)

and on this emonbase runs the MQTT server. Picture above is from this emoncms installation


#3

Hi @Karl,

I have not used the Publish to MQTT process in Emoncms, but I’ll give it a try over the next few days. Does the log to feed work? In other words, are you seeing the key 16 input in the inputs page?

If you are not getting the input, that would be an IoTaWatt to Emoncms problem, and I could help you there. The publish to MQTT part, as I understand it, has a couple of moving parts: The Mosquitto MQTT broker and the Openhab client. So could you see if the data is being recognized in the Emoncms input?

To take another approach, I am working on native MQTT for the IoTaWatt, and that should allow you to publish directly to Openhab, bypassing theEmoncms step. It would still require the mosquitto broker.


#4

Hello overeasy

Yes the data are seen in the local Emoncms installation. I can make a graph from the feed.
I additionally added a publish to MQTT process which works as i can see data with a free mqtt client on my windows PC.

So the problem is the syntax which is used for subscribing to the MQTT server.
As you didn´t use this part maybe should check on the openenergyforum.

[basetopic]/[node]/[keyname] says the docu.

I´m not sure if Iotawatt as node is correct.
Try´d also others without any sucess.

If you could provide natice MQTT support this is a big advantage for me as i can directly post to openhab

Cheers

Karl


#5

If it works with your windows client, the node should be OK. I’d be interested in knowing that you resolved this problem and how.

I’ll try to remember to give you a heads-up when I release MQTT support, but check in a month or so anyway.


#6

But my windows client has a topic scan and i see only the name of the topic in my case Verbrauch_gesamt and not the other two components

basetopic and node

Will give you feedback when i hopfully solve it

Karl


#7

Now i understand .
Gave in EMONCMS in the publish to MQTT process a new name ( Verbrauch/Haus/gesamt)

and adapted item to

Number Gesamtverbrauch { mqtt="<[mosquitto:Verbrauch/Haus/gesamt:state:default]" }

and voila values are correct in my sidemap.

Thanks to borpin for the hint


#8

There are a lot of moving parts. I’m glad you were able to get the advice you needed from the OEM forum.