Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ThinQ Oven Support #87

Open
nVuln opened this issue Sep 23, 2021 Discussed in #28 · 30 comments
Open

ThinQ Oven Support #87

nVuln opened this issue Sep 23, 2021 Discussed in #28 · 30 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@nVuln
Copy link
Owner

nVuln commented Sep 23, 2021

I'm currently working on Oven implementation, I need collect device data first
I already published test version for Oven v1.3.0-oven.1, this version is still not implemented anything, just register Oven as supported device and collecting data

How to install testing version

Select Install Previous Version in Homebridge UI X, choose version started with v1.6.0-test.x

Screen Shot 2021-08-08 at 6 44 40 PM

How to collect device data ?

turn on homebridge debug mode first, then install and setting plugin oven version (v1.6.0-test.x)
make sure in your homebridge log showing something like this

[9/23/2021, 12:59:27 PM] [LGThinQ] [Oven] Setting up device!
[9/23/2021, 12:59:29 PM] [LGThinQ] Adding new accessory: 47e159a5-*****: Oven (OVEN LSGL6337F.*****)
[9/23/2021, 12:59:29 PM] [LGThinQ] Start MQTT listener for thinq2 device
[9/23/2021, 12:59:32 PM] [LGThinQ] Successfully connected to the MQTT server.

your Oven is ready now, then make some cook, preheat, adjust temperature ... anything you can do in your oven
every action you did, you may got debug log [9/23/2021, 1:11:41 PM] [LGThinQ] mqtt message received:, that is what I need, please upload all debug log

Wanna help ?

I already pushed Oven source code to dev/oven branch, feel free to make PR if you wanna help

Discussed in #28

Originally posted by rrhoade2 July 23, 2021
Are there any plans to add support for the recent LG ThinQ Ovens at some point in the future? I'm wondering specifically about cooktop and oven statuses and oven pre-heat notifications. Thanks!

@nVuln nVuln pinned this issue Sep 23, 2021
@nVuln nVuln added enhancement New feature or request help wanted Extra attention is needed labels Sep 23, 2021
@rdnewt
Copy link

rdnewt commented Oct 10, 2021

I removed any lines that were relating to a different homebridge package, so that's what all the lines that are just an ellipse is. I didn't realize the log only covers about a day with how much I've got running on it, so I think this only has oven messages. I will try to remember to grab the log again the next time I use the stove top and timer as well.
homebridge_thinq.log.txt

@everyplace
Copy link

I'll install this plugin this weekend and pull logs from my oven. Thanks for providing instructions on how to do so. My model is the LSD4913ST, so hopefully that'll help.

@pjteeter
Copy link

Oven model is WLC389PC. Homebridge debug logging attached.
lg_thinq_oven_debug_logging.log.zip

@beslergr
Copy link

Oven model is LSGS6338F. Debug logging attached.
homebridge.log.txt

@carlosgamezvillegas
Copy link

Hello nVuln,

I am currently working on an Oven implementation using your plugin as base, but so far I am only able to get the current status of the oven (I show different options using a TV accessory and the inputs of the TV as different Status messages), however, cannot figure out how to send commands to the oven to start cooking or set timers.

Could you help me out figuring out how to send commands to the oven? When I am done I will be happy to share the code. In addition that I will be also modifying it to support a Microwave as well.

Here is an example of what I have for the oven and what I did for a dishwasher I have.
homebridge.log.txt
DiswahwerAndOvenJSCode.zip

Kind regards,

@nVuln
Copy link
Owner Author

nVuln commented Jun 17, 2023

@carlosgamezvillegas you can use a network traffic capture tool to try capture command sent from lg thinq app
you can use proxyman.io on mac or fiddler on windows

again, thank you very much for your work, it's hard to working without real device for testing

p/s: found ios version https://apps.apple.com/us/app/proxyman/id1551292695 , no pc needed to debug

@carlosgamezvillegas
Copy link

carlosgamezvillegas commented Jun 26, 2023

Hello nVuln,

I finished the code to add an LG range with a single oven and an Over the Range Microwave (with Air Fryer). It needs testing but here is the code in case you would like to implement the changes to your code. I also update the Dishwasher to correct some of the bugs I had.

I will report back when/if I find more bugs or make improvements to the code

LG_OVen_CG.zip

let me know if you have any questions

Kind regards,

@nVuln
Copy link
Owner Author

nVuln commented Jun 28, 2023

Hello nVuln,

I finished the code to add an LG range with a single oven and an Over the Range Microwave (with Air Fryer). It needs testing but here is the code in case you would like to implement the changes to your code. I also update the Dishwasher to correct some of the bugs I had.

I will report back when/if I find more bugs or make improvements to the code

LG_OVen_CG.zip

let me know if you have any questions

Kind regards,

thanks for your work
could you share typescript code inside "src" folder?
or you can make a PR to this repo, I'll release new version with your new code, let everyone try it because I don't have oven and dishwasher here 🫡

@carlosgamezvillegas
Copy link

Hello nVuln,

Unfortunately I don't know how to use Typescript or convert the javascript code I wrote to Typescript.

For what is worth here are the files I changed to make the Oven, Microwave and Dishwasher work:
Modified Files.zip
And here is the whole thing in case I missed something

latest version:

homebridge-lgthinq.zip

kind regards,

@nVuln
Copy link
Owner Author

nVuln commented Jul 1, 2023

Hello nVuln,

Unfortunately I don't know how to use Typescript or convert the javascript code I wrote to Typescript.

For what is worth here are the files I changed to make the Oven, Microwave and Dishwasher work: Modified Files.zip And here is the whole thing in case I missed something

latest version:

homebridge-lgthinq.zip

kind regards,

thank you so much for your hard work ❤️
I'll convert your modified js to typescript, it need a bit time, I'll update here when I'm done
again thank you so much 🥰

@carlosgamezvillegas
Copy link

carlosgamezvillegas commented Jul 2, 2023

Hello nVuln,

That is awesome. Just hold off on the conversion if you can. I have discovered and solved new bugs so the version I sent to you last is outdated already. I will send you the latest version on Monday.

Kind regards,

@nVuln
Copy link
Owner Author

nVuln commented Jul 2, 2023

Hello nVuln,

That is awesome. Just hold off on the conversion if you can. I have discovered and solved new bugs so the version I sent to you last is outdated already. I will send you the latest version on Monday.

Kind regards,

I just created new branch migrate-carlosgamezvillegas to update progress
for now I just finished Oven: https://github.com/nVuln/homebridge-lg-thinq/blob/migrate-carlosgamezvillegas/src/devices/Oven.ts
also I merged some duplicate code, fixed some typo and syntax too, typescript is similar js

you can checkout new branch, then run npm install & npm run build, compiled code will be in dist folder

I still working on DIshwasher and Microwave, will be update soon

@nVuln
Copy link
Owner Author

nVuln commented Jul 2, 2023

updated Dishwasher: https://github.com/nVuln/homebridge-lg-thinq/blob/migrate-carlosgamezvillegas/src/devices/Dishwasher.ts
I'm working on Microwave too, found this duplicate key on sendOvenCommand function

"cmdOptionSetTargetTimeMinute": Math.floor(this.ovenCommandList.ovenSetDuration % 3600 / 60),
"cmdOptionSetTargetTimeMinute": Math.floor(this.ovenCommandList.ovenSetDuration % 60),

so I'll wait your latest version

@carlosgamezvillegas
Copy link

Hello nVuln,

Thank you for catching bugs and making corrections, I am not the best at programming so you will notice a lot of redundancies and/or unnecessary things in the code. I have fixed some of the bugs but the code is definitely not optimized but at least is working. The major thing I did in this version is to add   addOptionalCharacteristic(this.platform.Characteristic.ConfiguredName) to all the accessories so Homekit labels the accessories correctly instead of naming all of them with the same name.

Let me know if you have any questions,

Kind regards,
homebiridge-ThinQ.zip

@carlosgamezvillegas
Copy link

Hello again,

Please ignore the last files I sent, use this ones instead.

Homebridge-ThinQV2.zip

Thank you,

@nVuln
Copy link
Owner Author

nVuln commented Jul 4, 2023

@carlosgamezvillegas yup, we make it working first, then we optimize it later, btw I'm not javascript or typescript programmer too 😆

@nVuln
Copy link
Owner Author

nVuln commented Jul 4, 2023

@carlosgamezvillegas I published tag 1.6.0-test.1 implemented your new code, can you test it?
I have question, Microwave use same snapshot.ovenState key like Oven ?

@carlosgamezvillegas
Copy link

@nVuln, yes, the microwave sues the same ovenState, I think it is because the Microwave that I have is also a convection oven.

By the way, I installed the plugin and I think I had a bug in the Dishwasher.js
please find the lines below and change this.startTime for this.courseDuration

Bug:
this.courseDuration = this.createInputSourceService('Cycle Duration', 'CataNico-Always20', 4, this.courseTimeString, this.showTime);
this.startTime.getCharacteristic(this.platform.Characteristic.ConfiguredName)

Correction:
this.courseDuration = this.createInputSourceService('Cycle Duration', 'CataNico-Always20', 4, this.courseTimeString, this.showTime);
this.courseDuration.getCharacteristic(this.platform.Characteristic.ConfiguredName).

@beslergr, @rdnewt please try the plugin and let us know if you see something wrong

Kind regards,

@beslergr
Copy link

beslergr commented Jul 5, 2023

@carlosgamezvillegas seems to work in terms of basic functionality. For the microwave, I can turn it on, but doesn't seem like any of the switches work (that or I'm just clueless on how to do it).

For the oven, it works, but only Bake mode.

@carlosgamezvillegas
Copy link

