-
Notifications
You must be signed in to change notification settings - Fork 67
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
ESP8266 D1 Mini not receiving output #80
Comments
Should have looked for issues for this... I'm struggling with this issue since yesterday and I am out of ideas... I'm using the ESP8266 NodeMCU dev board. HS36B-1 and CB38M2H(PB)-2, which seem identical to some devices already working. Like in #81 and #102. I can send commands to the controller and read the height. I tried different pins on the esp and it seems, that my options are limited, according to this table Code I copy/pasta'd from 81ota:
- platform: esphome
password: "xxxxxxxx"
substitutions:
min_height: "60" # cm
max_height: "120" # cm
c_screen_pin: D2
c_tx_pin: D5
c_rx_pin: D6
k_screen_pin: D7
k_tx_pin: D0
k_rx_pin: D1
friendly_name: "Mu Desk"
name: "desk-1"
esphome:
name: ${name}
friendly_name: ${friendly_name}
includes:
- desk_height_sensor.h
- desk_keypad.h
on_boot:
priority: -10
then:
- switch.turn_on: switch_wake_up
external_components:
source: github://iMicknl/LoctekMotion_IoT
components: [ loctekmotion_desk_height ]
logger:
esp8266:
board: nodemcuv2
wifi:
ssid: ""
password: ""
ap:
ssid: "recover me ${friendly_name}"
captive_portal:
mqtt:
broker: 192.168.1.3
discover_ip: false
discovery: false
discovery_retain: false
on_message:
- topic: cmnd/desk/sit
qos: 0
then:
- button.press: button_sit
- topic: cmnd/desk/stand
qos: 0
then:
- button.press: button_stand
- topic: cmnd/desk/screen
qos: 0
then:
- button.press: button_wake_screen
uart:
- id: desk_uart
baud_rate: 9600
tx_pin: ${c_tx_pin}
rx_pin: ${c_rx_pin}
- id: keypad_uart
baud_rate: 9600
tx_pin: ${k_tx_pin}
rx_pin: ${k_rx_pin}
script:
- id: screen_timer
mode: restart
then:
# on_start
- logger.log: "Executing screen timer command"
- switch.turn_on: virtual_screen
- delay: 12s # timer length (keypad screen timeout is 10s + 2s buffer)
- if:
condition:
binary_sensor.is_off : screen
then:
- switch.turn_off: virtual_screen
# on_end
- id: script_start_command
mode: restart
then:
- logger.log: "Executing Empty command"
- if:
condition:
switch.is_off : virtual_screen
then:
- script.execute: screen_timer
- delay: 480ms
else:
- script.execute: screen_timer
binary_sensor:
- platform: gpio
name: "Screen"
id: "screen"
pin: ${k_screen_pin}
internal: false
on_press:
then:
- switch.turn_on: virtual_screen
on_release:
then:
- switch.turn_off: virtual_screen
sensor:
- platform: wifi_signal
name: "WiFi Signal"
update_interval: 60s
- platform: uptime
name: Uptime
- platform: loctekmotion_desk_height
id: "desk_height"
name: Desk Height
uart_id: desk_uart
filters:
- clamp:
min_value: ${min_height}
max_value: ${max_height}
ignore_out_of_range: true
- debounce: 10ms
on_value_range:
- below: ${min_height}
then:
- switch.turn_off: switch_down
- above: ${max_height}
then:
- switch.turn_off: switch_up
on_value:
then:
- script.execute: screen_timer
- component.update: set_desk_height
- platform: custom
lambda: |-
auto desk_keypad_sensor = new DeskKeypad(id(keypad_uart));
App.register_component(desk_keypad_sensor);
return {desk_keypad_sensor};
sensors:
id: "desk_command"
name: Desk command
icon: "mdi:counter"
on_value:
then:
lambda: |-
if(id(desk_command).state == 1)
{
id(desk_cover).make_call().set_command_open().perform();
} else if(id(desk_command).state == 2)
{
id(desk_cover).make_call().set_command_close().perform();
} else if(id(desk_command).state == 3)
{
id(button_stand).press();
} else if(id(desk_command).state == 4)
{
id(button_sit).press();
} else if(id(desk_command).state == 5)
{
id(button_3).press();
} else if(id(desk_command).state == 6)
{
id(button_4).press();
} else if(id(desk_command).state == 7)
{
id(button_m).press();
} else if(id(desk_command).state == 8)
{
id(desk_cover).make_call().set_command_stop().perform();
}
button:
- platform: uart
name: "Step Up"
id: button_up
icon: mdi:arrow-up-bold
data: [0x9b, 0x06, 0x02, 0x01, 0x00, 0xfc, 0xa0, 0x9d]
uart_id: desk_uart
- platform: uart
name: "Step Down"
id: button_down
icon: mdi:arrow-down-bold
data: [0x9b, 0x06, 0x02, 0x02, 0x00, 0x0c, 0xa0, 0x9d]
uart_id: desk_uart
- platform: template
name: "Stand"
icon: mdi:numeric-1-box
id: button_stand
on_press:
- uart.write:
id: desk_uart
data: [0x9b, 0x06, 0x02, 0x04, 0x00, 0xac, 0xa3, 0x9d]
- platform: template
name: "Sit"
icon: mdi:numeric-2-box
id: button_sit
on_press:
- uart.write:
id: desk_uart
data: [0x9b, 0x06, 0x02, 0x08, 0x00, 0xac, 0xa6, 0x9d]
- platform: template
name: "Preset 3"
icon: mdi:chair-rolling
id: button_3
on_press:
- uart.write:
id: desk_uart
data: [0x9b, 0x06, 0x02, 0x00, 0x01, 0xac, 0x60, 0x9d]
- platform: template
name: "Preset 4" # Preset 4 on some control panels
icon: mdi:human-handsup
id: button_4
on_press:
- uart.write:
id: desk_uart
data: [0x9b, 0x06, 0x02, 0x10, 0x00, 0xac, 0xac, 0x9d]
- platform: template
name: "Memory"
id: button_m
icon: mdi:alpha-m-box
entity_category: "config"
on_press:
- uart.write:
id: desk_uart
data: [0x9b, 0x06, 0x02, 0x20, 0x00, 0xac, 0xb8, 0x9d]
- platform: template
name: "Wake Screen"
id: button_wake_screen
icon: mdi:gesture-tap-button
entity_category: "config"
on_press:
- uart.write:
id: desk_uart
data: [0x9b, 0x06, 0x02, 0x00, 0x00, 0x6c, 0xa1, 0x9d]
switch:
- platform: gpio
name: "Virtual Screen"
id: "virtual_screen"
pin:
number: ${c_screen_pin}
mode: OUTPUT
restore_mode: ALWAYS_ON
internal: true
- platform: uart
name: "Up"
id: switch_up
icon: mdi:arrow-up-bold
data: [0x9b, 0x06, 0x02, 0x01, 0x00, 0xfc, 0xa0, 0x9d]
uart_id: desk_uart
send_every: 1ms
on_turn_on:
then:
- switch.turn_off: switch_down
internal: true
- platform: uart
name: "Down"
id: switch_down
icon: mdi:arrow-down-bold
data: [0x9b, 0x06, 0x02, 0x02, 0x00, 0x0c, 0xa0, 0x9d]
uart_id: desk_uart
send_every: 1ms
on_turn_on:
then:
- switch.turn_off: switch_up
internal: true
- platform: uart
name: "(wake up)" # Not available on all control panels
id: switch_wake_up
icon: mdi:gesture-tap-button
data: [0x9b, 0x06, 0x02, 0x00, 0x00, 0x6c, 0xa1, 0x9d]
uart_id: desk_uart
internal: true
- platform: uart
name: "Empty command"
id: switch_empty
data: [0x9b, 0x06, 0x02, 0x00, 0x00, 0x6c, 0xa1, 0x9d]
uart_id: desk_uart
internal: false
cover:
#- platform: template
# icon: mdi:table-chair
# # icon: mdi-human-male-height-variant
# name: "Desk"
# id: "desk"
# assumed_state: true
# has_position: true
# # set current position percent
# lambda: return (float(id(desk_height).state) - float(62.1)) / (float(126.9) - float(62.1));
- platform: template
id: desk_cover
icon: mdi:table-chair
name: "Desk"
assumed_state: true
optimistic: true
# Move desk up
open_action:
- if:
condition:
- switch.is_on: switch_down
then:
- switch.turn_off: switch_down
- delay: 500ms
- switch.turn_on: switch_up
# Move desk down
close_action:
- if:
condition:
- switch.is_on: switch_up
then:
- switch.turn_off: switch_up
- delay: 500ms
- switch.turn_on: switch_down
stop_action:
then:
- switch.turn_off: switch_down
- switch.turn_off: switch_up
number:
- platform: template
name: "Desk Height"
id: set_desk_height
min_value: ${min_height}
max_value: ${max_height}
icon: "mdi:counter"
unit_of_measurement: "cm"
device_class: "distance"
step: 0.1
lambda: !lambda |-
return id(desk_height).state;
set_action:
- if:
condition:
- lambda: !lambda |-
return x > id(desk_height).state;
then:
# direction up
- cover.open: desk_cover
- wait_until:
lambda: |-
return id(desk_height).state >= x - 1;
- cover.stop: desk_cover
- delay: 1s
# move a little down again to adjust for momentum
- uart.write:
id: desk_uart
data: [0x9b, 0x06, 0x02, 0x02, 0x00, 0x0c, 0xa0, 0x9d] # down
else:
# direction down
- cover.close: desk_cover
- wait_until:
lambda: |-
return id(desk_height).state <= x + 3;
- cover.stop: desk_cover
- delay: 1s
# move a little up again to adjust for momentum
- uart.write:
id: desk_uart
data: [0x9b, 0x06, 0x02, 0x01, 0x00, 0xfc, 0xa0, 0x9d] # up |
I disconnected TX and bridged RX to the controller and everything works now. So reading from keypad is not necessary. |
Hey there,
I stumbled upon this great project and gave it a try.
I use a Wemos D1 Mini with the ESP8266 chipset as a controller, unfortunately I had to go through a little bit of trial and error because the desk I got, which is the Flexispot E6, with the HS17B-1 handset, was not confirmed to be working.
Nevertheless I somehow managed to get it sending commands to the desk and using my presets. However it does not receive any output from the controller, I already confirmed this by using the
ESP_LOGD
function from thedesk_height_sensor.h
.For the RX Pin I tried using the RX Pin on the Wemos D1 Mini, and also tried using something like the D5, D6 Pins as described, but I can not get it to work.
Does anybody had similar experience, maybe also with the Flexispot E6?
The text was updated successfully, but these errors were encountered: