Page 6 of 14

Re: Python Plugin: MqttMapper

Posted: Friday 23 February 2024 10:44
by hjzwiers
I restarted a few times and its now showing the right values.

I added a second value, and again no value ....

{
"T_Living": {
"topic": "ebusd/ctlv2",
"key": "ebusd/ctlv2/z1RoomTemp",
"type": "80", "subtype": "5", "switchtype": "0" ,
"mapping": {"item": "", "multiplier": 0.1}
},

"T_Outside": {
"topic": "ëbusd/ctlv2",
"key": "ëbusd/ctlv2/DisplayedOutsideTemp",
"type": "80", "subtype": "5", "switchtype": "0" ,
"mapping": {"item": "", "multiplier": 0.1}
}
}

Added a bit of logging after I update the file:

2024-02-23 12:16:30.417 MQTT Mapper: 'HomeFolder':'/home/hjz/domoticz/plugins/MqttMapper/'
2024-02-23 12:16:30.417 MQTT Mapper: 'StartupFolder':'/home/hjz/domoticz/'
2024-02-23 12:16:30.417 MQTT Mapper: 'UserDataFolder':'/home/hjz/domoticz/'
2024-02-23 12:16:30.417 MQTT Mapper: 'Database':'/home/hjz/domoticz/domoticz.db'
2024-02-23 12:16:30.417 MQTT Mapper: 'Language':'en'
2024-02-23 12:16:30.417 MQTT Mapper: 'Version':'1.0.19'
2024-02-23 12:16:30.417 MQTT Mapper: 'Author':'Flying Domotic'
2024-02-23 12:16:30.417 MQTT Mapper: 'Name':'MQTT Mapper'
2024-02-23 12:16:30.417 MQTT Mapper: 'Address':'192.168.2.71'
2024-02-23 12:16:30.417 MQTT Mapper: 'Port':'1883'
2024-02-23 12:16:30.417 MQTT Mapper: 'Key':'MqttMapper'
2024-02-23 12:16:30.417 MQTT Mapper: 'Mode1':'MqttMapper.json'
2024-02-23 12:16:30.417 MQTT Mapper: 'Mode6':'Normal'
2024-02-23 12:16:30.417 MQTT Mapper: 'DomoticzVersion':'2024.4 (build 15910)'
2024-02-23 12:16:30.417 MQTT Mapper: 'DomoticzHash':'0f2fcff99'
2024-02-23 12:16:30.417 MQTT Mapper: 'DomoticzBuildTime':'2024-02-10 12:56:24'
2024-02-23 12:16:30.417 MQTT Mapper: Device count: 2
2024-02-23 12:16:30.417 MQTT Mapper: Device: 1 - ID: 1234, Name: 'MQTT Mapper - T_Living', nValue: 0, sValue: '19.6625'
2024-02-23 12:16:30.417 MQTT Mapper: Device: 2 - ID: 1235, Name: 'MQTT Mapper - T_Outside', nValue: 0, sValue: ''
2024-02-23 12:16:30.417 MQTT Mapper: Debug logging mask set to: PYTHON PLUGIN
2024-02-23 12:16:30.417 MQTT Mapper: Updating device T_Living
2024-02-23 12:16:30.418 MQTT Mapper: Updating device T_Outside
2024-02-23 12:16:30.420 MQTT Mapper: MqttClient::__init__
2024-02-23 12:16:30.420 MQTT Mapper: MqttClient::Open
2024-02-23 12:16:30.420 MQTT Mapper: Heartbeat interval set to: 60.
2024-02-23 12:16:30.470 MQTT Mapper: MqttClient::onConnect
2024-02-23 12:16:30.470 MQTT Mapper: Successful connect to: 192.168.2.71:1883
2024-02-23 12:16:30.470 MQTT Mapper: MqttClient::Connect
2024-02-23 12:16:30.470 MQTT Mapper: MQTT CONNECT ID: 'Domoticz_MqttMapper_31_1708686990'
2024-02-23 12:16:30.520 MQTT Mapper: onMQTTConnected
2024-02-23 12:16:30.521 MQTT Mapper: getTopics: '{'ebusd/ctlv2', 'ëbusd/ctlv2'}'
2024-02-23 12:16:30.521 MQTT Mapper: MqttClient::Subscribe
2024-02-23 12:16:30.571 MQTT Mapper: onMQTTSubscribed
2024-02-23 12:16:30.237 Status: MQTT Mapper: Stop directive received.
2024-02-23 12:16:30.243 Status: MQTT Mapper: Exiting work loop.
2024-02-23 12:16:30.337 Status: MQTT Mapper: Stopping threads.
2024-02-23 12:16:30.337 Status: MQTT Mapper: Stopped.
2024-02-23 12:16:30.338 Status: MQTT Mapper: Started.
2024-02-23 12:16:30.338 Status: MQTT Mapper: Entering work loop.
2024-02-23 12:16:30.416 Status: MQTT Mapper: Initialized version 1.0.19, author 'Flying Domotic'

Re: Python Plugin: MqttMapper

Posted: Friday 23 February 2024 12:32
by vco1
hjzwiers wrote: Friday 23 February 2024 10:44 I added a second value, and again no value ....

{
"T_Living": {
"topic": "ebusd/ctlv2",
"key": "ebusd/ctlv2/z1RoomTemp",
"type": "80", "subtype": "5", "switchtype": "0" ,
"mapping": {"item": "", "multiplier": 0.1}
},

"T_Outside": {
"topic": "ëbusd/ctlv2",
"key": "ëbusd/ctlv2/DisplayedOutsideTemp",
"type": "80", "subtype": "5", "switchtype": "0" ,
"mapping": {"item": "", "multiplier": 0.1}
}
}
There's an error in T_Outside. It reads "ëbusd/ctlv2". The trema on ebusd shouldn't be there, I assume.

Re: Python Plugin: MqttMapper

Posted: Friday 23 February 2024 15:09
by hjzwiers
I thought that too, but it is just how it looks, it is an "e" lol. Tried a different one, same result

2024-02-23 15:47:38.760 MQTT Mapper: Device: 1 - ID: 1234, Name: 'MQTT Mapper - T_Living', nValue: 0, sValue: ''
2024-02-23 15:47:38.760 MQTT Mapper: Device: 2 - ID: 1235, Name: 'MQTT Mapper - T_Outside', nValue: 0, sValue: ''

"T_Living": {
"topic": "ebusd/ctlv2",
"key": "ebusd/ctlv2/z1RoomTemp",
"type": "80", "subtype": "5", "switchtype": "0",
"mapping": {"item": "", "multiplier": 0.1}
},

"T_Outside": {
"topic": "ebusd/ctlv2",
"key": "ebusd/ctlv2/DisplayedOutsideTemp",
"type": "80", "subtype": "5", "switchtype": "0",
"mapping": {"item": "", "multiplier": 0.1}
}
}

Something is still not right, no values are read

Re: Python Plugin: MqttMapper

Posted: Friday 23 February 2024 20:29
by Xenomes
vco1 wrote: Friday 23 February 2024 10:39 Although the "dirty fix" may resolve the issue (haven't tested this), this behaviour definitely seems to be a bug in the MQTT Mapper plugin. Although I'm not an experienced plugin developer by far, I'll try to see if I can spot the issue.
Good to know: this doesn't happen with at least 2 other plugins I tested. Both based on the legacy framework.
The issue has been resolved in later versions of Domoticz.

Re: Python Plugin: MqttMapper

Posted: Friday 23 February 2024 21:26
by vco1
Xenomes wrote: Friday 23 February 2024 20:29 The issue has been resolved in later versions of Domoticz.
I’m running 2024.4. Problem still exists. And so far only with this plugin.

Re: Python Plugin: MqttMapper

Posted: Friday 23 February 2024 23:33
by hjzwiers
hjzwiers wrote: Friday 23 February 2024 15:09 I thought that too, but it is just how it looks, it is an "e" lol. Tried a different one, same result

2024-02-23 15:47:38.760 MQTT Mapper: Device: 1 - ID: 1234, Name: 'MQTT Mapper - T_Living', nValue: 0, sValue: ''
2024-02-23 15:47:38.760 MQTT Mapper: Device: 2 - ID: 1235, Name: 'MQTT Mapper - T_Outside', nValue: 0, sValue: ''

"T_Living": {
"topic": "ebusd/ctlv2",
"key": "ebusd/ctlv2/z1RoomTemp",
"type": "80", "subtype": "5", "switchtype": "0",
"mapping": {"item": "", "multiplier": 0.1}
},

"T_Outside": {
"topic": "ebusd/ctlv2",
"key": "ebusd/ctlv2/DisplayedOutsideTemp",
"type": "80", "subtype": "5", "switchtype": "0",
"mapping": {"item": "", "multiplier": 0.1}
}
}
Something is still not right, no values are read, also the values aren't refreshed.

Re: Python Plugin: MqttMapper

Posted: Saturday 24 February 2024 10:08
by FlyingDomotic
Would it be possible to get a copy of payload sent when device changes?

IMHO, this perhaps a bug in MqttMapper plugin, but it may either be a configuration problem, with wrong "item" specification. That's why, with payload, we can find the right value.

Re: Python Plugin: MqttMapper

Posted: Saturday 24 February 2024 10:17
by hjzwiers
I don't know what you mean with payload? You can have anything you want :-)

Re: Python Plugin: MqttMapper

Posted: Saturday 24 February 2024 10:54
by FlyingDomotic
When speaking about MQTT, payload is message content related to a topic.

Here, the interesting topic is either "ebusd/ctlv2", "ebusd/ctlv2/z1RoomTemp" or "ebusd/ctlv2/DisplayedOutsideTemp".

Content of there topics may help.

To get the content, you may use tools likeMQTT_Explorer or MQTT.fx

Another possibility (if given "ebusd/ctlv2" is the right one), is to set MqttMapper plugin into debug mode (on the hardware page).

Re: Python Plugin: MqttMapper

Posted: Saturday 24 February 2024 11:30
by hjzwiers
First result:

2024-02-24 11:25:56.372 MQTT Mapper: MqttClient::onDisonnect Disconnected from: 192.168.2.71:1883
2024-02-24 11:25:56.372 MQTT Mapper: MqttClient::Close
2024-02-24 11:25:56.372 MQTT Mapper: onMQTTDisconnected
2024-02-24 11:25:56.472 MQTT Mapper: Worker thread started.
2024-02-24 11:25:56.540 MQTT Mapper: 'HardwareID':'31'
2024-02-24 11:25:56.540 MQTT Mapper: 'HomeFolder':'/home/hjz/domoticz/plugins/MqttMapper/'
2024-02-24 11:25:56.540 MQTT Mapper: 'StartupFolder':'/home/hjz/domoticz/'
2024-02-24 11:25:56.540 MQTT Mapper: 'UserDataFolder':'/home/hjz/domoticz/'
2024-02-24 11:25:56.540 MQTT Mapper: 'Database':'/home/hjz/domoticz/domoticz.db'
2024-02-24 11:25:56.540 MQTT Mapper: 'Language':'en'
2024-02-24 11:25:56.540 MQTT Mapper: 'Version':'1.0.19'
2024-02-24 11:25:56.540 MQTT Mapper: 'Author':'Flying Domotic'
2024-02-24 11:25:56.540 MQTT Mapper: 'Name':'MQTT Mapper'
2024-02-24 11:25:56.540 MQTT Mapper: 'Address':'192.168.2.71'
2024-02-24 11:25:56.540 MQTT Mapper: 'Port':'1883'
2024-02-24 11:25:56.540 MQTT Mapper: 'Key':'MqttMapper'
2024-02-24 11:25:56.540 MQTT Mapper: 'Mode1':'MqttMapper.json'
2024-02-24 11:25:56.540 MQTT Mapper: 'Mode6':'Verbose'
2024-02-24 11:25:56.540 MQTT Mapper: 'DomoticzVersion':'2024.4 (build 15910)'
2024-02-24 11:25:56.540 MQTT Mapper: 'DomoticzHash':'0f2fcff99'
2024-02-24 11:25:56.540 MQTT Mapper: 'DomoticzBuildTime':'2024-02-10 12:56:24'
2024-02-24 11:25:56.540 MQTT Mapper: Device count: 2
2024-02-24 11:25:56.540 MQTT Mapper: Device: 1 - ID: 1234, Name: 'MQTT Mapper - T_Living', nValue: 0, sValue: ''
2024-02-24 11:25:56.540 MQTT Mapper: Device: 2 - ID: 1235, Name: 'MQTT Mapper - T_Outside', nValue: 0, sValue: ''
2024-02-24 11:25:56.540 MQTT Mapper: Debug logging mask set to: PYTHON PLUGIN DEVICE CONNECTION MESSAGE
2024-02-24 11:25:56.540 MQTT Mapper: Updating device T_Living
2024-02-24 11:25:56.540 (MQTT Mapper - T_Living) Updating device from 0:'' to have values 0:''.
2024-02-24 11:25:56.541 MQTT Mapper: Updating device T_Outside
2024-02-24 11:25:56.541 (MQTT Mapper - T_Outside) Updating device from 0:'' to have values 0:''.
2024-02-24 11:25:56.543 MQTT Mapper: MqttClient::__init__
2024-02-24 11:25:56.543 MQTT Mapper: MqttClient::Open
2024-02-24 11:25:56.543 MQTT Mapper: Protocol set to: 'MQTT'.
2024-02-24 11:25:56.543 MQTT Mapper: Transport set to: 'TCP/IP', 192.168.2.71:1883.
2024-02-24 11:25:56.543 MQTT Mapper: Connect directive received, action initiated successfully.
2024-02-24 11:25:56.543 MQTT Mapper: Heartbeat interval set to: 60.
2024-02-24 11:25:56.594 MQTT Mapper: MqttClient::onConnect
2024-02-24 11:25:56.594 MQTT Mapper: Successful connect to: 192.168.2.71:1883
2024-02-24 11:25:56.594 MQTT Mapper: MqttClient::Connect
2024-02-24 11:25:56.594 MQTT Mapper: MQTT CONNECT ID: 'Domoticz_MqttMapper_31_1708770356'
2024-02-24 11:25:56.594 MQTT Mapper: Sending 47 bytes of data
2024-02-24 11:25:56.594 MQTT Mapper: 10 2d 00 04 4d 51 54 54 04 02 00 3c 00 21 44 6f 6d 6f 74 69 .-..MQTT...<.!Domoti
2024-02-24 11:25:56.594 MQTT Mapper: 63 7a 5f 4d 71 74 74 4d 61 70 70 65 72 5f 33 31 5f 31 37 30 cz_MqttMapper_31_170
2024-02-24 11:25:56.594 MQTT Mapper: 38 37 37 30 33 35 36 .. .. .. .. .. .. .. .. .. .. .. .. .. 8770356
2024-02-24 11:25:56.644 MQTT Mapper: Received 4 bytes of data
2024-02-24 11:25:56.644 MQTT Mapper: 20 02 00 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ....
2024-02-24 11:25:56.644 MQTT Mapper: onMQTTConnected
2024-02-24 11:25:56.644 MQTT Mapper: getTopics: '{'ebusd/ctlv2'}'
2024-02-24 11:25:56.644 MQTT Mapper: MqttClient::Subscribe
2024-02-24 11:25:56.644 MQTT Mapper: Sending 18 bytes of data
2024-02-24 11:25:56.644 MQTT Mapper: 82 10 00 01 00 0b 65 62 75 73 64 2f 63 74 6c 76 32 00 .. .. ®....ebusd/ctlv2.
2024-02-24 11:25:56.694 MQTT Mapper: Received 5 bytes of data
2024-02-24 11:25:56.694 MQTT Mapper: 90 03 00 01 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. Ю...
2024-02-24 11:25:56.695 MQTT Mapper: onMQTTSubscribed
2024-02-24 11:25:56.371 Status: MQTT Mapper: Stop directive received.
2024-02-24 11:25:56.377 Status: MQTT Mapper: Exiting work loop.

