mqtt integration

Talks about metering
Post Reply
megamarco83
Posts: 108
Joined: Tue Apr 14, 2015 9:25 am

mqtt integration

Post by megamarco83 » Sun May 17, 2020 3:35 pm

Hi JM, as you well know :-) :-) i'm using your fantastic system combination meterN and 123solar since many years

with actual domotics system, everyone talk using mqtt

it could be fantastic to integrate values of energy coming from your system if they can send out mqtt values.
could be possible for example add this feature?

one idea could be set inside metern a topic:
eg: house/energy/metern
and then looking for example at json created inside /dev/shm/mN_LIVEMEMORY.json

Code: Select all

{"UTC":1589725610,"Consumi1":"1884","Produzione2":"1859","Prelievi3":"25","Immissioni4":"0","Autoconsumo5":"1859","temperatura6":"23.4","Umidit\u00e07":"99.9","PrelieviF18":"0","PrelieviF239":"25","New 1010":"0","Temperatura Boiler11":"62.00","Boiler12":"0","Mandata Riscaldamento13":"22.31","Mandata Caldaia14":"56.38","volt15":"0","Temp Corridoio16":"24.40","Umid Corridoio17":"52.00","Temp Mansarda18":"27.6","Umid Mansarda19":"45.7","Acqua20":"0","Temp_Camino21":"29.8","temp_ACS22":"55.9","Ritorno Riscaldamento23":"22.3"}
having the value inside topi of metern and then the payload as value.

eg:
topic inside metern option adim page = house/energy/metern/
then:
topic for 1st meter = house/energy/metern/Consumi1
payload = 1884

topic for 2nd meter = house/energy/metern/Produzione2
payload = 1859

topic for 3rd meter = house/energy/metern/Prelievi3
payload = 25

and so on for the mN_LIVEMEMORY.json values
also good idea to set also mN_MEMORY.json and mN_ILIVEMEMORY.json

what do you think?
now i use http calls, but the integration is not so symple and it will chenge for every domotic system, and manipulate json and http command is a workload...
having the possibility to send out the mqtt will be a standard languade for every kind system.
i hope that can be possible and you have time / take fun on considering that :)


p.s.
question a part to this:
inside http://<IP_raspebrry>/metern/admin/admin_meter.php
the meter related to house consumption and house production has not the possibility to set precision.
juts a curiosity, why is not possible for example use one decimal to rapresent instant power consumption / production like XXX,X?
thanks
Image

jeanmarc
Posts: 2022
Joined: Thu Aug 29, 2013 7:16 am

Re: mqtt integration

Post by jeanmarc » Sun May 17, 2020 4:38 pm

Hi,
to say the truth, i don't know much about MQTT :-?
I believe it's just a protocol (like many others) but i may be wrong. I don't get it, you want to send and/or received MQTT messages with mN ? If so, I think it should be the com. apps jobs..

For the precision, it is disabled for electrical meters to avoid "confusion" :) Default is a 0.1W precision

megamarco83
Posts: 108
Joined: Tue Apr 14, 2015 9:25 am

Re: mqtt integration

Post by megamarco83 » Sun May 17, 2020 5:30 pm

jeanmarc wrote:
Sun May 17, 2020 4:38 pm
Hi,
to say the truth, i don't know much about MQTT :-?
I believe it's just a protocol (like many others) but i may be wrong. I don't get it, you want to send and/or received MQTT messages with mN ? If so, I think it should be the com. apps jobs..
hi JM thanks as always for support!
yes, mqtt it's a protocol, it's universal and today all the stuff, commercial or not are talking with this.
here just a quick overview:
https://www.hivemq.com/mqtt-essentials/

mmmm not really right, for me metern shoult at list send messages, receive maybe could complicate the code.
but send i hope that will be possible.
i mean, it could be enought send messages, because if metern send a message, the domotic software that is listen (or whatever)can take the data of the
meters of metern quite easy, immediatly, and with almost zero stress for the hardware, mqtt it's just a message :)

maybe, if you want could be implemented on a comapps, you are skilled in php, so maybe could be easy for you?
would you like to get a try to support metern with mqtt ? :)
jeanmarc wrote:
Sun May 17, 2020 4:38 pm
For the precision, it is disabled for electrical meters to avoid "confusion" :) Default is a 0.1W precision
i see that the trick point to use decimals is modify poolerconsumi.php and pool123s.php
because they truncate the precision at 1:

poolerconsumi.php:

Code: Select all

$powerval = round($powerval, 1); //PRECISIONE 1= 1decimale 0=numero intero

pool123s.php:

Code: Select all

$GP = round($GP, 1);  //PRECISIONE 1=1decimale 0=numero intero
i modify there to get 0,1 precision, i'm wrong?
thanks!!!!!

jeanmarc
Posts: 2022
Joined: Thu Aug 29, 2013 7:16 am

Re: mqtt integration

Post by jeanmarc » Sun May 17, 2020 6:05 pm

I will take a look on MQTT but i don't have much free time right now and i think it's the com app's job.
For poolerconsumi i'am not the author of it, the electrical meter's values have a 0.1 precision on /dev/shm/mN_LIVEMEMORY.json.

megamarco83
Posts: 108
Joined: Tue Apr 14, 2015 9:25 am

Re: mqtt integration

Post by megamarco83 » Sun May 17, 2020 6:23 pm

jeanmarc wrote:
Sun May 17, 2020 6:05 pm
I will take a look on MQTT but i don't have much free timre now and i think it's the com app's job.
that's fantastic!
of course take your time, no urgency at all, of course.
could be an option just to increase the integration with almost zero hardware stress for raspberry :)
yes, it could be a com app job, but as always you are the expert on became possible things that for me are impossible with php :)
jeanmarc wrote:
Sun May 17, 2020 6:05 pm
For poolerconsumi i'am not the author of it, the electrical meter's values have a 0.1 precision on /dev/shm/mN_LIVEMEMORY.json.
ops, i'm so sorry for that!
apologise
anyway, with that modification at poolerconsumi and pool123s it will work with 0.1 precision

megamarco83
Posts: 108
Joined: Tue Apr 14, 2015 9:25 am

Re: mqtt integration

Post by megamarco83 » Sat May 23, 2020 7:47 pm

Hey JM, how are you?
did you get a look on mqtt?
what do you think?
i know that you are busy, and this feature is for future (or better, i hope so :-)) so, I just want to know if you are interested on making a comapp, nothing more :)
thanks, as always!!!
ciaooo

jeanmarc
Posts: 2022
Joined: Thu Aug 29, 2013 7:16 am

Re: mqtt integration

Post by jeanmarc » Sat May 23, 2020 8:04 pm

Well i haven't look at that yet but it's on my todo list.. sorry, don't have much free time now, real life is more important to me and this not not paying the bills :)

megamarco83
Posts: 108
Joined: Tue Apr 14, 2015 9:25 am

Re: mqtt integration

Post by megamarco83 » Sat May 23, 2020 8:30 pm

Hey JM nice to read that it's in to do list.
But firt, totally agree that you have to put your hands on ONLY when you will be confortable, when you will be free, and of course ONLY if you will get fun on it!
I'm grateful to you to all what you do!
Keep in touch

jeanmarc
Posts: 2022
Joined: Thu Aug 29, 2013 7:16 am

Re: mqtt integration

Post by jeanmarc » Mon May 25, 2020 8:30 pm

Did you take a look on Mosquitto-PHP ?
It can send message, i don't have any MQTT device maybe you can give it a try ?

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests