-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
How to support Open/Close button #17
Comments
With my remote the Up and Down commands, open/close the blinds. Maybe you need to send to commands to repoduce this behavior with your remote? |
I can send commands repeatedly. But my remote control does it differently. |
Did you try other commands? |
Yes, 0x1 to 0xF :) |
Without more information about the protocol your remote is using, I can't help you fixing the problem. |
I understand, could you suggest to me some (easy) way (hw + sw) how to read data from my remote and decode it? |
I have all the information about the protocol from this website and https://github.com/Nickduino/Somfy_Remote. |
Thanks, I will be back if I make some progress. |
maybe #16 is related to this, |
Do you know what seed is in the frame? |
No I don't understand that part |
Hello, using the tool rtl_433 and the dongle I could see the result below that explain: It looks like the seed isn't random but actually the button code: 0x88 DOWN, 0x85 STOP, 0x86 UP. Hex. codes of my remote control. UP - f0f0ff34cb4b2ccb334ad2b4d2d532d353 |
Thanks, what kind of remote do you have. I am going to order the dongle. :) |
My remote is SCE-R1 Gunmetal. Yes, didn't work for me too, I think that is related to the buildFrame, the frame is different from the regular Somfy products. |
You were able to decode your hex codes by hand? |
No, I used the tool rtl_433 to see my codes. |
@vaguiner7 The dongle came today. What command do you use for rtl_433? |
Great, I just used filtering the protocol somfy_rts: I really recommend the tool Universal Radio Hacker (urh) that you can use with the same dongle. |
@vaguiner7 Thank you so much. Finally I was able to make it work. My problem was that method sendCC1101Command(Command command, int repeat = 4) has default repeat = 4. I this case the motor make just one step. When I send just one command then the blinds go up :) |
@rkotulan would you like to add some documentation? |
@Legion2 sure I will write something. |
@rkotulan Could you maybe post your complete solution in here? |
@Leviathan09 Here is my code for ESP Home: #include "esphome.h"
#include <ELECHOUSE_CC1101_SRC_DRV.h>
#include <NVSRollingCodeStorage.h>
#include <SomfyRemote.h>
#define EMITTER_GPIO 2
#define CC1101_FREQUENCY 433.42
#define COVER_OPEN 1.0f
#define COVER_CLOSED 0.0f
#define TILT_OPEN 1.0f
#define TILT_CLOSED 0.0f
class SomfyESPCover : public Cover {
private:
SomfyRemote *remote;
NVSRollingCodeStorage *storage;
public:
SomfyESPCover(const char *name, const char *key, uint32_t remoteCode)
: Cover() {
storage = new NVSRollingCodeStorage(name, key);
remote = new SomfyRemote(EMITTER_GPIO, remoteCode, storage);
}
CoverTraits get_traits() override {
auto traits = CoverTraits();
traits.set_is_assumed_state(true);
traits.set_supports_position(false);
traits.set_supports_tilt(true);
return traits;
}
void sendCC1101Command(Command command, int repeat = 1) {
ELECHOUSE_cc1101.SetTx();
remote->sendCommand(command, repeat);
ELECHOUSE_cc1101.setSidle();
}
void control(const CoverCall &call) override {
if (call.get_position().has_value()) {
float pos = *call.get_position();
if (pos == COVER_OPEN) {
ESP_LOGI("somfy", "OPEN");
sendCC1101Command(Command::Up);
} else if (pos == COVER_CLOSED) {
ESP_LOGI("somfy", "CLOSE");
sendCC1101Command(Command::Down);
} else {
ESP_LOGI("somfy", "WAT");
}
this->position = pos;
this->publish_state();
}
if (call.get_stop()) {
ESP_LOGI("somfy", "STOP");
sendCC1101Command(Command::My);
}
if(call.get_tilt().has_value()) {
float tilt = *call.get_tilt();
ESP_LOGI("somfy", "tilt: %.1f",tilt );
if(tilt == TILT_OPEN) {
sendCC1101Command(Command::Up, 4);
} else {
sendCC1101Command(Command::Down, 4);
}
}
}
void program() {
ESP_LOGI("somfy", "PROG");
sendCC1101Command(Command::Prog);
}
};
class SomfyESPRemote : public Component {
public:
std::vector<esphome::cover::Cover *> covers;
void setup() override {
// need to set GPIO PIN 4 as OUTPUT, otherwise no commands will be sent
pinMode(EMITTER_GPIO, OUTPUT);
digitalWrite(EMITTER_GPIO, LOW);
ELECHOUSE_cc1101.Init();
ELECHOUSE_cc1101.setMHZ(CC1101_FREQUENCY);
}
void add_cover(const char *name, const char *key, uint32_t remoteCode) {
auto cover = new SomfyESPCover(name, key, remoteCode);
covers.push_back(cover);
}
}; The key point is to change sendCC1101Command to send command just once. When you send Up = Open, Down = Close just once the cover will Open / Close. I enabled also tilt support. If you do not need you can disable it traits.set_supports_tilt(false); If you need more details let me know. |
@Legion2 sendCommand(Command::Up, 1); When the DOWN command is sent once, the blinds go down (Close). sendCommand(Command::Down, 1); If you want to tilt the blinds, send the Up / Down command four times. sendCommand(Command::Up, 4); or sendCommand(Command::Down, 4); |
@rkotulan can you create a PR, else I can update the readme. |
@rkotulan Thanks, really appreciate this. Edit: |
@Leviathan09 I use ESPHome + HomeAssistatnt. How do you imagine you will control the curtain? With button connected to wemos? |
Okay, then i will try to figure out how ESPHome works or will check if a can adjust it for ArduinoIDE (have the example from MakerMeiks Somfy_Remote) |
@Leviathan09 this might help https://github.com/DrozmotiX/ioBroker.esphome |
@rkotulan i tried it with ESPHome and HomeAssistant and was able to perform a compile process but it failed and i don't know why. As already mentiond i'm not really good and such "programming" stuff. |
@Leviathan09 could you post here file my_custom_component.h ? |
@rkotulan it's just a copy of your code from above |
@Leviathan09 and how you YAML for ESPHome looks like? |
|
esphome:
name: somfy
platform: ESP32
board: nodemcu-32s
libraries:
- EEPROM
- SPI
- [email protected]
- [email protected]
includes:
- include/somfy/somfy_secrets.h
- include/somfy/somfy_cover.h
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Somfy Fallback Hotspot"
password: "123456789"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
web_server:
port: 80
sensor:
- platform: uptime
name: Uptime Sensor
- platform: wifi_signal
name: "WiFi Signal Sensor"
cover:
- platform: custom
lambda: |-
auto somfy_remote = new SomfyESPRemote();
somfy_remote->add_cover("somfy", "Left", SOMFY_REMOTE_LIVING_ROOM_LEFT);
somfy_remote->add_cover("somfy", "Right", SOMFY_REMOTE_LIVING_ROOM_RIGHT);
App.register_component(somfy_remote);
return somfy_remote->covers;
covers:
- id: "somfy_living_room_left"
name: "Somfy roleta obývák levá"
- id: "somfy_living_room_right"
name: "Somfy roleta obývák pravá"
switch:
- platform: template
name: "PROG left"
turn_on_action:
- lambda: |-
((SomfyESPCover*)id(somfy_living_room_left))->program();
- platform: template
name: "PROG right"
turn_on_action:
- lambda: |-
((SomfyESPCover*)id(somfy_living_room_right))->program(); you need secon file somfy_secrets.h #define SOMFY_REMOTE_LIVING_ROOM_LEFT 0x121310
#define SOMFY_REMOTE_LIVING_ROOM_RIGHT 0x121311 |
@Leviathan09 One thing, I have different board then you. I have similar to this one https://www.aliexpress.com/item/1005003818247483.html |
hm, okay But as i don't really understand your stuff from above i think i have to wait for the weekend to take enough time |
@Leviathan09 For build board is not problem but this line #define EMITTER_GPIO 2 could depend on the board, but I am not sure. |
@Legion2 please update documentation |
@vaguiner7 did you make the Library to work with TUBE? As we try to use it the TUBE seens to have a 7 Digits Hex ID, so, whenever we set it 6 or 7 digits it doest work. Can you give me a help to try to solve this? Using a RFLINK to sniff the RF communication it shows it as RTS and the Remote Control ID as 265822A Also if @Legion2 could take a look at this would be awesome! |
Hello,
My remote Telis 4 Modulis RTS5 Channel Pure Hand-Held Remote 1810765 has Open and Close button.
I can send prog, Up (one step), Down (one step), My command.
But I do not know how to simulate Open (roll blind up) and Close (roll blind down).
Any ideas?
The text was updated successfully, but these errors were encountered: