Announcement

Collapse
No announcement yet.

How to create a fonctionnal MQTT device ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to create a fonctionnal MQTT device ?

    Hi ,

    i am using the MQTT plugin.

    I am able to publish command with HS3 . But how do i map those commands to a MQTT device in HS3?

    Here are the commands/values i am trying to add to the device :

    https://ibb.co/fOt3Oa

    thank you !!

    #2
    sorry - don't have the answer to this, but I'd like to know the solution as well!

    Comment


      #3

      Comment


        #4
        Is this what you were using: https://github.com/hobbyquaker/lgtv2mqtt
        If so, how did you link the addon? I can't get anything to run though the mqtt plugin shows as connected

        Comment


          #5
          Sorry i am not the better in english but i'll try. And yes this is what i used

          I think the key to understand here is that you won't get any device from Mqtt...but you will have access to fonctions.

          theses fonctions needs to be mapped to a virtual device.

          Ex: create a device, name it ''mute'' ( or what you want), and create those events :

          https://ibb.co/moHH6G ( to map the mute button to the on/off of the virual device)


          https://ibb.co/h03qRG ( to get the real status of the ''mute'' fonction on you virtual device)...but you will need easy triger plugin for that.

          Comment


            #6
            To get the real time status of the mute fonction of the tv ( second picture ),

            you will neeed to subscribe to the mute topic of lgtv2mqtt

            here is a picture of my subcriptions:

            https://imgur.com/1gyMXZZ


            this will create a status device only***


            To be able to control the fonctions of the tv, you have to create a virtual device ..after that it is up to you if you want you virtual device tpo be linked to the real state of you tv fonctions

            Comment


              #7
              I understand the logic of the events you show, however, I'm missing the how you can connect to the lgtv2mqtt addon. I was able to pair lgtv2mqtt to my tv.

              Code:
              I do have mosquitto running:
              root@odroid:/usr/lib/node_modules# ps -ef | grep mosquitto
              root     23443     1  0 16:45 ?        00:00:00 /bin/sh -c /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf -d
              mosquit+ 23444 23443  1 16:45 ?        00:00:00 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
              I've tried invoking the lgtv2mqtt:

              Code:
              root@odroid:/usr/lib/node_modules# lgtv2mqtt -t 192.168.1.9
              2017-09-30 16:47:17.671 <info>  lgtv2mqtt 1.0.0 starting
              2017-09-30 16:47:17.678 <info>  mqtt trying to connect mqtt://127.0.0.1
              2017-09-30 16:47:17.949 <info>  tv connected
              but I'm unable to get anything to fire

              I tried setting up a simple manually triggered event that is:

              MQTT: Publish custom topic
              Topic: lgtv/set/toast
              Message: Hello

              but that doesn't work. I'm probably missing something so simple that I'll boot myself once it works

              Comment


                #8
                In the settings of the tv , in the general tab , did you set ''mobile tv '' to ''on'' ?

                if no, put it on , and retry lgtv2mqtt -t 192.168.1.9

                Comment


                  #9
                  Originally posted by Summerguy View Post
                  In the settings of the tv , in the general tab , did you set ''mobile tv '' to ''on'' ?

                  if no, put it on , and retry lgtv2mqtt -t 192.168.1.9
                  Yes, I did put the setting on and did successfully pair the tv with lgtv2mqqt.
                  Do I need to run it subsequently?

                  Comment


                    #10
                    I now have it working, turned out that I needed to run lgtv2mqtt like so:

                    Code:
                    lgtv2mqtt -t 192.168.1.9 -u mqtt://192.168.1.13
                    My toast message worked

                    Comment


                      #11
                      It looks like I can detect power on/off through lgtv/status/foregroundApp
                      I'm using the contains easy trigger and when it contains a "." then it's on [e.g. com.webos.app.hdmi1] while if it does not, it's off. I sniffed around running:

                      mosquitto_sub -v -h 192.168.1.13 -p 1883 -t '#'

                      so far, so good.

                      I also have a subscription to lgtv/set/toast, which allows me to put a message on the screen. I used to do this through Kodi but as I'm running a Nvidia Shield TV, I might be in youtube or some other app. It works well though it did seem that it wouldn't fire it was far down on the "then" statements in the event

                      All in all, it's very cool.

                      Comment


                        #12
                        Glad you got it right!

                        Yes the toast feature is really useful!!

                        If you happen to know how to create a virtual dimming device and map each level of the (100) sound of the Tv on it, without creating 100 events for this, please let me know

                        For now I think I will have to create those 100 events lol..


                        Originally posted by macrho View Post
                        It looks like I can detect power on/off through lgtv/status/foregroundApp
                        I'm using the contains easy trigger and when it contains a "." then it's on [e.g. com.webos.app.hdmi1] while if it does not, it's off. I sniffed around running:

                        mosquitto_sub -v -h 192.168.1.13 -p 1883 -t '#'

                        so far, so good.

                        I also have a subscription to lgtv/set/toast, which allows me to put a message on the screen. I used to do this through Kodi but as I'm running a Nvidia Shield TV, I might be in youtube or some other app. It works well though it did seem that it wouldn't fire it was far down on the "then" statements in the event

                        All in all, it's very cool.

                        Comment


                          #13
                          Originally posted by macrho View Post
                          It looks like I can detect power on/off through lgtv/status/foregroundApp
                          I'm using the contains easy trigger and when it contains a "." then it's on [e.g. com.webos.app.hdmi1] while if it does not, it's off. I sniffed around running:
                          .
                          I am not sure what you are talking about with the ''.''

                          I always see them when i turn of my tv.

                          that would be a really nice feature

                          Comment


                            #14
                            Originally posted by Summerguy View Post
                            I am not sure what you are talking about with the ''.''

                            I always see them when i turn of my tv.

                            that would be a really nice feature
                            Attached are two images:

                            detectOff: I monitor the foregroundApp and when it is running, it usually is something like: com.webos.app.hdmi1 So the periods "." in the app name allow me to determine whether or not the TV is actually on or off. When the TV goes off, I believe a (null) is displayed but I have not yet been able to get that to work. Using the "." and contains or does not contain seem to manage the state

                            Turn TV On: I found that this setting works so I don't have to use WOL to turn the TV on.
                            Attached Files

                            Comment


                              #15
                              I take it back, it seems the only way to power on the TV is via WOL.

                              Comment

                              Working...
                              X