MQTT point in comma
How can I convert a value 0.18234 to 0.18234 so that I can calculate with it?
MQTT
Moderators: grovkillen, Stuntteam, TD-er
Re: MQTT
I think you meant "0,18234" as input?
Where do you get this value from?
Is it via MQTT import or via commands and using C005?
Where do you get this value from?
Is it via MQTT import or via commands and using C005?
Re: MQTT
C005 is the OpenHab/HomeAssistant controller in ESPEasy.
As shown in its documentation, you can also subscribe to topics crafted in such a way that they represent commands for ESPEasy. See: https://espeasy.readthedocs.io/en/lates ... d-handling
As you can also craft commands to generate an event, and the comma is the separator of parameters (called eventvalues in ESPEasy), you could combine those separate eventvalues into a single value.
Ton does have a lot of work recently on the MQTT import plugin, which he also documents very well: https://espeasy.readthedocs.io/en/lates ... #p037-page
I did have a quick look, but right now I can't think of a way how to replace those decimal commas.
Maybe he has some idea...
As shown in its documentation, you can also subscribe to topics crafted in such a way that they represent commands for ESPEasy. See: https://espeasy.readthedocs.io/en/lates ... d-handling
As you can also craft commands to generate an event, and the comma is the separator of parameters (called eventvalues in ESPEasy), you could combine those separate eventvalues into a single value.
Ton does have a lot of work recently on the MQTT import plugin, which he also documents very well: https://espeasy.readthedocs.io/en/lates ... #p037-page
I did have a quick look, but right now I can't think of a way how to replace those decimal commas.
Maybe he has some idea...
Re: MQTT
It turned out to be quite easy, just enable the 'Generate events for accepted topics' option in the MQTT Import task and add a rule for your MQTT topic to 'convert' and assign the value like this:
Code: Select all
on mqtt/topic/cmd do // Handle the MQTT Topic event from MQTT Import
Let,1,%eventvalue1%.%eventvalue2% // The initial comma separates the values into 2 arguments
LogEntry,'Value: %v1%' // Optional logging of the value
TaskvalueSet,Variables,Dummy1,[var#1] // Assign the value to a Dummy task to be used elsewhere, or immediately use it somewhere else like on a display
endon
/Ton (PayPal.me)
Who is online
Users browsing this forum: No registered users and 1 guest