reneklootwijk / node-mideahvac

MIT License
76 stars 7 forks source link

No response received (possibly my adapter?) #11

Closed DestrucSean closed 2 years ago

DestrucSean commented 2 years ago

Thank you for this amazing repo. I wanted to share my "No response received" error with you, but I'm not sure if it is code or hardware to be honest.

My Hardware I have a Pioneer WYS024GMFI22RL-10 with a separate OSK-103 Smart Key adapter.

My Mod I ordered an ESP-01s with a level shifter (dipswitch PROG / UART version) and flashed ESP-Link 2.2.3v and successfully configured it for remote connections. It turns out the USB for my OSK-103 was "keyed" and wouldn't fit in the port. So, I de-soldered the USB port off of my OSK-103, and soldered it to my ESP-01S to USB adapter. After completing the USB transplant, the Pioneer powers on the custom ESP key.

The Problem I can't seem to successfully control the unit with any repos from Home Assistant / HACS, and the node project I created with your repo keeps giving me "No response received." I'm wondering if the the custom ESP key might need to bypass the built-in USB to TTL adapter that comes with the Pioneer? In other words, maybe it will work if I:

[ESP + Level Shifter] ----> (bypass built-in USB port / TTL adapter) -----> [custom USB cable directly to control board]

Before I mess with code any further, do you happen to know if my hardware config would be problematic?

reneklootwijk commented 2 years ago

First of all I am not aware of anyone else using the Pioneer model you are using but if the Midea Air App worked in combination with the OSK-103 the custom dongle should also work. The custom dongle should be connected to the AC exactly like the OSK-103 was connected. No response received seems to indicate there is no communication between the dongle and the AC. Can you provide any logs?

DestrucSean commented 2 years ago

Yes, the Midea Air app does connect to the Pioneer.

I have logs from the ESP web server, but I don't think I have any on node-mideahvac.

The esp-link debug logs shows the following:

325816> serbridge: connection reset err=-9 <-- this was me resetting the node server 327660> Accept port 23, conn=0x3fff65b0, pool slot 0 <-- initialize command 327661> Accept port 23, conn=0x3fff63b8, pool slot 1 <-- setStatus command

This is the code that I am testing

const appliances = require('node-mideahvac')

var options = { communicationMethod: 'serialbridge', host: '192.168.1.39', port: 23 }

var ac = appliances.createAppliance(options)

ac.on('status-update', data => { console.log(Received updates: ${JSON.stringify(data)}) })

ac.initialize() .then(response => { console.log(Initialized: ${JSON.stringify(response)})

setInterval(() => {
  ac.getStatus()
    .catch(error => {
      console.log(`Error: ${error.message}`)
    })
}, 30000)

}) .catch(error => { console.log(Error: Failed to initialize (${error.message})) })

ac.setStatus({ powerOn: true, setpoint: 75, temperatureUnit: 'fahrenheit' }, true, true) .catch(error => { console.log(error.message) })

reneklootwijk commented 2 years ago

if you add these lines to that code you will get debug logs:

const logger = require('winston')

logger.remove(logger.transports.Console)
logger.add(new logger.transports.Console({
  format: logger.format.combine(
    logger.format.timestamp(),
    logger.format.colorize(),
    logger.format.printf(event => {
      return `${event.timestamp}: ${event.message}`
    })
  ),
  level: 'silly'
}))
DestrucSean commented 2 years ago

Thanks - here is the log. Side question, are those hex values something I could test through the esp-link microprocessor or through Hercules TCP serial client?

2022-01-19T20:28:27.845Z: SerialBridge._processQueue: Entering 2022-01-19T20:28:27.846Z: SerialBridge._processQueue: Sending 'sendNetworkStatusNotification' command 2022-01-19T20:28:27.847Z: SerialBridge._write: Write aa1eac0000000000030d010104f401a8c0ff000101010000000000000000c1 2022-01-19T20:28:27.847Z: SerialBridge._processQueue: Entering 2022-01-19T20:28:27.847Z: SerialBridge._processQueue: Command in progress 2022-01-19T20:28:28.851Z: SerialBridge._processQueue: No response received in time for 'sendNetworkStatusNotification' command 2022-01-19T20:28:28.852Z: SerialBridge.initialize: Failed to send network status notification for 192.168.1.39:23 - No response received 2022-01-19T20:28:28.852Z: SerialBridge._processQueue: Entering 2022-01-19T20:28:28.852Z: SerialBridge._processQueue: Sending 'setStatus' command 2022-01-19T20:28:28.853Z: SerialBridge._write: Write aa24ac000000000003024043080000000030000004000000000000000000000000000077f5 2022-01-19T20:28:29.856Z: SerialBridge._processQueue: No response received in time for 'setStatus' command No response received

reneklootwijk commented 2 years ago

These hex values are the data that is send to the AC.

Apparently there is no communication between the dongle and the AC. This can have various causes, e.g.:

You can try to swap the rx and tx connections.

Do you have more information on the ESP and level shifter you are using?

DestrucSean commented 2 years ago

Rx / Tx are technically soldered, but here is what I'm using.

ESP + Level Shifter

I also picked up one of these if I decided to use an Arduino:

USB to TTL Converter

And these for diagnostic if needed:

USB to TTL Console Cable

RS232 Breakout Connector (to see if sniffing was possible)

DestrucSean commented 2 years ago

I might have found something. The ESP-01 to USB shows [ 5v, gnd, +, - ] in this schematic

however

The built-in converter appears to have [ 5v, +, -, gnd ]

I'll try to make a breakout cable tomorrow to test this fix.

reneklootwijk commented 2 years ago

This will never work. You bought the wrong adapter. The interface between the dongle and the AC is not a real USB interface it only uses an USB connector. The adapter you bought contains an USB chip (CH340G) handling the communication over the USB connector (actually converting serial TTL to USB). The communication between the dongle and the AC is just plain serial TTL. Also that USB to TTL converter you have bought cannot be used for the same reason. You need something like this: https://nl.aliexpress.com/item/4001054021801.html

DestrucSean commented 2 years ago

Thanks, I've ordered the proper adapter.

DestrucSean commented 2 years ago

New adapter came in, and oddly, I'm still getting the same results. I tried swapping rx/tx without any luck. I noticed someone reported that the WYS 18 model was working, so I assume the WYS 24 (that I have) should work as well. I continuity tested my connections to double check, but still no comms for some reason.

DestrucSean commented 2 years ago

I don't want to trouble you further with my adapter struggles. Do you happen to know if a more rudimentary setup exists to simply test if communication is possible? i.e. PC to VRF

For example, have you ever come across anyone attempting to interface a USB to serial adapter from their PC, using only the RX / TX lines?

reneklootwijk commented 2 years ago

Yes I connect the original dongle as well as the custom dongle to my macbook when I am developing while reverse enginering. You need a ttl to usb convertor for that, I use something like this: https://nl.aliexpress.com/item/32273550144.html?spm=a2g0o.productlist.0.0.61926b81dQNfBY&algo_pvid=b2b9889e-2b4b-4b8c-92e2-e5e25268f99b&aem_p4p_detail=202201251437364196101537621480018464008&algo_exp_id=b2b9889e-2b4b-4b8c-92e2-e5e25268f99b-2&pdp_ext_f=%7B%22sku_id%22%3A%2212000021370119598%22%7D&pdp_pi=-1%3B1.33%3B-1%3B-1%40salePrice%3BEUR%3Bsearch-mainSearch

You can try changing the pin assignment preset in esplink. I do not recall which setting I used and if there was a ESP01 preset available.

At the moment I use the following dongle: https://github.com/reneklootwijk/mideahvac-dongle with custom firmware, but before that I used an ESP01 with the levelshifter and esplink as firmware.

At th moment I am refactoring this nodejs code to support direct communication with the original dongle with dependency on the cloud. I need some days to finish this.

DestrucSean commented 2 years ago

Just a heads up, I had a lot of fun w/ this project from a learning perspective. It ultimately didn't pan out, but I did find a solution.

Initially, my goal was to control the mini-split with a Nest Thermostat using an Arduino to translate the 24v thermostat signal.

However, I found that the Samsung Smart Things hub can detect the Nest thermostat. I use a trigger event from the Nest (i.e. when heat is turned on) in conjunction with a Cielo Eco (IR blaster) to send the proper command for control. This works perfectly so far. It doesn't send a specific temperature to the VRF, but it does work with pre-programmed heating and cooling temps (or fan only as well).

It seems like the manufacturers want us to leave our mini-splits on basically 24/7 and allow their inverters to ramp up/down as needed. Although, I still feel like having the split shut off / on could be beneficial for energy savings. Time will tell!