Page 10 of 19

Re: Python Plugin: MqttMapper

Posted: Sunday 07 July 2024 17:25
by tiga
thank you....looks like it did the job.

now i have to bepatient and see if there is a change when the bypass changes.

Re: Python Plugin: MqttMapper

Posted: Sunday 07 July 2024 17:29
by FlyingDomotic
Nothing protects against chance!

Re: Python Plugin: MqttMapper

Posted: Monday 15 July 2024 7:02
by sheepishalbum
Hi everyone!

Is there a way to have the script refresh the incoming values from MQTT at the rate they come in and not every 60 seconds like now?
I have Domoticz paired with a BMS and this BMS sends MQTT data every 5 seconds to Domoticz, but the script updates the data every minute.

Re: Python Plugin: MqttMapper

Posted: Monday 15 July 2024 11:11
by FlyingDomotic
As of now, plugin is triggered as soon as MQTT sends data (so every 5 seconds in your case).

If you write a script to do something, you may use a "device change" trigger instead of a "timer trigger". This means that script will be activated each time device changes (in this case, specify device which receive MQTT change as trigger), instead of every minute.

Here's an example for LUA script:

Code: Select all

commandArray = {}

-- loop through all the changed devices
for deviceName,deviceValue in pairs(devicechanged) do
	if (deviceName=='myDomoticzMqttDevice') then
		<put here commands you want to be executed each time 'myDomoticzMqttDevice' is changed>
	end
end
... and one for dzVents script:

Code: Select all

return {
	on = {devices = {'myDomoticzMqttDevice'}},
	logging = {level = domoticz.LOG_DEBUG, marker = 'template'},
	execute = function(domoticz, device)
		<put here commands you want to be executed each time 'myDomoticzMqttDevice' is changed>
	end
}
Change 'myDomoticzMqttDevice' by your Domoticz MQTT device name (those given in your MqttMapper.jspn file).

Re: Python Plugin: MqttMapper

Posted: Monday 15 July 2024 20:35
by sheepishalbum
FlyingDomotic wrote: Monday 15 July 2024 11:11 As of now, plugin is triggered as soon as MQTT sends data (so every 5 seconds in your case).[...]
Thank you so much for your quick help - it works! :)
Thank you also for the amazing domoticz plugin!!!

Re: Python Plugin: MqttMapper

Posted: Monday 15 July 2024 22:45
by FlyingDomotic
As already told: Nothing protects against chance!

Re: Python Plugin: MqttMapper

Posted: Wednesday 31 July 2024 20:32
by rron
I have started a topic in utility but it looks that mqttmapper can give me a better solution. My smartevse open source electric car
Loader can communicate via mqtt. But in I am missing the payload and therefore I can’t integrate with domoticz. Mqttmapper is already installed but how canI proceed from there. Is it possible?



https://www.domoticz.com/forum/viewtopi ... 68#p318968

Re: Python Plugin: MqttMapper

Posted: Thursday 01 August 2024 2:07
by FlyingDomotic

Re: Python Plugin: MqttMapper

Posted: Saturday 03 August 2024 9:04
by thaui
It`s nice to see that the project MqttMapper is under development and it's a great tool to get Mqtt messages integrated to Domoticz. I am using this plugin since several months but I did a mistake. I was updating the plugin and now the devices in Domoticz are showing only "Zero" values. It was a very simple setup in the MqttMapper.json file.

"BME680_1 Iaq": {
"topic": "BME680_01/iaq",
"type": "249", "subtype":"1",
"mapping":{"item":""}
},
What I am doing wrong and where is the hint? Data are available in Mqtt Explorer. Any help is welcome

Re: Python Plugin: MqttMapper

Posted: Saturday 03 August 2024 12:54
by FlyingDomotic
Should be fixed in last version. Sorry about that!

Re: Python Plugin: MqttMapper

Posted: Wednesday 21 August 2024 17:28
by thaui
How can the MqttMapper be updated after changing the MqttMapper.json e.g. after adding a new device. Updating the Idx under hardware is not possible. Until now I deleted the Idx and re-entered it again. But in this case I get every time new devices in the database. Also activating/deactivating is not reading the changed json file.

Re: Python Plugin: MqttMapper

Posted: Wednesday 21 August 2024 18:09
by FlyingDomotic
thaui wrote: Wednesday 21 August 2024 17:28 How can the MqttMapper be updated after changing the MqttMapper.json e.g. after adding a new device. Updating the Idx under hardware is not possible. Until now I deleted the Idx and re-entered it again. But in this case I get every time new devices in the database. Also activating/deactivating is not reading the changed json file.
Just restart MqttMapper plug-in, either selecting it on "Hardware" tab and clicking on "Update", or restarting Domoticz.

Re: Python Plugin: MqttMapper

Posted: Thursday 22 August 2024 10:44
by thaui
that's exactly what I ment. With restart Domoticz it works but selecting it on "Hardware" tab and clicking on "Update" nothing happend at all. I am on RPI3 with the latest stable release. By the way if you read this email. I am fighting to read P1meter values from a tasmota device.
P1meter topic.JPG
P1meter topic.JPG (35.48 KiB) Viewed 1688 times
I want to get "export_total_kwh","total_kwh" and "curr_w". No chance to get value to Domoticz

Re: Python Plugin: MqttMapper

Posted: Thursday 22 August 2024 16:11
by FlyingDomotic
They're 2 classical things that may cause issues:
1) published data is not marked as "retain". In this case, MqttMapper won't be updated until value changes. It's generally a good idea to flag topics "retain", as readers staring after last update could see last value.
2) you made changes into device type/subtype/switchtype/options not allowed by Domoticz. In this case, you have to delete device and restart plug-in in order for a new one to be crated with last settings.

Re: Python Plugin: MqttMapper

Posted: Thursday 22 August 2024 21:07
by hjzwiers
My MQTT mapper stopped working, the signals running and signal are failing. In MQTT explorer they are both true.
It used to work fine. The temperature readouts are fine. What changed?

{
"T_Outside": {
"topic": "ebusd/broadcast/outsidetemp",
"type": "80", "subtype": "5", "switchtype": "0",
"mapping": {"item": "", "multiplier": 1}
},

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

"MQTTrunning": {
"topic": "ebusd/global/running",
"type": "244", "subtype": "73", "switchtype": "0",
"mapping": {"item": "", "default": "0", "values": {"True": "1"}}
},
"MQTTsignal": {
"topic": "ebusd/global/signal",
"type": "244", "subtype": "73", "switchtype": "0",
"mapping": {"item": "", "default": "0", "values": {"True": "1"}}
}
}

Re: Python Plugin: MqttMapper

Posted: Thursday 22 August 2024 22:57
by FlyingDomotic
Would it be possible to get content concerned topics (probably ebusd/global/running)? the way this is coded, value is on if topic is "True", off else.

In addition when something stops working, try to figure out what changed recently (an update of code/firmware could easily be cause of this kind of problem). Did you changed something recently?

Re: Python Plugin: MqttMapper

Posted: Friday 23 August 2024 10:07
by hjzwiers
Well I needed to reinstall the complete system due to a docker crash.

I simply don't know what is going wrong with this and have no clue, from your reaction you don't either .... I thought maby you changed something in the code of MQTT mapper

My MQTT mapper stopped working, the signals running and signal are failing, in MQTT explorer they are both true. It used to work fine. The temperature readouts are fine, but i needed to change the multiplier (from 0.1 to 1)

Image

Re: Python Plugin: MqttMapper

Posted: Friday 23 August 2024 10:23
by FlyingDomotic
Running MqttMapper with debug and sending me Domoticz log in PM may help ;-)

Meantime, would it be possible to get a copy of ebusd topics?

Re: Python Plugin: MqttMapper

Posted: Friday 23 August 2024 11:11
by hjzwiers
I sent a screenshot of MQTT explorer, here is the relevant data:

During startup the logging is totally filled with MQTT auto discovery .........

2024-08-23 11:15:22.097 MQTT mapper: Sending 2 bytes of data
2024-08-23 11:15:22.097 MQTT mapper: c0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..
2024-08-23 11:15:22.147 MQTT mapper: Received 2 bytes of data
2024-08-23 11:15:22.147 MQTT mapper: d0 00 .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. Ю

2024-08-23 11:33:08.489 MQTT mapper: Received 33 bytes of data
2024-08-23 11:33:08.489 MQTT mapper: 30 1f 00 16 65 62 75 73 64 2f 63 74 6c 76 32 2f 7a 31 52 6f 0...ebusd/ctlv2/z1Ro
2024-08-23 11:33:08.489 MQTT mapper: 6f 6d 54 65 6d 70 32 33 2e 37 38 37 35 .. .. .. .. .. .. .. omTemp23.7875
2024-08-23 11:33:08.490 MQTT mapper: onMQTTPublish found ebusd/ctlv2/z1RoomTemp, Device 'MQTT mapper - T_Living', message '23.7875'
2024-08-23 11:33:08.490 MQTT mapper: Setting MQTT mapper - T_Living to 24/23.7875
2024-08-23 11:33:08.490 (MQTT mapper - T_Living) Updating device from 24:'23.725' to have values 24:'23.7875'.

(there is a small box with I think a question mark in the c0 00 but it is not displayed)

I removed the part behind "default": "0" and it is working! I don't know why though ...........

"MQTTrunning": {
"topic": "ebusd/global/running",
"type": "244", "subtype": "73", "switchtype": "0",
"mapping": {"item": "", "default": "0"}

Re: Python Plugin: MqttMapper

Posted: Friday 23 August 2024 12:29
by FlyingDomotic
Thanks for the log.

I'm greatly interested by MqttMapper initialization messages, as they'll contains (among others) current topics values.

In addition, I'll write a small tool which will dump on scree values of used topics, to help debugging. As soon written, I'll tell you.

Stay tuned!