Skip to content

Commit

Permalink
Fixes #2 : Sets date in controller on connect with Home Assistant
Browse files Browse the repository at this point in the history
  • Loading branch information
wildekek committed May 12, 2023
1 parent a93ddf8 commit d7117ae
Showing 1 changed file with 65 additions and 3 deletions.
68 changes: 65 additions & 3 deletions rd6006-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ esphome:
name_add_mac_suffix: false
project:
name: "wildekek.rd6006-controller"
version: "1.2.0"
version: "1.2.1"

esp8266:
board: esp01_1m
Expand Down Expand Up @@ -73,7 +73,26 @@ time:
id: time_homeassistant
timezone: "${time_timezone}"
on_time_sync:
- logger.log: Time has been set and is valid!
- component.update: sensor_uptime_timestamp
- number.set:
id: date_year
value: !lambda return id(time_homeassistant).now().year;
- number.set:
id: date_month
value: !lambda return id(time_homeassistant).now().month;
- number.set:
id: date_day
value: !lambda return id(time_homeassistant).now().day_of_month;
- number.set:
id: date_hour
value: !lambda return id(time_homeassistant).now().hour;
- number.set:
id: date_minute
value: !lambda return id(time_homeassistant).now().minute;
- number.set:
id: date_second
value: !lambda return id(time_homeassistant).now().second;

sensor:
- platform: modbus_controller
Expand Down Expand Up @@ -200,7 +219,6 @@ sensor:
);
return timestamp;
text_sensor:
- platform: wifi_info
ip_address:
Expand Down Expand Up @@ -265,7 +283,51 @@ number:
max_value: 6
step: 0.01
multiply: 1000


# Date components are kept internal
- platform: modbus_controller
id: date_year
modbus_controller_id: powersupply
entity_category: diagnostic
register_type: holding
address: 48
value_type: U_WORD
- platform: modbus_controller
id: date_month
modbus_controller_id: powersupply
entity_category: diagnostic
register_type: holding
address: 49
value_type: U_WORD
- platform: modbus_controller
id: date_day
modbus_controller_id: powersupply
entity_category: diagnostic
register_type: holding
address: 50
value_type: U_WORD
- platform: modbus_controller
id: date_hour
modbus_controller_id: powersupply
entity_category: diagnostic
register_type: holding
address: 51
value_type: U_WORD
- platform: modbus_controller
id: date_minute
modbus_controller_id: powersupply
entity_category: diagnostic
register_type: holding
address: 52
value_type: U_WORD
- platform: modbus_controller
id: date_second
modbus_controller_id: powersupply
entity_category: diagnostic
register_type: holding
address: 53
value_type: U_WORD

switch:
- platform: modbus_controller
modbus_controller_id: powersupply
Expand Down

0 comments on commit d7117ae

Please sign in to comment.