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

Position KingArt Q4 #2603

Open
4139GGN opened this issue Jan 21, 2024 · 4 comments
Open

Position KingArt Q4 #2603

4139GGN opened this issue Jan 21, 2024 · 4 comments
Labels

Comments

@4139GGN
Copy link

4139GGN commented Jan 21, 2024

Device

KingArt Q4

Version

1.15.0-dev.git909949b5+github230112

Question

Hello!
I have had several KingArt Q4s running with Espurna in Home Assistant for months. But it only indicates when it is "open" or "closed". If it stops in another position, it does not indicate its position (%).

  cover:
    - name: "Persiana Salón"
      device_class: shutter
      command_topic: "PersianaSalon/curtain/set"
      position_topic: "PersianaSalon/curtain"
      set_position_topic: "PersianaSalon/curtain/set"
      state_topic: "PersianaSalon/curtain"
      qos: 0
      retain: false
      payload_open: "0"
      payload_close: "100"
      payload_stop: "pause"
      position_open: 0
      position_closed: 100      
      state_open: "open"
      state_opening: "opening"
      state_closed: "close"
      state_stopped: "closing"
      state_closing: "stop" 
      optimistic: true
@mcspr
Copy link
Collaborator

mcspr commented Jan 21, 2024

Something to do with the HA config? Kingart hw does indeed report on / off / pause, but we only ever send out 0...100 value

//Update last position and transmit to MQTT (GUI is at the end)
if(_curtain_position != CURTAIN_POSITION_UNKNOWN && _curtain_last_position != _curtain_position) {
_curtain_last_position = _curtain_position;
#if MQTT_SUPPORT
const String pos = String(_curtain_last_position);
mqttSend(MQTT_TOPIC_CURTAIN, pos.c_str());
#endif // MQTT_SUPPORT
}

Also note that incoming payload is also limited to on / off / pause / numeric-value

if (t.equals(MQTT_TOPIC_CURTAIN)) {
if (payload == "pause") {
_KACurtainSet(CURTAIN_BUTTON_PAUSE);
} else if (payload == "on") {
_KACurtainSet(CURTAIN_BUTTON_OPEN);
} else if (payload == "off") {
_KACurtainSet(CURTAIN_BUTTON_CLOSE);
} else {
_curtain_position_set = payload.toString().toInt();
_KACurtainSet(CURTAIN_BUTTON_UNKNOWN, _curtain_position_set);
}

@4139GGN
Copy link
Author

4139GGN commented Jan 22, 2024

Something to do with the HA config? Kingart hw does indeed report on / off / pause, but we only ever send out 0...100 value

//Update last position and transmit to MQTT (GUI is at the end)
if(_curtain_position != CURTAIN_POSITION_UNKNOWN && _curtain_last_position != _curtain_position) {
_curtain_last_position = _curtain_position;
#if MQTT_SUPPORT
const String pos = String(_curtain_last_position);
mqttSend(MQTT_TOPIC_CURTAIN, pos.c_str());
#endif // MQTT_SUPPORT
}

Also note that incoming payload is also limited to on / off / pause / numeric-value

if (t.equals(MQTT_TOPIC_CURTAIN)) {
if (payload == "pause") {
_KACurtainSet(CURTAIN_BUTTON_PAUSE);
} else if (payload == "on") {
_KACurtainSet(CURTAIN_BUTTON_OPEN);
} else if (payload == "off") {
_KACurtainSet(CURTAIN_BUTTON_CLOSE);
} else {
_curtain_position_set = payload.toString().toInt();
_KACurtainSet(CURTAIN_BUTTON_UNKNOWN, _curtain_position_set);
}

Thank you! But that's where I miss the truth... The HA configuration is the one pasted above, I think it's fine, right?
Yes, I can say that if I indicate position on the HA card (from 0 to 100), it does respond to that position and registers that it has been open or closed (depending on its last move).
So, I can't see the % position in HA?
Another question I have is: Why does HA appear as unknown in the registry until you make a move?

Thank you!!!

@mcspr
Copy link
Collaborator

mcspr commented Jan 22, 2024

Another question I have is: Why does HA appear as unknown in the registry until you make a move?

We publish <DEVICE>/status topic as last-will-and-testament aka lwt, which tracks mqtt broker connection status of the device. <DEVICE>/curtain tracks percentage

availability:
  - topic: "PersianaSalon/status"
payload_available: "1"
payload_not_available: "0"

<DEVICE>/curtain only publishes numeric value, it would never get 'state' payload as described here.

      state_topic: "PersianaSalon/curtain"
      state_open: "open"
      state_opening: "opening"
      state_closed: "close"
      state_stopped: "closing"
      state_closing: "stop" 

WebUI does indeed show the status, but MQTT publish is missing in current implementation. Not sure what would be the correct solution here, though. Either publish special .json {state: "opening", position: 50} or have something like <DEVICE>/curtain_state

So, I can't see the % position in HA?

I am not actively using HA, just testing it with your configuration atm.
Don't see it either 🤷 , so I would only assume this is how the default widget is intended to work. Maybe some template magic / separate widget reading entity status can solve this.

@4139GGN
Copy link
Author

4139GGN commented Feb 9, 2024

With this configuration (configuration.yaml), I only get the status "Open/Closed".
How could I get the numeric value that I do see being output in mqtt?:
BlindSalon/curtain

cover:


- name: "Persiana Salón"
  device_class: shutter
  command_topic: "PersianaSalon/curtain/set"
  position_topic: "PersianaSalon/curtain"
  set_position_topic: "PersianaSalon/curtain/set"
  state_topic: "PersianaSalon/curtain"
  qos: 0
  retain: false
  payload_open: "0"
  payload_close: "100"
  payload_stop: "pause"
  position_open: 0
  position_closed: 100
  state_open: "0"
  state_closed: "100"
  state_stopped: "Pausa"
  optimistic: true 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants