-
Notifications
You must be signed in to change notification settings - Fork 14
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
No messages sent to mqtt broker ? #4
Comments
Hi,
Thanks for having interest in my project!
- A few suggestions....it is normal that MQTT is initailly not connecting
- On Windows, use MQTT Explorer....I think you will see some initial MQTT
messages.....
- As I have a real P1 USB probe, I don;t use the test data anymore....I
could be that it doesn't work (I haven;t tested this anymore)
- ==> I will test the test data ....but a bit too busy with other projects
- dsmr does work for me with a real USB P1 probe..it is up & running as you
speak.
…On Sat, Jun 3, 2023 at 8:47 PM karlkashofer ***@***.***> wrote:
Hi !
I seem to not get any messages to my mqtt broker, here is the log using
just the provided test data:
***@***.***:~/services/dsmr/test/dsmr2mqtt $ python3 dsmr-mqtt.py
dsmr-mqtt INFO: FUNCTION:<module> LINE:82: Starting dsmr-mqtt.py; version = 2.0.0
dsmr-mqtt.mqtt.mqtt INFO: FUNCTION:__init__ LINE:103: >> paho-mqtt version = 1.6.1
dsmr-mqtt.mqtt.mqtt INFO: FUNCTION:__init__ LINE:117: MQTT Client ID = mqtt-dsmr
dsmr-mqtt.P1_serial DEBUG: FUNCTION:__init__ LINE:51: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__init__ LINE:50: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__init__ LINE:66: NROF = 1
dsmr-mqtt.hadiscovery DEBUG: FUNCTION:__init__ LINE:49: >>
dsmr-mqtt DEBUG: FUNCTION:<module> LINE:186: __main__: >>
dsmr-mqtt DEBUG: FUNCTION:main LINE:150: >>
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:will_set LINE:425: >>
dsmr-mqtt.mqtt.mqtt INFO: FUNCTION:run LINE:517: Broker = 192.168.1.5>>
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:__internet_on LINE:222: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:run LINE:215: >>
dsmr-mqtt.hadiscovery DEBUG: FUNCTION:run LINE:128: >>
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:__internet_on LINE:229: Internet connectivity to MQTT broker 192.168.1.5 at port 1883 available
dsmr-mqtt.mqtt.mqtt INFO: FUNCTION:run LINE:575: Start mqtt loop...
dsmr-mqtt.P1_serial DEBUG: FUNCTION:run LINE:198: >>
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:set_status LINE:408: >>
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:__set_status LINE:391: >>
dsmr-mqtt.P1_serial DEBUG: FUNCTION:__read_serial LINE:152: >>
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:do_publish LINE:444: >> TOPIC=test_dsmr/status; MESSAGE=online
dsmr-mqtt.mqtt.mqtt WARNING: FUNCTION:do_publish LINE:451: MQTT publish was not successfull, rc = 4: The client is not currently connected.
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:do_publish LINE:444: >> TOPIC=homeassistant/sensor/test_dsmr/dsmr-device/config; MESSAGE={"name":"dsmr reader","unique_id":"dsmr-device","state_topic":"test_dsmr/status","icon":"mdi:home-automation","device":{"name":"dsmr reader","sw_version":"2.0.0","model":"P1 USB/dsmr-mqtt","manufacturer":"hansij66 @github.com","identifiers":["dsmr"]}}
dsmr-mqtt.mqtt.mqtt WARNING: FUNCTION:do_publish LINE:451: MQTT publish was not successfull, rc = 4: The client is not currently connected.
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:run LINE:587: Disconnect TIMER = 0
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:do_publish LINE:444: >> TOPIC=test_dsmr/sw-version; MESSAGE=main=2.0.0; mqtt=2.0.0
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:do_publish LINE:444: >> TOPIC=homeassistant/sensor/test_dsmr/p_consumed/config; MESSAGE={"unique_id":"p_consumed","state_topic":"test_dsmr/el","name":"Total power usage [W]","unit_of_measurement":"W","value_template":"{{value_json.p_consumed}}","device_class":"power","icon":"mdi:gauge","device":{"identifiers":["dsmr"]}}
dsmr-mqtt.mqtt.mqtt WARNING: FUNCTION:do_publish LINE:451: MQTT publish was not successfull, rc = 4: The client is not currently connected.
dsmr-mqtt.mqtt.mqtt WARNING: FUNCTION:do_publish LINE:451: MQTT publish was not successfull, rc = 4: The client is not currently connected.
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:do_publish LINE:444: >> TOPIC=homeassistant/sensor/test_dsmr/p_generated/config; MESSAGE={"unique_id":"p_generated","state_topic":"test_dsmr/el","name":"Total power generation [W]","unit_of_measurement":"W","value_template":"{{value_json.p_generated}}","device_class":"power","icon":"mdi:gauge","device":{"identifiers":["dsmr"]}}
dsmr-mqtt.mqtt.mqtt WARNING: FUNCTION:do_publish LINE:451: MQTT publish was not successfull, rc = 4: The client is not currently connected.
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:run LINE:587: Disconnect TIMER = 0
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:do_publish LINE:444: >> TOPIC=homeassistant/sensor/test_dsmr/gas_consumed/config; MESSAGE={"unique_id":"gas_consumed","state_topic":"test_dsmr/gas","name":"gas consumption [m\u00b3]","unit_of_measurement":"m\u00b3","value_template":"{{value_json.gas_consumed|float/1000|round(0)}}","device_class":"gas","state_class":"total","icon":"mdi:counter","device":{"identifiers":["dsmr"]}}
dsmr-mqtt.mqtt.mqtt WARNING: FUNCTION:do_publish LINE:451: MQTT publish was not successfull, rc = 4: The client is not currently connected.
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:__on_connect LINE:262: >>
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:__on_connect LINE:264: Connected: userdata=None; flags={'session present': 0}; rc=Success: Connection Accepted.
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:do_publish LINE:444: >> TOPIC=homeassistant/sensor/test_dsmr/el_consumed/config; MESSAGE={"unique_id":"el_consumed","state_topic":"test_dsmr/el","name":"EL consumed [Wh]","unit_of_measurement":"Wh","value_template":"{{value_json.el_consumed}}","device_class":"energy","state_class":"total","icon":"mdi:counter","device":{"identifiers":["dsmr"]}}
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:__set_connected_flag LINE:237: >> flag=True; current __connected_flag=False
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:__set_status LINE:391: >>
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:do_publish LINE:444: >> TOPIC=homeassistant/sensor/test_dsmr/el_returned/config; MESSAGE={"unique_id":"el_returned","state_topic":"test_dsmr/el","name":"EL returned [Wh]","unit_of_measurement":"Wh","value_template":"{{value_json.el_returned}}","device_class":"energy","state_class":"total","icon":"mdi:counter","device":{"identifiers":["dsmr"]}}
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:do_publish LINE:444: >> TOPIC=test_dsmr/status; MESSAGE=online
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:do_publish LINE:444: >> TOPIC=homeassistant/sensor/test_dsmr/V1/config; MESSAGE={"unique_id":"V1","state_topic":"test_dsmr/el","name":"Voltage L1 [V]","unit_of_measurement":"V","value_template":"{{value_json.V1}}","device_class":"voltage","icon":"mdi:gauge","device":{"identifiers":["dsmr"]}}
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:do_publish LINE:444: >> TOPIC=homeassistant/sensor/test_dsmr/V2/config; MESSAGE={"unique_id":"V2","state_topic":"test_dsmr/el","name":"Voltage L2 [V]","unit_of_measurement":"V","value_template":"{{value_json.V2}}","device_class":"voltage","icon":"mdi:gauge","device":{"identifiers":["dsmr"]}}
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:do_publish LINE:444: >> TOPIC=homeassistant/sensor/test_dsmr/V3/config; MESSAGE={"unique_id":"V3","state_topic":"test_dsmr/el","name":"Voltage L3 [V]","unit_of_measurement":"V","value_template":"{{value_json.V3}}","device_class":"voltage","icon":"mdi:gauge","device":{"identifiers":["dsmr"]}}
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_serial DEBUG: FUNCTION:__read_serial LINE:180: EOF Detected in test/dsmr.raw
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:run LINE:232: <<
dsmr-mqtt.P1_serial DEBUG: FUNCTION:__read_serial LINE:194: <<
dsmr-mqtt.P1_serial DEBUG: FUNCTION:run LINE:211: <<
dsmr-mqtt DEBUG: FUNCTION:main LINE:167: t_serial.join exited; set stopper for other threats
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:set_status LINE:408: >>
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:__set_status LINE:391: >>
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:do_publish LINE:444: >> TOPIC=test_dsmr/status; MESSAGE=offline
dsmr-mqtt DEBUG: FUNCTION:main LINE:178: <<
dsmr-mqtt DEBUG: FUNCTION:<module> LINE:193: __main__: <<
dsmr-mqtt INFO: FUNCTION:close LINE:96: Exitcode = 1 >>
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:run LINE:600: Close down MQTT client & connection to broker
dsmr-mqtt.mqtt.mqtt INFO: FUNCTION:__on_disconnect LINE:294: Expected disconnect, userdata = None; rc = 0: No error.
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:__set_connected_flag LINE:237: >> flag=False; current __connected_flag=True
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:__set_connected_flag LINE:242: Disconnect TIMER started
dsmr-mqtt.mqtt.mqtt INFO: FUNCTION:run LINE:606: Shutting down MQTT Client... 13 MQTT messages have been published
dsmr-mqtt.mqtt.mqtt INFO: FUNCTION:run LINE:608: <<
dsmr-mqtt.mqtt.mqtt DEBUG: FUNCTION:__del__ LINE:211: >>
dsmr-mqtt.mqtt.mqtt INFO: FUNCTION:__del__ LINE:212: Shutting down MQTT Client... 13 MQTT messages have been published
dsmr-mqtt.P1_serial DEBUG: FUNCTION:__del__ LINE:84: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__del__ LINE:69: >>
dsmr-mqtt.hadiscovery DEBUG: FUNCTION:__del__ LINE:59: >>
***@***.***:~/services/dsmr/test/dsmr2mqtt $
Any idea what i am doing wrong ?
—
Reply to this email directly, view it on GitHub
<#4>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFFPZDZK6LJWD6M4NHGHQQDXJOBCXANCNFSM6AAAAAAYZOGOWE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I dont see any messages with meter content in MQTT Explorer, only the status messages present in the log. dsmr2mqtt also does not work with my real P1 probe, attached to Sagemcom and decoded by dsmr-proxy. I presume there should be mqtt message log entries between all the
lines ? What i did: then i run
which gives above log. Any help appreciated ! |
Hi
On INFLUXDB...good catch...as I gitignore my config.py file....I guess I
forgot to sync that last change to config,rename.py....Will fix that.
Wrt mqtt, I have never tested w/o username/password...not really
recommended to run MQTT w/o authentication.
What you can try is to* comment out *in mqtt/mqtt.py the following line
self.__mqtt.username_pw_set(username, password)
I have just tested dsmr in simulation (with username and password for MQTT)
... and it works for me (I use mosquitto as MQTT broker)
…On Sat, Jun 3, 2023 at 10:14 PM karlkashofer ***@***.***> wrote:
I dont see any messages in MQTT Explorer, the broker is processing
messages from various sensors around my house, all looking normal.
dsmr2mqtt also does not work with my real P1 probe, attached to Sagemcom
and decoded by dsmr-proxy.
I presume there should be mqtt message log entries between all the
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
dsmr-mqtt.P1_parser DEBUG: FUNCTION:__decode_telegrams LINE:188: >>
lines ?
What i did:
git clone the repo on a raspberry pi zero with python3 and fresh paho-mqtt
1.6.1
set ip of mqtt broker, set production to false and loglevel to DEBUG.
I have no username or password on the broker, so set them as empty.
I had to add "INFLUXDB = None" as that seems to be missing in
config.rename.py
then i run
python3 dsmr-mqtt.py
Any help appreciated !
run
—
Reply to this email directly, view it on GitHub
<#4 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFFPZDZAVZIQOCU66U52KOLXJOLKVANCNFSM6AAAAAAYZOGOWE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Unfortunately, commenting the line does not help. Could you post the debug log for your simulation ? |
Ok, i got it working instantly on my debian bookworm laptop. However, still no luck with my P1 data. I get no data on the mqtt broker running this file as input in simulation mode. The only messages showing are:
This is the raw data:
|
I thought that I removed python3-persist-queue dependency in last
version...let me check.
I will look tonight at your dsmr data
BR
Hans
…On Sat, Jun 3, 2023 at 11:28 PM karlkashofer ***@***.***> wrote:
Ok, i got it working instantly on my debian bookworm laptop.
Went back to the raspberry, saw that python3-persist-queue was not
installed.
did "sudo pip3 install persist-queue", now the test data is working.
However, still no luck with my P1 data.
I have attached a small sample, can you see anything wrong with it ?
dsmr_kk.raw.txt
<https://github.com/hansij66/dsmr2mqtt/files/11644285/dsmr_kk.raw.txt>
—
Reply to this email directly, view it on GitHub
<#4 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFFPZD5YTBV6INAU7OQAEXLXJOUA3ANCNFSM6AAAAAAYZOGOWE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
You are right, i did "pip3 uninstall persist-queue" and your test-data still works. Digging further into dsmr50.py i found out that ALL of my fields are different to yours. So after adapting all the regexes to my providers field definitions it now works ! Here is my dsmr50.py which works for the Austrian Electricity provider "Stromnetz Graz": Thanks Hans for your support and great multi-threaded dsmr2mqtt ! |
I will add your file to the source code with the remark that that one
worked in Austria. Thanks!
…On Sun, Jun 4, 2023 at 11:20 AM karlkashofer ***@***.***> wrote:
You are right, i did "pip3 uninstall persist-queue" and your test-data
still works.
Must have been changing too many thins at once...
Digging further into dsmr50.py i found out that ALL of my fields are
different to yours.
My timestamp has a S while yours has a W. My electricity fields have Wh
while yours have kWh.
So after adapting all the regexes to my providers field definitions it now
works !
Here is my dsmr50.py which works for the Austrian Electricity provider
"Stromnetz Graz":
dsmr50_Stromnetz_Graz_Austria.py.txt
<https://github.com/hansij66/dsmr2mqtt/files/11645244/dsmr50_Stromnetz_Graz_Austria.py.txt>
Thanks Hans for your support and great multi-threaded dsmr2mqtt !
—
Reply to this email directly, view it on GitHub
<#4 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFFPZDZ5AYDLH6J4Q5PDDETXJRHO5ANCNFSM6AAAAAAYZOGOWE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Hi !
I seem to not get messages with meter readings to my mqtt broker, only the status messages are transmitted.
Here is the log using just the provided test data:
Any idea what i am doing wrong ?
The text was updated successfully, but these errors were encountered: