Posts by Yankee_1978

    Yeah, now it works.

    The script looks like this:


    Code
    import sys
    sys.path.append('/storage/.kodi/addons/service.mqtt/lib')
    import client as mqtt
    
    broker_address="192.168.XXX.XXX" 
    
    client = mqtt.Client("P1") #create new instance
    client.connect(broker_address) #connect to broker
    client.publish("cmnd/bruecke1/power","ON")#publish

    Now when the script is started this way

    "python test.py"

    a payload named "ON" is published to the topic "cmnd/bruecke1/power".

    Thanks for your help.

    Maybe this can help someone else...

    Greetings

    Yankee

    Thanks for your response.

    I changed the script this way, but it still won´t run... :(

    Script:

    This error occurs:

    Code
        client = mqtt.Client("P1") #create new instance
    NameError: name 'mqtt' is not defined

    What do i have to do to define "mqtt"

    "import sys as mqtt" doesn´t work.

    Hello,

    thanks for the response.

    i have installed the addon "kodi2mqtt"

    i am trying to get a python script to run, but i am getting an error.

    The script looks like this:

    at the command-line i am trying the script to work like this:

    "python test.py"

    And the error:

    Code
    Traceback (most recent call last):
      File "test.py", line 3, in <module>
        import paho.mqtt.client as mqtt #import the client1
    ImportError: No module named paho.mqtt.client

    The python-script doesn´t work.

    Can someone help me with this script?

    do i have to install some addons?

    At the command-line it is not possible to install something.

    Greetings

    Yankee

    Hi,

    i have a question at my libreelec installation.

    It runs on RPi3 at version 18.8


    Is it possible with a button press on the remote control to publish a string via mqtt?

    Example:

    The button "Power" is pressed on the remote.

    After that the string "OFF" should be published on the topic "device/Power"

    is it possible?

    Maybe a script or something?

    I still have searched the internet, but didn´t find the right answers.


    Can anyone give me a hint?

    Thanks in advance

    Yankee