Ecran Led RGB : horloge météo

Forum dédié aux bricolages d'objets connectés IOT et leurs communications avec DomoticZ :
- Remplacement de firmware des prises, modules relais ...
- Fabrication à base d'ESP8266, de NodeMCU, de Weemos et consorts ...
dokho
Messages : 685
Inscription : 28 déc. 2014, 19:32

Re: Ecran Led RGB : horloge météo

Message par dokho »

Jeff a écrit : 25 mai 2020, 21:57 Content que tu y sois arrivé :D
Je ne pourrais plus m'en passer de cet écran, tellement pratique
Salut Jeff,

J'ai réussi à faire à peu près ce que je veux, j'ai imprimé ton boîtier (sans vraiment regarder) mais je me rend compte qu'il n'est pas fait pour un wemos si ?

Du coté ou il y a l'ouverture pour l'USB il a 4 supports qui sont beaucoup trop espacés pour un wemos.
Comment as-tu procédé ?

Merci.
Jeff
Messages : 1007
Inscription : 17 nov. 2016, 20:54
Localisation : Rennes (35)

Re: Ecran Led RGB : horloge météo

Message par Jeff »

Ce boitier est fait pour un nodemcu :(
Je l'avais fait sous solidworks, maintenant j'utilise fusion 360. Tu as le source si tu te sens l'envie de le modifier.
Tu nous montreras ta version finie
Version: 2023.1 sur VM Synology, docker Zwave Js UI (Z-stick GEN5, Fibaro...), Zigbeefordomoticz. Nextion RGB Led Screen
dokho
Messages : 685
Inscription : 28 déc. 2014, 19:32

Re: Ecran Led RGB : horloge météo

Message par dokho »

Salut,

J'ai eu la flemme de refaire un boîtier, on verra pour les prochains (j'ai acheté 2 écrans supplémentaires :D ), du coup j'ai fait une petite bidouille en 2 minutes sous FreeCAD pour fixer le wemos:
Image

Je n'ai plus accès au port usb mais avec l'OTA je m'en moque un peu.

Partie software je pense en rester là, sauf si je trouve comment ajouter des notifications défilantes pour les alertes par exemple.

Pour l'instant j'ai 5 modes (OFF, heure, complet, conso, nuit) commandés par un selecteur dans domoticz ou via un bouton xiaomi.

On ne le voit pas sur la vidéo mais la couleur de l'affichage des températures change en fonction ... de la température, et celle de la conso instantanée en fonction ... de la conso :lol:

La position de l'affichage conso (instantanée et totale) change aussi pour que cela soit toujours centré.

https://youtu.be/-KMZcdTaXSI

Il ne me reste plus qu'à trouver une alim :)
Jeff
Messages : 1007
Inscription : 17 nov. 2016, 20:54
Localisation : Rennes (35)

Re: Ecran Led RGB : horloge météo

Message par Jeff »

Belle réussite !

Pour l'alimentation j'ai pris ceci en 10A.
Alim 5V 10A
Version: 2023.1 sur VM Synology, docker Zwave Js UI (Z-stick GEN5, Fibaro...), Zigbeefordomoticz. Nextion RGB Led Screen
Jeff
Messages : 1007
Inscription : 17 nov. 2016, 20:54
Localisation : Rennes (35)

Re: Ecran Led RGB : horloge météo

Message par Jeff »

Par contre moi ca fait un moment que l'écran a 2 lignes qui disparaissent + plein de points à différents endroits qui clignotent mais c'est pas tout le temps.
J'avais souder sur les pins du connecteur car la nappe fournie ne prend la soudure à l'étain.
Cela ressemble à des perturbations. J'ai pas encore fait trop de test.
Une piste ?
20200612_231935_copy_854x491.jpg
20200612_231935_copy_854x491.jpg (122.49 Kio) Consulté 5242 fois
Version: 2023.1 sur VM Synology, docker Zwave Js UI (Z-stick GEN5, Fibaro...), Zigbeefordomoticz. Nextion RGB Led Screen
dokho
Messages : 685
Inscription : 28 déc. 2014, 19:32

Re: Ecran Led RGB : horloge météo

Message par dokho »

Alimentation qui fatigue ?
Jeff
Messages : 1007
Inscription : 17 nov. 2016, 20:54
Localisation : Rennes (35)

Re: Ecran Led RGB : horloge météo

Message par Jeff »

Je me suis motivé à reprendre le câblage en changeant la section des fils de bien meilleure qualité que les fils dupont que j'avais mis.
Mais en refermant le boitier, ca recommençait :x j'ai essayé de voir d'où ca venait, c'est pas évident, je pense même à un problème de parasite avec le wemos.
Au final j'ai refermé plusieurs fois et les pixels sont pour le moment sans aucun scintillement. Affaire à suivre.
J'en ai profité pour prendre une photo et montrer le montage intérieur.
C'est quand même un projet assez compliqué... entre la programmation, création des icônes, la soudure, l'impression 3D...
20200614_184359_copy_490x1008.jpg
20200614_184359_copy_490x1008.jpg (200.65 Kio) Consulté 5198 fois
Version: 2023.1 sur VM Synology, docker Zwave Js UI (Z-stick GEN5, Fibaro...), Zigbeefordomoticz. Nextion RGB Led Screen
dokho
Messages : 685
Inscription : 28 déc. 2014, 19:32

