Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi all! We have been experiencing an issue on site where threads have been missing the latest postings. The platform host Vanilla are working on this issue. A workaround that has been used by some is to navigate back from 1 to 10+ pages to re-sync the thread and this will then show the latest posts. Thanks, Mike.
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Home Assistant

1910111315

Comments

  • Registered Users, Registered Users 2 Posts: 7,494 ✭✭✭10-10-20


    Is there a supervisor docker version available? I thought it wasn't available?



  • Moderators, Education Moderators, Home & Garden Moderators Posts: 8,217 Mod ✭✭✭✭Jonathan


    No. I run HAOS as a KVM guest for that reason. It just works.



  • Registered Users, Registered Users 2 Posts: 1,763 ✭✭✭poker--addict


    What sort of weather system have you?

    😎



  • Moderators, Education Moderators, Home & Garden Moderators Posts: 8,217 Mod ✭✭✭✭Jonathan


    Govee H5075 mounted under a north facing awning. A neighbour has a weather station mounted in their garden which I can pick up using rtl_433, but the Govee is more accurate.



  • Registered Users, Registered Users 2 Posts: 6,203 ✭✭✭emaherx


    It is possible to have supervisor with docker, although it is only officially supported with Debian as host OS, I run it on Pi OS without any issue, except warnings in the logs about 'unsupported OS' and lately moaning about other non-HA apps running in Docker. These warnings don't affect the operation though. But since I have started to convert the other Docker apps that I need into HA add-ons I may go back to running HAOS.



  • Advertisement
  • Registered Users, Registered Users 2 Posts: 7,494 ✭✭✭10-10-20


    I just migrated off a physical server (ubuntu) to proxmox after a root filesystem crash. I'll play around with it, thanks.



  • Registered Users, Registered Users 2 Posts: 4,989 ✭✭✭paulbok




  • Registered Users, Registered Users 2 Posts: 1,868 ✭✭✭donspeekinglesh


    Has anyone tried this out:



    I bought a few tags to play around with it. I'm very impressed so far.


    I bought the gateway and tags from here. They communicate using a customised version of ZigBee, so the gateway is needed.


    I have a tag stuck to my home office door and an automation that shows I'm busy when my work PC is on. When it's off the tag changes.



  • Registered Users, Registered Users 2 Posts: 7,494 ✭✭✭10-10-20


    I had read about these, but that's as far as I got. I've been messing around with 0.96" OLED displays on ESP32 devices running ESPHOME. The e-paper tags limit the interactivity and the performance of a system using them, but I can see good use cases for them alright - for example reporting on the amount of hot water in the cylinder - no rapid updates needed there.



  • Registered Users, Registered Users 2 Posts: 2,736 ✭✭✭wandererz


    I am new to HA by about 1 day so far. Have it installed on a Raspberry PI.

    I have smart plugs located around the home.

    How do i create a dashboard to display:

    1) Daily & monthly cost usage for a group of devices based on peak & off-peak hours (but for the group - weather the group contains one or more devices)

    2) Daily & monthly cost for all groups of devices based on peak & off-peak hours

    Many thanks if you can advise on this



  • Advertisement
  • Moderators, Science, Health & Environment Moderators Posts: 4,728 Mod ✭✭✭✭Tree


    Create a group for the items, then create a utility helper for each group and time period (one each for daily and monthly), thne you'll need an additional template to do the costs.

    https://www.home-assistant.io/integrations/utility_meter



  • Registered Users, Registered Users 2 Posts: 7,494 ✭✭✭10-10-20


    Folks,

    Having a problem with an energy sensor graph. I'm using the internal statistic graphs to plot the consumption of devices over time, but it's not working properly as you'll see gaps in the graphs, 20th to 22nd and 24th to 27th:

    The issue is caused by my ESPHOME devices resetting the daily counter at one second to midnight (23:59:59) on the missing days while on other days it's resetting at 00:00:00 precisely. The sensors are setup with NTP, so it's just one of those precision issues where the database is recording events in milisecond precision and I'm guessing that home assistant is rounding down, or something. There isn't a way to adjust the energy daily reset time from EPSHOME.

    Are most of you using Apex Charts to display this type of graph or is there a better add-on to use? Apex hasn't been updated in 8mths I notice...



  • Registered Users, Registered Users 2 Posts: 2,500 ✭✭✭ECO_Mental


    Have you got InfluxDB and Grafanna installed on HA, they should be more useful and designed for timebased data and graphing.

    6.1kWp south facing, South of Cork City



  • Registered Users, Registered Users 2 Posts: 7,494 ✭✭✭10-10-20


    Yes, but preferred to have graphs on HA rather than in Grafana. I got it sorted anyway, installed apex charts and they are very good, in fairness.



  • Registered Users Posts: 6,182 ✭✭✭championc


    While I have been using Node-red for my home Dashboard, I have just started playing with Home Assistant.

    I have un-earthed an old Zigbee device - a cc2531 that will need flashing to work in HA. It identifies as

    Bus 001 Device 003: ID 0451:16a8 Texas Instruments, Inc. CC2531 ZigBee

    Is there anyone around Sth Dublin that I could bring it to to reflash, or could I post it to anyone ?

    If you can help at all, can you please PM me

    Thanks in advance



  • Registered Users, Registered Users 2 Posts: 7,494 ✭✭✭10-10-20


    Do you have the physical CC-debugger tool, or is that actually needed?

    I see this method here, but it looks like a faff.




  • Registered Users Posts: 6,182 ✭✭✭championc


    That is EXACTLY what I was looking at, and hoped that someone might just have the devices to hand to allow me to flash it. I bought mine in 2021, and I see that new code after 2022 is needed to allow it to function within HA now



  • Registered Users, Registered Users 2 Posts: 7,494 ✭✭✭10-10-20


    It's this one here that I meant to link to:

    But for all that work you'd have a non-recommended Zigbee bridge...

    Not recommended

    The adapters below are well-supported but use outdated chips.

    Texas Instruments CC2531

    I had enough problems with my 'fully supported' SONOFF 3.0 to know that it's worth having a working adapter, otherwise things get funky quickly.



  • Registered Users, Registered Users 2 Posts: 2,711 ✭✭✭kaisersose77


    For anyone who likes to have news ticker like information these work great with home assistant. You can set up automations to display any sensor information and if you set up the home assistant app on an android phone or tablet can you display the latest notification it received. I set up an old android tablet for example to run a livescores app and subscribed to all the big leagues and everytime a goal is scored it will be displayed on the led display (android has a limit on the amount of notifications that it can have in the notification list though so you need to run macdroid app to clear notifcations every so often if you use it for the likes of live scores where there are a lot of updates).


    Edit: Example of live football scores.



    Example of using sensor information, in this video it's showing forecasts and what was generated.


    Post edited by kaisersose77 on


  • Registered Users Posts: 592 ✭✭✭theintern



    Could you share any examples you've done? I have a couple of these, but haven't gotten around to doing anything particularly cool with them yet.



  • Advertisement
  • Registered Users, Registered Users 2 Posts: 6,869 ✭✭✭SteM


    We have various Google Nest speakers around the house. Until recently when I asked one of them to turn a light on or off it would just chime which was perfect. They've recently started replying with full sentences like 'Turning off Landing Lights' which is beginning to get on my nerves especially at night. I didn't change anything in our home to cause this, has anyone else had the same problem recently?



  • Registered Users, Registered Users 2 Posts: 2,711 ✭✭✭kaisersose77



    I have only being playing around with it myself recently but at the moment i just have the following setup:


    1) The main one i have setup is displaying the latest notification from an old android tablet but can be done on a android phone too. In the home assistant app you set it to only allow notifications from certain apps so i have it display the latest notification from news apps like sky news and then latest scores from the sofa scores app. The sofa scores app has all the main sports and you can pick what you want to be notified such as when a goal is scored, red cards and when match is over etc. You can subscribe to the leagues so you informed of every match going forward, not a case if having to subscrube manually each time there are matches on.

    2) I have solar panels installed and it will display how much energy is currently being generated. In addition to this I have it displaying how much in total has been generated for the current along with how much was forecasted for the current day and for the next day. I also have a seperate notification telling me what percentage of battery i have left on my solar battery.

    3) Displaying RSS news feeds from the BBC website.

    4) Displaying latest tv show episode acquired by Sonarr.


    You can get it to display more or less any information thats in home assistant whether it be calendar events, weather information, song being played etc. As ideas come to me for information that i think is useful i'm trying to get it displayed. I disabled most of the exiting apps/notifications on the awtrix from clock and date.


    Not that many and most are very simple but you can get some automations/blueprints that other people have created on this website - https://flows.blueforcer.de/



  • Registered Users, Registered Users 2 Posts: 7,518 ✭✭✭matrim


    I think this depends on your room setup.


    If I say to my kitchen speaker to turn on the living room lights it response "turning on ..."

    If I say the same to my living room speaker it will just turn them on and chime



  • Registered Users, Registered Users 2 Posts: 1,763 ✭✭✭poker--addict


    My electric gates stopped working today.


    I am getting an Argo tunnel error when visiting my "website". Error 1033

    What might be wrong?

    😎



  • Registered Users, Registered Users 2 Posts: 6,203 ✭✭✭emaherx


    What website, the Home Assistant dashboard or some cloud service for your gates?

    Sounds like an issue with a cloudflare service. If it's for your HA then you should be still able to connect to it by the local address if on same network.



  • Registered Users, Registered Users 2 Posts: 1,763 ✭✭✭poker--addict


    Yes cloudfare issue I think/gate. Will try chat GP for a fix as not an expert on it

    😎



  • Registered Users, Registered Users 2 Posts: 6,153 ✭✭✭Shoog


    Finding the learning curve with HA very steep. Doesn't help that the constant OS upgrading seems to render most tutorials redundant shortly after they are released.



  • Registered Users, Registered Users 2 Posts: 6,203 ✭✭✭emaherx


    Do you have a cloudflare tunnel that you setup to access Home Assistant? If it's an issue with your tunnel you should be able to fix it but if it's an error being produced by a tunnel belonging to some cloud service then it's unlikely you can do anything about it, except wait for it to be fixed.

    What service are your gates connected to?



  • Registered Users, Registered Users 2 Posts: 7,494 ✭✭✭10-10-20



    Incremental improvements can make it tricky, but I find that it's one of the best documented applications out there due to its popularity. Rock stable too.



  • Advertisement
  • Registered Users, Registered Users 2 Posts: 1,763 ✭✭✭poker--addict


    Think I solved my tunnel/ gate issue (pretends I understand it after fixing a loose Ethernet cable) but now am facing the sh*t show of lost login details for HA and Proxmax

    😎



  • Registered Users, Registered Users 2 Posts: 7,494 ✭✭✭10-10-20




  • Moderators, Education Moderators, Home & Garden Moderators Posts: 8,217 Mod ✭✭✭✭Jonathan


    Or hope that you're still signed in on one of the virtual consoles. 😉



  • Registered Users, Registered Users 2 Posts: 6,203 ✭✭✭emaherx


    Would you have them stored in a password store of a browser?



  • Registered Users, Registered Users 2 Posts: 1,763 ✭✭✭poker--addict


    ok I now joined the dots. My HA tools are likely not working since 24 hour power failure


    I can't find home assistant when using IP internally

    😎



  • Registered Users, Registered Users 2 Posts: 6,203 ✭✭✭emaherx


    Yep, multiple power cuts over the past week has caused some fun here too, perhaps time to consider some backup power.


    Maybe your HA has taken up an alternative IP address? There is a mobile app called fing that is great for seeing what IP addresses your devices have. There is a PC version too (free version is good enough) or alternatively Angry IP scanner.



  • Advertisement
  • Registered Users, Registered Users 2 Posts: 1,763 ✭✭✭poker--addict


    bingo, ran a scan and found new IP. So I am in


    guess now I just change cloudflare somewhere with new IP


    thanks very much.


    I am not sure it's worth investing in standby power tbh. It is a bit surprising in today's world that all these smart home options aren't more simple (at least without paying 1000s for smart house gates etc). HA provides cost effective solutions but some knowledge of computer language etc helps (or being a boards.ie with patient people willing to answer stupid questions - but shouldn't have to be like this)


    rant over - delighted the help has me working again or close to it

    😎



  • Moderators, Education Moderators, Home & Garden Moderators Posts: 8,217 Mod ✭✭✭✭Jonathan


    Give it a static DHCP lease in the router and that will avoid the fun next time.



  • Registered Users, Registered Users 2 Posts: 6,203 ✭✭✭emaherx


    If you are using the cloudflare addon you shouldn't have to change any settings even though the IP changed. It might be different if you have manually set up a tunnel. If using the addon, make sure it is running or try restarting it before changing anything.


    I don't think anyone would disagree with you, but different manufactures still refuse to cooperate properly so unless you stick with one ecosystem then HA is the best option. Sticking with one ecosystem is not great either as it is impossible to find everything you may want within one and usually ends up locking you into more costly products. The constant updates are both HA's strength and it's weakness, technology changes rapidly so it needs to keep up, but in fairness it's gotten much better and simpler to use since I started using it.


    The power backup suggestion is what I've been thinking about for the last week for myself and I think I will need to consider, my setup is probably a little more complicated than most as it covers multiple locations connected through VPN's run by a single HA instance losing power can mess things up a bit and I need to reboot a few devices if they happen to come online before HA. At least if I could keep HA and the router online then everything else would recover more easily without intervention.



  • Registered Users, Registered Users 2 Posts: 4,989 ✭✭✭paulbok


    I have a second-hand ups box that keeps HA going for about an hour, though I'm Moving to a new bigger server this week so that'll drop to half an hour or less. Don't mind that much, I mainly have it to avoid several brown outs a year we get causing havoc on the PC. Have another smaller back up that needs a new battery, that I'll be plugging the router into, that's in a different location to the server.

    I never have any issues with the monthly updates that aren't of my own doing. If I stick to my updating process I always can roll back if I need to.

    1. Run any updates on Proxmox.

    2. Run and updates for installed integrations, including on HACS.

    3. Check release notes for any breaking changes. These are flagged months in advance nowadays.

    4. Create a HA backup and download it to a different PC.

    5. Create a snapshot on Proxmox. This is the most important step, will roll back to this if the HA update screws up

    6. Run the new HA update.

    7. Run the new HA OS update if available.

    8. Check for any more integration updates.

    9. If all looks to be ok, create another Proxmox snapshot and that's it.


    A good few steps but doesn't take long to run through it all, and can be pottering away at something else while it's running.



  • Registered Users, Registered Users 2 Posts: 6,153 ✭✭✭Shoog


    I am most of the way through setting up an NSPanel as a smart thermostat. I am using someone else's yaml file to set it up and have got almost everything working but it is showing the incorrect date (and possibly day though I think I have sorted that). The logic is;

    char const *day_semana[] = { "Sat.", "Sun.", "Mon.", "Tue.", "Wed.", "Thur.", "Fri." };

    const char *str = day_semana[id(homeassistant_time).now().day_of_week]; // range [0-6, Mon.=0]

    id(disp1).set_component_text_printf("page0.date", "%s %02i/%02i", str, day, month);

    The bolded bit is at fault, but I do not know enough about the code to understand the issue. Anyone make a suggestion as to whats the issue.



  • Advertisement
  • Registered Users, Registered Users 2 Posts: 3,579 ✭✭✭swampgas


    What date do you get, with that code?

    The code for the day of the week looks iffy - shouldn't it be something like this if "day_semana[id(homeassistant_time).now().day_of_week]" returns 0 for Monday, as suggested by the comments?

    Like this maybe: char const *day_semana[] = { "Mon.", "Tue.", "Wed.", "Thur.", "Fri.", "Sat.", "Sun." };

    Edit: don't know enough about the rest of it to comment though.



  • Registered Users, Registered Users 2 Posts: 7,494 ✭✭✭10-10-20


    Ah, this is a Nextion api command, no wonder the printf looked odd.

    I think we might need to see what page0.date looks like to understand that better...



  • Registered Users, Registered Users 2 Posts: 6,153 ✭✭✭Shoog


    Yes, he has gone with just about the most complex way to extract data that you could choose. Elegant if you know what you are doing but excluding if you aren't a programmer.

    I get a static "Sat 8/1" for the output on the screen, which I think is just a default fallback value. Going to see if my efforts produce a day change tomorrow - but am lost as to where he is getting the date from. To be honest I dont even know what page0.date is refering to.

    Post edited by Shoog on


  • Registered Users, Registered Users 2 Posts: 7,494 ✭✭✭10-10-20


    I was assuming that Page0 is one of the screen pages used to present data? I use oled displays on my esp32's and I write pages like this:

    Do you not have similar in the device configuration section?



  • Registered Users, Registered Users 2 Posts: 6,153 ✭✭✭Shoog


    No there is no specific display section.


    This is the whole yaml and to be frank I cannot see for the life of me why its not working - it looks perfectly setup to extract the day and date, but it never does.

    # Set some variables for convenience

    substitutions:

    node_name: nspanel

    device_name: NSPanel

    target_temp_home: 20.0 °C

    target_temp_eco: 16.0 °C


    esphome:

    name: $node_name

    comment: $device_name


    esp32:

    board: esp32dev


    wifi:

    ssid: !secret wifi_ssid

    password: !secret wifi_password

    # Optional manual IP



    # Enable logging

    logger:

    level: DEBUG

    logs:

    sensor: ERROR


    # Enable wireless updates

    ota:

    password: !secret wifi_password


    # Enable Home Assistant API

    api:

    services:

    # Service to play a song

    - service: play_rtttl

    variables:

    song_str: string

    then:

    - rtttl.play:

    rtttl: !lambda 'return song_str;'

    - service: upload_tft

    then:

    - lambda: 'id(disp1)->upload_tft();'

    - service: send_command

    variables:

    cmd: string

    then:

    - lambda: 'id(disp1).send_command_printf("%s", cmd.c_str());'


    time:

    - platform: homeassistant

    id: homeassistant_time

    timezone: Europe/London

    on_time:

    - seconds: 0

    minutes: '*'

    then:

    - script.execute: tft_date_update

    - script.execute: tft_time_update

    - script.execute: tft_weather_update

    # A reboot button is always useful

    button:

    - platform: restart

    name: Restart $device_name


    # Define some inputs

    binary_sensor:

    # Switches between HEAT or OFF mode

    - platform: gpio

    name: $device_name Left Button

    pin:

    number: 14

    inverted: true

    on_press:

    then:

    - climate.control:

    id: caldera

    mode: !lambda |-

    if (id(caldera).mode==CLIMATE_MODE_OFF)

    {

    return CLIMATE_MODE_HEAT;

    }

    else

    {

    return CLIMATE_MODE_OFF;

    }

    - script.execute: tft_wake_up


    # Switches between a predefined "night" or "sleep" target temperature and a "normal" target temperature

    # this will be also automated in homeassistant, but it is nice to have a button for it

    - platform: gpio

    name: $device_name Right Button

    pin:

    number: 27

    inverted: true

    on_press:

    then:

    - climate.control:

    id: caldera

    preset: !lambda |-

    if (id(caldera).preset==CLIMATE_PRESET_ECO)

    {

    return CLIMATE_PRESET_HOME;

    }

    else

    {

    return CLIMATE_PRESET_ECO;

    }

    - script.execute: tft_wake_up


    - platform: nextion

    name: $device_name Up Button

    page_id: 0

    component_id: 6

    on_press:

    then:

    - climate.control:

    id: caldera

    target_temperature: !lambda "return id(caldera).target_temperature + 0.1;"


    - platform: nextion

    name: $device_name Down Button

    page_id: 0

    component_id: 7

    on_press:

    then:

    - climate.control:

    id: caldera

    target_temperature: !lambda "return id(caldera).target_temperature - 0.1;"


    sensor:

    - platform: wifi_signal

    name: $device_name WiFi Signal

    id: wifi_rssi

    update_interval: 60s

    on_value:

    # Push it to the display

    # RSSI is negative

    # -0 - -50 => excellent - wlan4 - pic id 21

    # -50 - -60 => good - wlan3 - pic id 20

    # -60 - -70 => fair - wlan2 - pic id 19

    # -70 - -85 => weak - wlan1 - pic id 18

    # -85 - -90 => offline - wlan0 - pic id 17

    then:

    - lambda: |-

    if (id(wifi_rssi).state >= -50) { id(disp1).set_component_pic("page0.picSignal", 21); }

    if ((id(wifi_rssi).state < -50) && (id(wifi_rssi).state >= -60)) { id(disp1).set_component_pic("page0.picSignal", 20); }

    if ((id(wifi_rssi).state < -60) && (id(wifi_rssi).state >= -70)) { id(disp1).set_component_pic("page0.picSignal", 19); }

    if ((id(wifi_rssi).state < -70) && (id(wifi_rssi).state >= -85)) { id(disp1).set_component_pic("page0.picSignal", 18); }

    if (id(wifi_rssi).state < -85) { id(disp1).set_component_pic("page0.picSignal", 17); }

    # from https://github.com/darktim/ESPHome-NSPanel/blob/main/WiFi-Indicator.md


    - platform: adc

    id: ntc_source

    pin: 38

    update_interval: 10s

    attenuation: 11db


    - platform: resistance

    id: resistance_sensor

    sensor: ntc_source

    configuration: DOWNSTREAM

    resistor: 11.2kOhm


    - platform: ntc

    id: temperature

    sensor: resistance_sensor

    accuracy_decimals: 2

    filters:

    - median:

    window_size: 15

    send_every: 10

    send_first_at: 3

    calibration:

    b_constant: 3950

    reference_temperature: 25°C

    reference_resistance: 10kOhm

    name: $device_name Temperature

    on_value:

    then:

    - lambda: 'id(disp1).set_component_text_printf("page0.intTemp", "%.1f""\xb0", x);'


    # Grab current temperature from Home Assistant

    - platform: homeassistant

    id: ext_temperature

    entity_id: weather.forecast_home

    attribute: temperature

    on_value:

    then:

    - lambda: 'id(disp1).set_component_text_printf("page0.extTemp", "%.1f""\xb0", x);'


    - platform: homeassistant

    id: wind_speed

    entity_id: weather.forecast_home

    attribute: wind_speed

    unit_of_measurement: "km/h"

    on_value:

    then:

    - lambda: 'id(disp1).set_component_text_printf("page0.wind", "%i km/h""\xb0", (int)id(wind_speed).state);'


    - platform: nextion

    id: current_page

    name: "current_page"

    internal: true

    accuracy_decimals: 0

    variable_name: dp

    update_interval: 1s


    - platform: uptime

    name: Uptime Sensor


    text_sensor:

    - platform: homeassistant

    id: current_weather

    entity_id: weather.forecast_home

    on_value:

    then:

    - script.execute: tft_weather_update


    script:

    - id: tft_weather_update

    then:

    - lambda: |-

    char const *wstr[] = {"clear-night", "cloudy", "fog",\

    "lightning", "lightning-rainy", "partlycloudy",\

    "pouring", "rainy", "snowy", "sunny"};

    int i = 0;

    if (id(current_weather).state=="unknown") return;

    while ((id(current_weather).state!=wstr[i])&&(i<9)) {i++;}

    if ((i>0)&&(i<10))

    {

    id(disp1).send_command_printf("page0.weather.pic=%i", i+3);

    id(disp1).set_component_text_printf("page0.wind", "%i km/h", (int)id(wind_speed).state);

    }

    - id: tft_date_update

    then:

    - lambda: |-

    int day = id(homeassistant_time).now().day_of_month;

    int month = id(homeassistant_time).now().month;

    if ((day>0)&&(day<7)&&(month>0)&&(month<13))

    {

    char const *day_week[] = { "Saturday", "Sunday", "Monday", "Tuesday", "Wednsday", "Thursday", "Friday" };

    const char *str = day_week[id(homeassistant_time).now().day_of_week]; // range [1-7], Saturday=1

    id(disp1).set_component_text_printf("page0.date", "%s %02i/%02i", str, day, month);

    }

    - id: tft_time_update

    then:

    - lambda: 'id(disp1).set_component_text_printf("page0.time", "%s", id(homeassistant_time).now().strftime("%H:%M").c_str());'

    - id: tft_wake_up

    then:

    - lambda: |-

    id(disp1).send_command_printf("page0.sleep_cnt.val=page0.sleep_timeout.val");

    id(disp1).send_command_printf("page0.sleep_timer.en=1");

    if (id(current_page).state!=0)

    id(disp1).send_command_printf("page 0");

    id(disp1).send_command_printf("dim=page0.brightness.val");


    # Define some outputs

    switch:

    # Relay 2 is the thermostat switch, Relay 1 was physically removed!

    - platform: gpio

    name: $device_name Relay

    id: relay_2

    internal: true # it should not be activated directly by home assitant

    pin:

    number: 19


    # Pin 4 always needs to be on to power up the display

    - platform: gpio

    id: screen_power

    entity_category: config

    pin:

    number: 4

    inverted: true

    restore_mode: ALWAYS_ON


    - platform: template

    name: $device_name auto sleep

    id: auto_sleep

    entity_category: config

    restore_mode: ALWAYS_ON

    optimistic: true

    on_turn_on:

    - lambda: 'id(disp1).send_command_printf("page0.disable_sleep.val=0");'

    on_turn_off:

    - lambda: 'id(disp1).send_command_printf("page0.disable_sleep.val=1");'


    number:

    - platform: template

    name: $device_name Brightness

    id: brightness

    entity_category: config

    unit_of_measurement: '%'

    icon: "mdi:brightness-percent"

    min_value: 0

    max_value: 100

    step: 1

    initial_value: 30

    set_action:

    then:

    - lambda: |-

    id(disp1).send_command_printf("page0.sleep_timer.en=1");

    if (id(current_page).state!=0)

    id(disp1).send_command_printf("page 0");

    id(disp1).set_backlight_brightness(x/100);

    # Sets the sleep timer value

    # requires code running in the nextion tft to make a 1 second period timer

    # with a counter and a variable to store the timeout

    - platform: template

    name: $device_name Sleep timeout

    id: sleep_timeout

    entity_category: config

    unit_of_measurement: 's'

    icon: "mdi:timer"

    min_value: 3

    max_value: 300

    step: 1

    initial_value: 60

    set_action:

    then:

    - lambda: |-

    id(disp1).send_command_printf("page0.sleep_timeout.val=%i", (int)x); // set the timeout

    id(disp1).send_command_printf("page0.sleep_cnt.val=%i", (int)x); // reset the counter to its maximum


    # Configure the internal bleeper

    output:

    - platform: ledc

    id: buzzer_out

    pin:

    number: 21


    # Enable ringtone music support

    rtttl:

    id: buzzer

    output: buzzer_out


    # Configure UART for communicating with the screen

    uart:

    id: tf_uart

    tx_pin: 16

    rx_pin: 17

    baud_rate: 115200


    # Configure the screen

    display:

    - platform: nextion

    id: disp1

    exit_reparse_on_start: true

    uart_id: tf_uart

    tft_url: !secret panel_file

    on_setup:

    then:

    - number.set:

    id: brightness

    value: 30

    - lambda: |-

    id(disp1).set_component_text_printf(

    "page0.intTemp", "%.1f""\xb0", id(temperature).state);

    id(disp1).set_component_text_printf(

    "page0.extTemp", "%.1f""\xb0", id(ext_temperature).state);

    id(disp1).set_component_text_printf("page0.btn0", "ENCENDER");

    id(disp1).set_component_text_printf("page0.btn1", "MODO ECO");

    - script.execute: tft_date_update

    - script.execute: tft_time_update

    - script.execute: tft_weather_update


    - rtttl.play: "twobits:d=4,o=5,b=220:c6,8g,8g,a,g,p,b,c6"


    # Single-point thermostat (for heating only)

    climate:

    - platform: thermostat

    id: caldera

    name: $device_name Thermostat

    sensor: temperature

    preset:

    # Sleep temperature

    - name: eco

    default_target_temperature_low: $target_temp_eco

    # Normal heating temperature

    - name: home

    default_target_temperature_low: $target_temp_home

    heat_deadband: 0.2

    heat_overrun: 0.2

    min_heating_off_time: 300s

    min_heating_run_time: 300s

    min_idle_time: 30s

    heat_action:

    - switch.turn_on: relay_2

    idle_action:

    - switch.turn_off: relay_2

    on_state:

    - lambda: |-

    id(disp1).set_component_text_printf("page0.setTemp", "%.1f""\xb0", id(caldera).target_temperature);


    if (id(caldera).mode==CLIMATE_MODE_OFF)

    id(disp1).set_component_text_printf("page0.btn0", "HEATER OFF");

    else

    id(disp1).set_component_text_printf("page0.btn0", "HEATER ON");


    if (id(caldera).preset==CLIMATE_PRESET_ECO)

    id(disp1).set_component_text_printf("page0.btn1", "ECO MODE");

    else

    id(disp1).set_component_text_printf("page0.btn1", "HOME MODE");


    if (id(caldera).action==CLIMATE_ACTION_HEATING)

    id(disp1).set_component_pic("page0.picBurn", 13);

    else

    id(disp1).set_component_pic("page0.picBurn", 22);

    visual:

    min_temperature: 10

    max_temperature: 30

    temperature_step: 0.1

    Post edited by Shoog on


  • Registered Users, Registered Users 2 Posts: 7,494 ✭✭✭10-10-20


    Stick that in code quotes @Shoog and we might be able to read it. ;)

    Nevermind.

    So it's this part... (as you previously posted) which I now understand a bit better:

      - id: tft_date_update
        then:
        - lambda: |-
          int day = id(homeassistant_time).now().day_of_month;
          int month = id(homeassistant_time).now().month;
          if ((day>0)&&(day<7)&&(month>0)&&(month<13))
          {
          char const *day_week[] = { "Saturday", "Sunday", "Monday", "Tuesday", "Wednsday", "Thursday", "Friday" };
          const char *str = day_week[id(homeassistant_time).now().day_of_week]; // range [1-7], Saturday=1
          id(disp1).set_component_text_printf("page0.date", "%s %02i/%02i", str, day, month);
          }
      - id: tft_time_update
        then:
        - lambda: 'id(disp1).set_component_text_printf("page0.time", "%s", id(homeassistant_time).now().strftime("%H:%M").c_str());'
    

    So it seems to me that page0 is the initial page which is displayed on the Nextion device, subsequent pages would be page1 and so forth. You can write to each of the elements on that page (such as "wind", "date, "time", "btn0") with text or icon objects.

    Initially the date/time string is gathered from Home Assistant as a string through the time platform up at line 49.

    time:
      - platform: homeassistant
        id: homeassistant_time
        timezone: Europe/London
    

    Then this lambda converts that string into the required elements "day (day of month)", "month (month of year)":

    int day = id(homeassistant_time).now().day_of_month;
    

    Below that it the lambda then takes the day_week as an integer (the day number within a week) and then converts it into a text string of the day name called "str".

    Then here in this line...

    id(disp1).set_component_text_printf("page0.date", "%s %02i/%02i", str, day, month);
    

    It uses the "str, day and month" to create a new string of, for example: "Monday 29/01" which is then sent to the date object within page0.

    The Nextion should then be displaying that within the boxes or options on that initial page on the device.

    Post edited by 10-10-20 on


  • Registered Users, Registered Users 2 Posts: 6,153 ✭✭✭Shoog


    Yep that's how I figured it, but it simply is falling over in some way. There seems to be no actual issue with the code so maybe it a problem in the nexion page format. The default fall back screen output is Sat. 8/1.

    I will mess about with it some more, I got the day to change last night but broke it again today. Can't find much detailed info on the now() command to see exactly what it returns to each call type which would be helpful.



  • Registered Users, Registered Users 2 Posts: 7,494 ✭✭✭10-10-20


    So you always get Sat 8/1, nothing else?

    I can modify that code and run it against my oled screen later and see what happens, should be simple enough (takes hat off head and adds salt & pepper).



  • Registered Users, Registered Users 2 Posts: 6,153 ✭✭✭Shoog


    Yes that all that it outputs.

    There is a fault in the conditional logic which prevents the date stripping after the first seven days of the month. change the condition to between 0 and 32 days (was 0 to 7) and it runs. This correctly inserts the Day text but still no actual date. Progress though.

    Update: All resolved, I had deleted %02i/%02i from the print command by accident which was preventing the date from been printed. Put it back and all is well.

    Post edited by Shoog on


  • Registered Users, Registered Users 2 Posts: 7,494 ✭✭✭10-10-20


    @Shoog - works fine here. 😂 (to a point)

          - id: page4
            lambda: |-
                int day = id(homeassistant_time).now().day_of_month;
                int month = id(homeassistant_time).now().month;
                //if ((day>0)&&(day<7)&&(month>0)&&(month<13))
                char const *day_week[] = { "Saturday", "Sunday", "Monday", "Tuesday", "Wednsday", "Thursday", "Friday" };
                const char *str = day_week[id(homeassistant_time).now().day_of_week]; // range [1-7], Saturday=1
                it.printf(0, 0, id(font1), "1: %s", str);
                it.printf(0, 44, id(font1), "2: %02i/%02i", day, month);
    

    I took out the if-statement above (as it wasn't working - more to follow) and broke out the code a bit (to fit my 0.96" oled), now I get this on the display:

    I'm thinking that you might have a broken connection back to the HA server and you're not getting a date/time...? Could that be the issue? I'll test more later.



  • Advertisement
Advertisement