And an update
2024-02-24 12:18:42.085 MQTT Mapper: Sending 2 bytes of data
2024-02-24 12:18:42.085 MQTT Mapper: c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �
2024-02-24 12:18:42.135 MQTT Mapper: Received 2 bytes of data
2024-02-24 12:18:42.135 MQTT Mapper: d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. Ю

Only I don't know what it means :-)

I'm reading (copied from MQTT explorer)
ebusd/ctlv2/z1RoomTemp
ebusd/ctlv2/DisplayedOutsideTemp

And the file:

{
"T_Living": {
"topic": "ebusd/ctlv2",
"key": "ebusd/ctlv2/z1RoomTemp",
"type": "80", "subtype": "5", "switchtype": "0",
"mapping": {"item": "", "multiplier": 0.1}
},

"T_Outside": {
"topic": "ebusd/ctlv2",
"key": "ebusd/ctlv2/DisplayedOutsideTemp",
"type": "80", "subtype": "5", "switchtype": "0",
"mapping": {"item": "", "multiplier": 0.1}
}
}

Re: Python Plugin: MqttMapper

Posted: Saturday 24 February 2024 20:14
by vco1
I found, and fixed, the issue with the disappearing settings as a.o. reported by @Hencor in this post.

Believe it or not, but this is caused by the name tag in the plugin definition:

Code: Select all

<plugin key="MqttMapper" name="MQTT Mapper with LAN Interface" author="Flying Domotic" version="1.0.19" externallink="https://github.com/FlyingDomotic/domoticz-mqttmapper-plugin">
Apparently this is not (all) treated as a string. The word "LAN" seems to have a special meaning in Domoticz. When changing the name to something without "LAN" everything works as expected.

So if the plugin definition is for example changed to:

Code: Select all

<plugin key="MqttMapper" name="MQTT Mapper with network Interface" author="Flying Domotic" version="1.0.19" externallink="https://github.com/FlyingDomotic/domoticz-mqttmapper-plugin">
all works fine. As can be seen below.
plugin.png
plugin.png (338.03 KiB) Viewed 1198 times

Re: Python Plugin: MqttMapper

Posted: Saturday 24 February 2024 23:42
by FlyingDomotic
hjzwiers wrote: Saturday 24 February 2024 11:30 First result:

And an update
2024-02-24 12:18:42.085 MQTT Mapper: Sending 2 bytes of data
2024-02-24 12:18:42.085 MQTT Mapper: c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. �
2024-02-24 12:18:42.135 MQTT Mapper: Received 2 bytes of data
2024-02-24 12:18:42.135 MQTT Mapper: d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. Ю
Thanks for the log.

Update is not really an update. This is the MQTT Ping sent to Mosquitto, and Mosquitto's pong answer. IT normally happens every minute.

To see payload, you have to wait for the (external) device to send it. It will be prefixed by "onMQTTPublish: '", followed by topic ''ebusd/ctlv2'', and finally the value (you have to set debug to "Extra verbose" before that.

If nothing is received after more twice expected update period, you may gave the wrong topic.

To find the right topic, use tool like MqttExplorer (https://mqtt-explorer.com/), connect to you MQTT server (giving IP and authentication),wait a bit for messages to be received, and explore things received by ebusd/ctlv2 topic, including its sub-topic(s). Try to locate data you want to get, and write down the full topic. This topic should be inserted into MqttMapper configuration file.

You may want to share it here, either publicly or through private message.

Hard copy of MqttExplorer screen showing this data may help.

Re: Python Plugin: MqttMapper

Posted: Sunday 25 February 2024 9:21
by hjzwiers
I could send you the file of the picture of MQTT? I don't know how to get it on here :-(

If I put the file error logs in "extra verbose" extra I don't get anyting?

It is not reading the sValue?

024-02-24 11:25:56.540 MQTT Mapper: Device: 1 - ID: 1234, Name: 'MQTT Mapper - T_Living', nValue: 0, sValue: ''
2024-02-24 11:25:56.540 MQTT Mapper: Device: 2 - ID: 1235, Name: 'MQTT Mapper - T_Outside', nValue: 0, sValue: ''
2024-02-24 11:25:56.540 MQTT Mapper: Debug logging mask set to: PYTHON PLUGIN DEVICE CONNECTION MESSAGE
2024-02-24 11:25:56.540 MQTT Mapper: Updating device T_Living
2024-02-24 11:25:56.540 (MQTT Mapper - T_Living) Updating device from 0:'' to have values 0:''.
2024-02-24 11:25:56.541 MQTT Mapper: Updating device T_Outside
2024-02-24 11:25:56.541 (MQTT Mapper - T_Outside) Updating device from 0:'' to have values 0:''.

I tried "mapping": {"item": value;~, "multiplier"= 0.1} , no difference

Re: Python Plugin: MqttMapper

Posted: Sunday 25 February 2024 11:02
by waltervl
hjzwiers wrote: Sunday 25 February 2024 9:21 I could send you the file of the picture of MQTT? I don't know how to get it on here :-(
There is an attachment tab for images under the submit button if you select full editor when typing a new reply.
Also check the mqtt debugging section of Domoticz wiki https://www.domoticz.com/wiki/MQTT#Debugging_MQTT

Re: Python Plugin: MqttMapper

Posted: Sunday 25 February 2024 11:17
by hjzwiers
MQTT.png
MQTT.png (220.11 KiB) Viewed 1150 times
I transfered an image lol

MQTT is fine, I can't get the sValue of the temperature

Re: Python Plugin: MqttMapper

Posted: Sunday 25 February 2024 11:31
by hjzwiers
MQTT2.pdf
(81.77 KiB) Downloaded 60 times

Re: Python Plugin: MqttMapper

Posted: Sunday 25 February 2024 22:38
by FlyingDomotic
Thanks !

Real topics are "ebusd/ctlv2/z1RoomTemp" and "ebusd/ctlv2/DisplayedOutsideTemp", so you configuration file should be something like:

Code: Select all

{
	"T_Living": {
	"topic": "ebusd/ctlv2/z1RoomTemp",
	"type": "80", "subtype": "5", "switchtype": "0",
	"mapping": {"item": "", "multiplier": 0.1}
	},

	"T_Outside": {
	"topic": "ebusd/ctlv2/DisplayedOutsideTemp",
	"type": "80", "subtype": "5", "switchtype": "0",
	"mapping": {"item": "", "multiplier": 0.1}
	}
}
With that, data should be collected.

Re: Python Plugin: MqttMapper

Posted: Monday 26 February 2024 10:17
by hjzwiers
Wow, I must have tried a million types of input files, but not this one .....

You solved it thanks a lot!

Re: Python Plugin: MqttMapper

Posted: Monday 26 February 2024 10:32
by FlyingDomotic
MISS & KISS (Make It Simple Stupid / Keep It Simple Stupid ;-)

Re: Python Plugin: MqttMapper

Posted: Saturday 16 March 2024 16:03
by thaui
it partially works for me . I get data from a BME680 IAQ sensor from an Arduino D1 Mini. I have transfered the values to the Mosquitto broker and the device appears in Mosquitto. For some reason the Baro device is not available in the Domoticz GUI and for humidity I have not found any type to get the values updated . I have gambled arround several hours with the MqttMapper.json file but do not get a satisfing result. What am I doing wrong?