LG Smart ThinQ

i get:

you mean thinq_mqtt.py?

Oh right :slight_smile: thinq_mqtt.py of course (I also have tuya_mqtt.py running here) - sorry for the confusion!

Connection Refused: not authorized.

Do you have a user/password set in mqtt?

yes i have

but also when i run

[20:08:53] openhabian@openhab:~$ mosquitto

i get

1603473750: mosquitto version 1.5.7 starting
1603473750: Using default config.
1603473750: Opening ipv4 listen socket on port 1883.
1603473750: Error: Address already in use

i use Eclipse Mosquitto broker only for my openhab ā€¦i set it up through sudo openhabian-config.I am confused

Running mosquitto will try to start the server on port 1883 - but yours is already runningā€¦ I guess I found the problemā€¦ Can you please try this version now?

wget https://raw.githubusercontent.com/Flip76/thinq2-python/master/thinq_mqtt.py

If you use username/password, your subscripe-command should look like:

mosquitto_sub -h localhost -u username -P password -t thinq/#

1 Like

you nailed it all is good now thnk you

1 Like

I guess I owe you an explaination :slight_smile:

In all the quick and dirty coding, I forgot to handover the username/password from the variables (on top of the script) to the mqtt-connection. Therefore the script always tried to connect without username/password.

Sorry for that and thanks for all your patience!

1 Like

LOL r u serious mate?You r doing all the hard work i am just here to learn.Today i learned so much about linux and mosquitto from ur ā€œmistakeā€ :slight_smile: Many many thnx.

2 Likes

A bit off topic but in case your interested I flashed a few Tuya light switches with Tasmota using a cable, now OH talks MQTT directly to them

1 Like

I have some devices which I canā€˜t flash - so I did it that way:

But thanks for your input, really appreciated!

Regarding control I just found this in case it provides a clue to whatā€™s needed

Is there a way of sniffing the iphone traffic to see what commands are being issued by the app?

Now the messages are retained many more settings have appeared too

I found that discussion too but itā€™s basicely about an airconā€¦ I couldnā€™t get it to work with a washer/dryerā€¦ The reverse engineering would be part of the underlaying API and I hope the guys will find a solutionā€¦

I asked a question abs was directed towards further work since my last post which may help-

Controlling fans and other appliances can be done with the info above. Starting a washer is much more complicated, and since I donā€™t see any benefit in it, I never tried. I did grab the required json command here: ollo69/ha-smartthinq-sensors#47

I know this thread too but if you try to post the json-payload shown, nothing happens :frowning:
Also I canā€™t see anyone saying that this works - they are just saying ā€œitā€™s more complicatedā€ and they never tried itā€¦

My hope is on this:

That all makes sense, hopefully something will appear soon.
My guess is the washer needs a large JSON containing many things before it will start as it seems to lose everything when it goes to sleep. Operating locally I have to deselect the cycle / extra rinse etc every time I use it, although remote start seems to stay on meaning it could work.
Iā€™m happy to experiment with my machine if it helps and you can talk me through it. Experience with other things makes me wonder whether the incoming JSON could be modified slightly and then sent back.
Is it possible to control this thing through a web browser or curl?

although remote start seems to stay on meaning it could work.

Thatā€™s my understanding - also the app requires the remote start enabled and that makes the whole thing a kind of uselessā€¦ If you leave your house without enabling the remote start first, the only thing you can do is to call your wife and ask her to start the washer - or you could work around with a bunch of those: SwitchBot Bot | Make Your Switch Smarter | SwitchBot International :smiley:

Is it possible to control this thing through a web browser or curl?

I tried with curl and posted the json payload but no success - the only response was:

{"resultCode":"0003","result":""}

But Iā€™m not a professional developer - I would appreciate any hint which can get this to workā€¦

The problem is the cycle time is unpredictable and seems to change as the wash cycle progresses. Fortunately Iā€™m learning its ways and have just written a rule to predict what the end time needs to be set to so it finishes when I want. Iā€™ll stick a bunch of logging in so I can refine things a bit.
Wonder if that SwitchBot can work with the capacitve touch switch on my drier :slight_smile:

@Flip Iā€™ve changed to OH3 and broken thinq-mqtt along the way. Iā€™ve changed the system file to point to /etc/openhab/scripts instead of /etc/openhab2/scripts but

poetry run python3 thinq_mqtt.py
gives

Poetry could not find a pyproject.toml file in /root or its parents

at .poetry/lib/poetry/_vendor/py3.7/poetry/core/factory.py:369 in locate
  365ā”‚
  366ā”‚         else:
  367ā”‚             raise RuntimeError(
  368ā”‚                 "Poetry could not find a pyproject.toml file in {} or its parents".format(
ā†’ 369ā”‚                     cwd
  370ā”‚                 )
  371ā”‚             )
  372ā”‚

Iā€™ve tried poetry --uninstall which doesnā€™t work. Reverting the the old disk brings it back to life so somewhere I have the working settings, and copying the old files over to the exact same directory - /etc/openhab2/scripts works,

Did you run

poetry install

within your new location?

Does Poetry Install need running from /etc/OpenHAB/scripts? Do I need to try and uninstall the old copy?

Poetry creates a .poetry directory from where you run ā€œpoetry installā€ - according to the error message

Poetry could not find a pyproject.toml file in /root or its parents
at .poetry/lib/poetry/_vendor/py3.7/poetry/core/factory.py:369 in locate

I would guess that .poetry-directory doesnā€™t exist in /root.

My system-file looks like:

[Unit]
Description=thinq-mqtt
After=mosquitto.service

[Service]
ExecStart=/bin/bash -c "PATH=/home/openhabian/.poetry/bin:$PATH exec poetry run python3 thinq_mqtt.py"
Restart=always
User=openhabian
Group=openhabian
WorkingDirectory=/etc/openhab2/scripts/thinq2-python

[Install]
WantedBy=multi-user.target

You could first try to adjust the system-file to the new path of your .poetry-directory