@beslergr
The microwave that I have has also a convection oven so if the Microwave only has the microwave function most of the buttons are going to be useless to you.

For the oven, if it is just running Bake mode only it might be because it is the default setting, the way it it works is very similar to the ThinQ app.

  1. Select Bake mode
  2. Select Temperature
  3. Select Bake time (for security if Bake time is not selected it is going use the default duration)
  4. Select probe temperature (optional)
  5. Keep warm (optional)
  6. Turn on the Send command switch to send to command to the Range

Steps 1-5 can be done in any order and must be completed within 2 minutes, after that all the accessories are going to update to reflect the current state of the Range

The timer works independently, after selecting the timer duration just "turn on" the Valve so the command can be sent.

I hope this helps and if you have any other feedback please let me know.

@beslergr
Copy link

beslergr commented Jul 6, 2023 via email

@carlosgamezvillegas
Copy link

I think it is a security measure fromG, I cannot start the microwave from the ThinQ app either, I always have to physically touch the start bottom in the microwave. This way we don’t accidentally run the microwave with metal inside (the air fry addons) or run the oven with plastic inside like the steam accessory.

@nVuln
Copy link
Owner Author

nVuln commented Jul 7, 2023

Bug: this.courseDuration = this.createInputSourceService('Cycle Duration', 'CataNico-Always20', 4, this.courseTimeString, this.showTime); this.startTime.getCharacteristic(this.platform.Characteristic.ConfiguredName)

Correction: this.courseDuration = this.createInputSourceService('Cycle Duration', 'CataNico-Always20', 4, this.courseTimeString, this.showTime); this.courseDuration.getCharacteristic(this.platform.Characteristic.ConfiguredName).

I just fixed this and published new tag 1.6.0-test.2

@carlosgamezvillegas
Copy link

Hello nVuln,

I made some corrections and additions to the Dishwasher, Microwave, and Oven. Please see the latest version here.

ThinQ-07-12-2023.zip

Kind regards,

@nVuln
Copy link
Owner Author

nVuln commented Jul 25, 2023

@carlosgamezvillegas I just came back from business trip, I looked into your new code, just saw this function

udpServer() {
        this.server = udp.createSocket({ type: 'udp4', reuseAddr: true });
        this.server.on('error', (error) => {
            this.platform.log.debug(error);
            this.server.close();
        });
        // emits on new datagram msg
        this.server.on('message', (msg, info) => {
            let nest = msg.toString();
            // let nestMessage = JSON.parse(nest);
            if (nest.includes('temperature')) {
                // this.platform.log('Data from Nest: ', nest)
                // this.platform.log(typeof nest)
                nest = JSON.parse(nest);
                if (typeof nest?.temperature == 'number') {
                    this.localTemperature = 0.5 * Math.round(2 * nest?.temperature);
                }
                if (typeof nest?.humidity == 'number') {
                    this.localHumidity = Math.round(nest?.humidity);
                }
            }
            if (this.ovenTempControl.getCharacteristic(this.platform.Characteristic.CurrentTemperature).value !== this.ovenCurrentTemperature()) {
                this.ovenTempControl.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, this.ovenCurrentTemperature());
            }
            if (this.ovenTempControl.getCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity).value !== this.localHumidity) {
                this.ovenTempControl.updateCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity, this.localHumidity);
            }
            // this.platform.log('Data from Nest (object): ', nestMessage)
        });
        //emits when socket is ready and listening for datagram msgs
        this.server.on('listening', () => {
            let address = this.server.address();
            let port = address.port;
            let family = address.family;
            let ipaddr = address.address;
            //this.platform.log('Microwave is listening at port ' + port);
            // this.platform.log('Oven ip ' + ipaddr);
            // this.platform.log('Oven is IP4/IP6 : ' + family);
        });

        //emits after the socket is closed using socket.close();
        this.server.on('close', () => {
            this.platform.log('Socket is closed !');
        });
        this.server.bind(1900, '239.255.255.250');
    }

@carlosgamezvillegas
Copy link

Hello nVuln,

Please ignore that update, I forgot to remove that. I use those lines to get the temperature readings from my Nest thermostat to use the values when the oven is not in use. I have a new version with more bug fixes anyway that I should be sending soon.

Kind regards,

@carlosgamezvillegas
Copy link

Hello nVuln,

Here are the latest updates to the Microwave, Oven, and Dishwasher. Hopefully I didn't miss anything this time.
ThinQ-07-25-2023.zip

@nVuln
Copy link
Owner Author

nVuln commented Aug 16, 2023

I already updated your latest version, if everything working fine, I'll release it on next a few days

@carlosgamezvillegas
Copy link

Please use the latest version below. I corrected some typos.
ThinQ-08-16-2023.zip

Kind regards,

@nVuln
Copy link
Owner Author

nVuln commented Aug 17, 2023

Please use the latest version below. I corrected some typos. ThinQ-08-16-2023.zip

Kind regards,

already applied this version too, hope everything working fine now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants