Navigation

    • Register
    • Login
    • Search
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. Clone Tv
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Clone Tv

    @Clone Tv

    3
    Reputation
    16
    Posts
    7
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Clone Tv Follow

    Best posts made by Clone Tv

    • Gateway - I2C Advanced button and led

      I have a gate based on esp2866, wemos mini board. There are few gpio outputs on it. To implement additional features, such as an inclusive button and status LEDs, I had to connect a gpio expansion board via I2C. I took a PCF8574 based board. For the operation of the button and indication through it, the sources had to be slightly changed, the patch for version 2.4.0 is attached in gist.

      Example sketch code:

      #define MY_DEFAULT_LED_EXT 1
      #define MY_INCLUSION_MODE_FEATURE
      #define MY_INCLUSION_BUTTON_FEATURE
      #define MY_INCLUSION_MODE_DURATION 10
      
      #include <MySensors.h>
      #include <core/MyInclusionMode.h>
      #include <PCF8574.h>
      
      const uint8_t scl_PIN = D1;
      const uint8_t sda_PIN = D2;
      const uint8_t led_device[4] { 2U, 3U, 6U, 4U };
      const uint8_t btn_device[4] { 0U, 1U, 5U, 7U };
      PCF8574 expander(0x22, sda_PIN, scl_PIN);
      
      void setup() {
        Wire.begin(sda_PIN, scl_PIN);
        Serial.begin(115200);
        while (!Serial) delay(50);
        
        for (uint8_t i = 0; i < 4U; i++) {
          expander.pinMode(led_device[i], OUTPUT);
          expander.digitalWrite(led_device[i], HIGH);
          Serial.printf("Init LED expander: %u/%u\n", (uint16_t)i, (uint16_t)led_device[i]);
      
          expander.pinMode(btn_device[i], INPUT);
          expander.digitalWrite(btn_device[i], HIGH);
          Serial.printf("Init BTN expander: %u/%u\n", (uint16_t)i, (uint16_t)btn_device[i]);
        }
        expander.begin();
        ledsSetCb(
          [=](uint8_t & state) { expander.digitalWrite(led_device[1], state); },
          [=](uint8_t & state) { expander.digitalWrite(led_device[2], state); },
          [=](uint8_t & state) { expander.digitalWrite(led_device[3], state); }
        );
        inclusionSetCb(
          [=]() { return (expander.digitalRead(btn_device[0], true) == LOW); },
          [=](uint8_t & state) { expander.digitalWrite(led_device[0], state); }
        );
      }
      
      void loop() {}
      
      
      

      I2C extender
      PCF8574-module-type2-800x800.jpg

      posted in My Project
      Clone Tv
      Clone Tv
    • RE: Where to send messages about battery charge and signal strength?

      C ++ templates work great, the main thing is not to use class->virtual and RTTI. I write C ++ fluently, it's easier for me.
      Thanks for your reply and sorry for my "bad" english.

      posted in MyController.org
      Clone Tv
      Clone Tv
    • RE: Where to send messages about battery charge and signal strength?

      Yes, I found 🙂
      It may be useful for those who might come across this issue later:

      Git MYCONTROLLER repo

      Code for sending RSSI from loop function.
      It is not necessary to announce (present) the RSSI sensor.

                          MY_CRITICAL_SECTION {
                              char *buff = new char[18]{};
                              (void) snprintf(buff, 17, "rssi:%d", rssi);
                              reportMsg(getId(), V_VAR5, buff);
                              delete [] buff;
                          }
      
      
      posted in MyController.org
      Clone Tv
      Clone Tv

    Latest posts made by Clone Tv

    • RE: MQTT RETAIN messages work a little strangely

      I do not use signed messages, so I used the Signed flag in the MySensors packet header to implement selective MQTT retain state.

      Gateway is ESP2866 - no specific code.
      Code send from client:

      template<typename T>
      void reportMsg(const uint8_t & id, const mysensors_data_t & tag, const T & val, const bool retain) {
          MyMessage msg(id, tag);
          msg.setSigned(retain);
          send(msg.set(val), true);
      }
      

      Lite patch MyGatewayTransportMQTTClient.cpp:

      bool gatewayTransportSend(MyMessage &message) {
         ...
         bool retain = message.getSigned();
         message.setSigned(false);
         ....
      
      posted in Development
      Clone Tv
      Clone Tv
    • RE: MQTT RETAIN messages work a little strangely

      Yes, I am using the mosquitto MQTT broker, but the problem is most likely with the mysensors MQTT gateway. On Mosquito, I am able to write a packet with the retained flag from the console, and it works.

      posted in Development
      Clone Tv
      Clone Tv
    • MQTT RETAIN messages work a little strangely

      MQTT RETAIN messages work a little strangely. The first ones always come and are recorded by the mosquito server, but all subsequent messages do not reach and are not recorded by the server .. The RETAIN flag is naturally set.

      posted in Development
      Clone Tv
      Clone Tv
    • RE: Gateway - I2C Advanced button and led

      small fix of the patch, removed "contact bounce" in the inclusive button.

      posted in My Project
      Clone Tv
      Clone Tv
    • Gateway - I2C Advanced button and led

      I have a gate based on esp2866, wemos mini board. There are few gpio outputs on it. To implement additional features, such as an inclusive button and status LEDs, I had to connect a gpio expansion board via I2C. I took a PCF8574 based board. For the operation of the button and indication through it, the sources had to be slightly changed, the patch for version 2.4.0 is attached in gist.

      Example sketch code:

      #define MY_DEFAULT_LED_EXT 1
      #define MY_INCLUSION_MODE_FEATURE
      #define MY_INCLUSION_BUTTON_FEATURE
      #define MY_INCLUSION_MODE_DURATION 10
      
      #include <MySensors.h>
      #include <core/MyInclusionMode.h>
      #include <PCF8574.h>
      
      const uint8_t scl_PIN = D1;
      const uint8_t sda_PIN = D2;
      const uint8_t led_device[4] { 2U, 3U, 6U, 4U };
      const uint8_t btn_device[4] { 0U, 1U, 5U, 7U };
      PCF8574 expander(0x22, sda_PIN, scl_PIN);
      
      void setup() {
        Wire.begin(sda_PIN, scl_PIN);
        Serial.begin(115200);
        while (!Serial) delay(50);
        
        for (uint8_t i = 0; i < 4U; i++) {
          expander.pinMode(led_device[i], OUTPUT);
          expander.digitalWrite(led_device[i], HIGH);
          Serial.printf("Init LED expander: %u/%u\n", (uint16_t)i, (uint16_t)led_device[i]);
      
          expander.pinMode(btn_device[i], INPUT);
          expander.digitalWrite(btn_device[i], HIGH);
          Serial.printf("Init BTN expander: %u/%u\n", (uint16_t)i, (uint16_t)btn_device[i]);
        }
        expander.begin();
        ledsSetCb(
          [=](uint8_t & state) { expander.digitalWrite(led_device[1], state); },
          [=](uint8_t & state) { expander.digitalWrite(led_device[2], state); },
          [=](uint8_t & state) { expander.digitalWrite(led_device[3], state); }
        );
        inclusionSetCb(
          [=]() { return (expander.digitalRead(btn_device[0], true) == LOW); },
          [=](uint8_t & state) { expander.digitalWrite(led_device[0], state); }
        );
      }
      
      void loop() {}
      
      
      

      I2C extender
      PCF8574-module-type2-800x800.jpg

      posted in My Project
      Clone Tv
      Clone Tv
    • RE: Where to send messages about battery charge and signal strength?

      Yes, I found 🙂
      It may be useful for those who might come across this issue later:

      Git MYCONTROLLER repo

      Code for sending RSSI from loop function.
      It is not necessary to announce (present) the RSSI sensor.

                          MY_CRITICAL_SECTION {
                              char *buff = new char[18]{};
                              (void) snprintf(buff, 17, "rssi:%d", rssi);
                              reportMsg(getId(), V_VAR5, buff);
                              delete [] buff;
                          }
      
      
      posted in MyController.org
      Clone Tv
      Clone Tv
    • RE: Where to send messages about battery charge and signal strength?

      Many thanks to all who answered, regarding MyController I think I will have to look at the source code, in which topic and with what identifier it expects a message about the RSSI evel.

      posted in MyController.org
      Clone Tv
      Clone Tv
    • RE: Where to send messages about battery charge and signal strength?

      @Clone-Tv said in Where to send messages about battery charge and signal strength?:

      message.sender

      Thanks for the clarification about message.sender, but then it is not entirely clear why this is used to receive messages? In essence, this should create a regeneration loop of messages ...

      Unfortunately, it was not possible to deliver the RSSI level as applied to the MyController interface. The data itself is of course sent and received, but there is no display in the corresponding column. I used the S_SOUND and V_LEVEL identifiers.

      Here's a screenshot of where it should be, but it's not there 🙂

      myc-rssi.png

      posted in MyController.org
      Clone Tv
      Clone Tv
    • RE: Where to send messages about battery charge and signal strength?

      Do I understand correctly that if (message.sender == 1) is a broadcast message? and it is sent to all nodes at once?

      https://github.com/mfalkvidd/Arduino-MySensors-ESP8266-RFM69-Gateway/blob/030be620d45f2fd6cf02bc3633879e8bf35f7ef0/Arduino-MySensors-ESP8266-RFM69-Gateway.ino#L122

      posted in MyController.org
      Clone Tv
      Clone Tv
    • RE: Where to send messages about battery charge and signal strength?

      C ++ templates work great, the main thing is not to use class->virtual and RTTI. I write C ++ fluently, it's easier for me.
      Thanks for your reply and sorry for my "bad" english.

      posted in MyController.org
      Clone Tv
      Clone Tv