Re: Ecran Led RGB : horloge météo

Message par dokho »

J'avais des pb de scintillements pendant mes essais quand j'alimentais via l'usb du wemos.

Pour celui ci je vais rester sur des câbles dupont et je pense utiliser une alimentation externe.

J'abandonne l'idée d'ajouter des messages défilants, je m'en sors pas avec le code.
Par contre j'aimerais essayer d'ajouter un bouton tactile pour changer de mode

Reste à trouver ce que je vais pourvoir faire avec les deux autres écrans
Jeff
Messages : 1007
Inscription : 17 nov. 2016, 20:54
Localisation : Rennes (35)

Re: Ecran Led RGB : horloge météo

Message par Jeff »

Salut,

Tout est normalement dispo dans le 1er post :shock:

Le github est disponible ici : https://github.com/Jeffodilo/Screen-led ... d-weather-

Les fonts sont disponibles ici https://learn.adafruit.com/adafruit-gfx ... sing-fonts

J'ai fait quelques changements, voici le dernier code que j'utilise. Le flow node red est aussi disponible sur le 1er post.

Code : Tout sélectionner

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <MQTT.h>
#include <Adafruit_GFX.h>
#include <Fonts/FreeSansBold9pt7b.h>
#include <Fonts/FreeSerifBold9pt7b.h>
#include <Fonts/FreeMonoBold9pt7b.h>
#include <Fonts/FreeSans9pt7b.h>


const char ssid[] = "xxxxxxxx";
const char pass[] = "xxxxxx";
const char ServerMQTT[] = "192.168.x.xxx";

WiFiClient net;
MQTTClient client;

unsigned long lastMillis = 0;

String timetext;
String daytext;
String monthtext;
String temptext;
String intensite;
String icon_index;

#include <PxMatrix.h>
#include <Ticker.h>

Ticker display_ticker;
#define P_LAT 16
#define P_A 5
#define P_B 4
#define P_C 15
#define P_D 12
#define P_E 0
#define P_OE 2

uint8_t display_draw_time=30; //10-50 is usually fine
PxMATRIX display(64,32,P_LAT, P_OE,P_A,P_B,P_C,P_D);

// Some standard colors
uint16_t myRED = display.color565(255, 0, 0);
uint16_t myGREEN = display.color565(0, 255, 0);
uint16_t myBLUE = display.color565(0, 0, 255);
uint16_t myWHITE = display.color565(255, 255, 255);
uint16_t myYELLOW = display.color565(255, 255, 0);
uint16_t myCYAN = display.color565(0, 255, 255);
uint16_t myMAGENTA = display.color565(255, 0, 255);
uint16_t myORANGE = display.color565(255, 100, 0);
uint16_t myBLACK = display.color565(0, 0, 0);

// clear
uint16_t static weather_Clear[] = {
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffff00, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0xffff00, 0x000000, 0x000000, 0x000000, 0x000000, 0xffff00, 0x000000, 0x000000, 0x000000, 0x000000, 0xffff00, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0xffff00, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffff00, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffff00, 0xffff00, 0xffff00, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0xffff00, 0xffff00, 0x000000, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0x000000, 0xffff00, 0xffff00, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0xffff00, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffff00, 0xffff00, 0xffff00, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0xffff00, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffff00, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0xffff00, 0x000000, 0x000000, 0x000000, 0x000000, 0xffff00, 0x000000, 0x000000, 0x000000, 0x000000, 0xffff00, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffff00, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000
};

// rain
uint16_t static weather_Rain[] = {
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000,
  0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff,
  0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff,
  0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff,
  0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff,
  0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000,
  0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000
};

// Mist : Vent
uint16_t static weather_Mist[] = {
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000,
0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0xffffff, 0x000000, 0x000000,
0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0x000000,
0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0x000000, 0xffffff, 0x000000,
0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff,
0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000,
0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000,
0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000,
0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000,
0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff,
0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000,
0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000
};

// Clouds
uint16_t static weather_Clouds[] = {
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000,
  0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000,
  0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000,
  0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff,
  0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff,
  0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000,
  0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000
};

// Snow
uint16_t static weather_Snow[] = {
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000,
  0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000,
  0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff,
  0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff,
  0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000,
  0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000
};

// Drizzle
uint16_t static weather_Drizzle[] = {
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000,
  0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000,
  0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff,
  0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000,
  0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000,
  0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff,
  0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000,
  0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000,
  0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000
};

// Thunderstorm
uint16_t static weather_Thunderstorm[] = {
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0x000000, 0x000000,
  0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0x000000, 0x000000, 0x000000, 0x000000,
  0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0xffffff, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0xffffff, 0xffffff, 0x000000, 0x000000, 0xffffff, 0xffffff, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0xffffff, 0xffffff, 0x000000, 0xffffff, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xfcfffc, 0xfcfffc, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0xffffff, 0xffffff, 0xffffff, 0xfcfffc, 0xfcfffc, 0xfcfffc, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000,
  0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000
};

void draw_weather_icon(int x, int y, uint16_t *weather, int imageHeight, int imageWidth)
{

  //int imageHeight = 13;
  //int imageWidth = 13;

  int counter = 0;
  for (int yy = 0; yy < imageHeight; yy++)
  {
    for (int xx = 0; xx < imageWidth; xx++)
    {

      display.drawPixel(xx + x , yy + y, weather[counter]);
      counter++;

    }
  }
}

void display_updater()
{
  display.display(display_draw_time);
}

void connect() {
  Serial.println("checking Wifi...");
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(1000);
  }

  Serial.print("connexion...");
  while (!client.connect("arduino", "try", "try")) {
    Serial.print(".");
    delay(1000);
  }

  Serial.println(" : connected !");

  client.subscribe("afficheur/time");
  client.subscribe("afficheur/day");
  client.subscribe("afficheur/month");
  client.subscribe("afficheur/temp");
  client.subscribe("afficheur/weather");
  client.subscribe("afficheur/brightness");
  client.subscribe("afficheur/boot");
  // client.unsubscribe("/hello");
}

void messageReceived(String &topic, String &payload) {

  if (topic == "afficheur/time") {
    timetext = payload;
  }
  else if (topic == "afficheur/day") {
    daytext = payload;
  }
  else if (topic == "afficheur/month") {
    monthtext = payload;
  }

  else if (topic == "afficheur/temp") {
    temptext = payload;
  }

  else if (topic == "afficheur/weather") {
    //icon_index = payload.toInt();
    icon_index = payload;
  }

  // a la nuit tombee, on baisse la luminosite au mini
  else if (topic == "afficheur/brightness") {
    int brightness = payload.toInt();

      if (brightness == 0) {
        display.setBrightness(0);
      }
      else {
        display.setBrightness(150);
      }
  }

  Serial.println("Nouveau message :  " + payload);
  display.clearDisplay();
  //display.setBrightness(200);

  // Affichage Heure
  display.setCursor(1,7);
  display.setFont(&FreeSansBold9pt7b);
  display.setTextColor(myORANGE);
  display.print(timetext);

  // Affichage Day et month
  display.setFont();
  display.setTextColor(myWHITE);
  display.setCursor(52,2);
  display.print(daytext);
  display.drawLine(52,11,62,11, myWHITE);
  display.setCursor(52,14);
  display.print(monthtext);

  // Affichage temperature
  display.setFont();
  display.setCursor(2,21);
  display.setTextColor(myWHITE);
  display.print(temptext);
  display.print ((char) 247); // caractere °

  // Affichage icon meteo
  if (icon_index == "Clear"){
  draw_weather_icon(34, 17, weather_Clear, 15, 15);
  }
  else if (icon_index == "Rain"){
  draw_weather_icon(34, 16, weather_Rain, 15, 15);
  }
  else if (icon_index == "Mist"){
  draw_weather_icon(34, 16, weather_Mist, 15, 15);
  }
  else if (icon_index == "Clouds"){
  draw_weather_icon(34, 16, weather_Clouds, 15, 15);
  }
  else if (icon_index == "Snow"){
  draw_weather_icon(34, 16, weather_Snow, 15, 15);
  }
  else if (icon_index == "Drizzle"){
  draw_weather_icon(34, 16, weather_Drizzle, 15, 15);
  }
  else if (icon_index == "Thunderstorm"){
  draw_weather_icon(34, 16, weather_Thunderstorm, 15, 15);
  }

}

void setup() {
  Serial.begin(9600);
  WiFi.begin(ssid, pass);

  // You need to set the IP address directly.
  client.begin(ServerMQTT, net);
  client.onMessage(messageReceived);
  connect();

  // Declaration Px matrix librairie
  display.begin(16);
  display_ticker.attach(0.002, display_updater);
  display.setBrightness(50);
  display.setCursor(10,12);
  display.setTextColor(myYELLOW);
  display.print("By Jeff");
  delay(1000);

  // recuperer les valeurs au demarrage via node red
  client.publish("afficheur/boot", "Start");

}

void loop() {
  client.loop();
  delay(10);  // <- fixes some issues with WiFi stability

  if (!client.connected()) {
    connect();
  }
}
Version: 2023.1 sur VM Synology, docker Zwave Js UI (Z-stick GEN5, Fibaro...), Zigbeefordomoticz. Nextion RGB Led Screen
Répondre