Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

No cookies to display.

Взаимодействие с часами реального времени

В IotManager ver4 реализована работа со временем. Дата и время могут быть получены как с сервера Интернет или Интранет, так и с модуля часов реального времени подключенного к ESP.
Конфигурация производится добавлением элемента RTC (Часы реального времени).

«chipCode»: «RX8025 — 4, DS3231 — 3, DS1307 — 2, DS1302 — 1 (необходимо установить пины RST, CLK и DAT)»,
«timeFormat»: «Формат времени для вывода. Как у функции date() в PHP»,
«RST»: «Пин RST»,
«CLK»: «Пин CLK»,
«DAT»: «Пин DAT»,
«ticker»: «Генерировать(1) или нет(0) события при каждом тике часов (каждые int секунд).»,
«int»: «Количество секунд между получениями данных из модуля»,
«btn-setUTime»: «Кнопка установки времени модуля на основе указанного unixtime»,
«btn-setSysTime»: «Кнопка установки времени модуля на основе системного с платы ESP»

Время можно использовать в сценариях. Некоторые примеры для использования в сценариях:

строка чтения: rtc4.getTime(«d-m-Y, H:i:s, M»);

Пример вывода даты и времени на LCD:
if timer == 0 then LCD.id2show(rtc4.getTime(«d-m-Y, H:i:s, M»));

Присваивание переменной:
if timer == 0 then LCD = rtc4.getTime(«d-m-Y, H:i:s, M»); #Переменная LCD должна быть создана

Срабатывание по времени:
if rtc4.getTime(«H:i»)==»19:30″ then {txt1 = «сработало расписание»; Rele1=1;}

Вариант события тоже рабочий:
if «23»==rtc4.getTime(«i») then btn1=1;

Функция rtc4.getTime() возвращает строковое значение. Его хорошо использовать в сравнениях ==, но нельзя использовать в операторах <> и в математических операциях.

В разработке…

Для этого появились новые функции: getHours, getMinutes, getSeconds, getMonth, getDay. Эти функции возвращают число.
RTC.getHours() // Часы 0-23
RTC.getMinutes() // Минуты 0-59
RTC.getSeconds() // Секунды 0-59
RTC.getMonth() // Месяц 1-12
RTC.getDay() // День месяца 1-31

Пример использования в сценариях:
if RTCmy.getMinutes() == 53 then led2=1;
if RTCmy.getMinutes() == 55 then minutes=RTCmy.getMinutes();
Где RTCmy — ID вашего RTC объекта.

Такое оповещение для экономных)) :
if RTC.getHours() == 23 then val = «Ночь, дешевое электричество!»;

Оставьте комментарий

Поддержал проект — спас молодого самодельщика! А мы принимаем подарки...

X