MQTT > Virtual Input Text to Value

Einklappen
X
 
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge
  • edipseamm
    Smart Home'r
    • 03.02.2020
    • 58

    #1

    MQTT > Virtual Input Text to Value

    Hey Guys

    I'm looking for advice on how to take a JSON input from MQTT and convert it to something I can use. Normally, my devices come with a numeric value, so that is no problem; however, the device below returns a 'true/false' result.

    2 Questions:
    1. How can a JSON MQTT input be used as a http virtual input. What is the url example back to the miniserver?
    Klicke auf die Grafik für eine vergrößerte Ansicht

Name: Capture-2609-0755-000742@2x.png
Ansichten: 0
Größe: 31,5 KB
ID: 469774


    2. Does anyone have an example of using a text input to some logic?

    Normally, I would use the Command Recognition block but this does not work for text for me.


    Klicke auf die Grafik für eine vergrößerte Ansicht

Name: Capture-2609-0757-000744@2x.png
Ansichten: 0
Größe: 90,6 KB
ID: 469775


    As always TIA
  • Andsor
    Azubi
    • 08.07.2025
    • 2

    #2
    For true/false results from MQTT, you can parse the JSON via a Virtual HTTP Input and then use a Virtual Output + Logic block to convert it into 0/1. Example URL:

    Code:
    http://user:pass@miniserver/ip/dev/sps/io/InputName/1

    (or 0 if false).

    For handling text input, try using Regex in the Command Recognition block, or run it through an intermediate script (Node-RED, Python, etc.) to map text into numeric values and send them back to the Miniserver.

    Kommentar

    Lädt...