Giter VIP home page Giter VIP logo

haswitchplate's Introduction

We're Moving!

This repository is an archived snapshot of the pre-1.0 HASP project.

Below you'll find saved information about previous versions of HASP.


HA SwitchPlate

The HA SwitchPlate is a user-programmable LCD touchscreen you can mount into a standard North American work box in place of a light switch. It connects to your home automation system over WiFi to send and receive MQTT messages in response to user interactions on the screen or events happening in your home. The result is an attractive and highly-customizable controller for your home automation system which you can build yourself!

HA SwitchPlate Models

The HA SwitchPlate ("HASP") utilizes a Nextion 2.4" LCD Touchscreen display mounted in a 3D-printed enclosure as a touchscreen panel for home control and information display. An ESP8266-based microcontroller provides WiFi connectivity and system control. The project has been developed to integrate with Home Assistant and OpenHAB but should be compatible with any other MQTT-enabled automation platform such as Domoticz, Node-Red, Wink, SmartThings, Vera, HomeKit, etc.

The Arduino code for the ESP8266 provides a generic gateway between MQTT and the Nextion instruction set. A basic Nextion HMI display file has been included with several pages of various layouts to provide user controls or to present information in response to MQTT messages sent to the device.

Demo screens

Scene controller Status display Media control Alarm Panel Slider/Dimmer Controls HVAC Controls Light toggles Fan controller WiFi Setup

Purchase an assembled unit

As this build requires some specialist skills and tools, I will occasionally be offering assembled devices for sale here.

Buy me a coffee

Buy me a coffee

This project is powered by coffee. I might get a little weird about it at times, but it's not much of a stretch to suggest that coffee both powers and consumes a fair portion of my mental energy. Hook me up if you think HASP is cool. Thanks!

Bill of Materials

To build a simple version of this project you will minimally need the Nextion display and the WeMos D1 Mini, 4 jumper wires, and a USB cable to power both devices.

A complete build that's ready to install will require the following components:

Get Started!

Check out the documentation to get started building your own HA SwitchPlate.

haswitchplate's People

Contributors

aderusha avatar billchurch avatar bkpsu avatar ceaswaran avatar cloggeddrain avatar daemonic79 avatar ianduncant avatar jquatier avatar lebherz avatar ludeeus avatar m14t avatar rohankapoorcom avatar supersimo88 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

haswitchplate's Issues

without ha

hi there
is it possibly to use this without home assistant.
i want to use just node-red and mqtt
thanks Andy

Question: Print settings for Atomic PETG?

Great work on this project.

I happen to have the same printer as you, Original Prusa i3 Mk 3, and figured I'd try some of that Atomic White PETG as well...

Was wondering what your printer settings looked like, working on dialing in now, seems to be under-extruding slightly for the stock PETG settings. I bumped my temp to 240deg C as well.

LCD OTA update broken

Something in the v0.2.0 release has broken LCD OTA updating, need to take a look at what's happening there.

Compile Error - Software Serial - use of deleted function

This is the Error:

HASwitchPlate-master\Arduino_Sketch\HASwitchPlate\HASwitchPlate.ino:

In function 'void debugPrintln(String)':

HASwitchPlate:2506:54: error: use of deleted function 'SoftwareSerial::SoftwareSerial(const SoftwareSerial&)'

 SoftwareSerial debugSerial = SoftwareSerial(17, 1); // 17==nc for RX, 1==TX pin

                                                  ^

Environment is:
Windows 10
Arduino 1.8.9 (Windows Store 1.8.21.0)

Libraries:
Esp8266 2.5.2
ArduinoJson 5.13.5
MQTT 2.4.3
WifiManager 0.14.0

No modifications were made to the file.
Any suggestions?

information for pcb

What are the dimensions height x width mm?
How many layers and thickness?

Faceplate Design Methods

I'm working on recreating the faceplate in a parametric CAD tool (Fusion 360) for easier customization. I was wondering how you came up with the placement of the panel in the faceplate. I noticed the top of the screen is 30.34mm from the top of the panel (in 3D_Printable_Models/HASwitchPlate_front_double_decora_right.stl) and 35.16mm from the bottom edge. Was there a specific reason it's off center?

Dual State Buttons - Nextion Editor

Hiya,

Just wanted to get your thoughts on making dual state buttons that the Nextion Editor now allows us to use in regards to MQTT.

Currently, dual state buttons on Nextion allow the picture to change based on the state (denoted by a val attribute on the object in Nextion).

However, with the way the ESP interprets this button press, regardless of the state of the button on the Nextion, it still always sends a payload of 'ON' from MQTT.

There is of course a work around whereby you can create an automation to trigger an mqtt.publish from Home Assistant to get the state of the button via MQTT - stored in the val field (triggered when receiving an an 'ON' payload from this object), and then whatever the reply to that is, call whatever service is appropriate for that button state.

Just seems like a lot of MQTT traffic for what could be fairly simple, ie: Instead of the ON payload for a dual state button, maybe just a val that is equal to the val field of the attribute after the button press?

Just a thought, but that would make for some really cool dynamic GUIs that sync states on your lights especially.

Relay control?

Could this setup support a single relay for local control of a device?

Recommended Motion Sensor

I noticed the Motion Sensor Pin setting in the configuration and code. Is there a recommended sensor that fits in the enclosure? Any pics of the install?

Please change your online store!

Hi i don’t know if this is the right topic but i just want to tell you that i ve ordered 4 pcb from tindie and as i live in Argentina i use a pobox private courrier to buy things from USA and they ship them to Argentina and aparently tindie don’t ship to poboxes so they ‘ve cancelled my order. They say its a way to protect you but honestly this situation is harming you as you can not sell your products abroad wich is out of logic. Sorry for using this way.

EU version

Hi,
I'm trying to develop a version which fits into EU style box (68mm diameter) for 2.4" LCD.

For those interested - current version of PCB can be found here: https://easyeda.com/zdar/d1-power-board

At this moment I have prototype PCB assembled and I'm waiting for the LCD to test everything.
Unfortunatelly the HMI LCD is a bit too big so regular switch front frame and plate will need adjustment (Logus90 in my case).

The design uses power source (the break out part of PCB - simply snap it off by pliers) perpendicullary attached to the main board via solder bridge or angle pins. The LCD should go on top and hopefully it will fit into regular plastic frame with the inner fence trimmed off in apropriate parts.

Comments are welcome :-)

Payload Problems: txt with ""

Hi,
I'm a newbie. And I've got a Problem.
My home sends as payload 22.3 (i.e. for temperature in °C).
The hasp wants a txt-payload like "22.3" (with quotationmarks).
I use fhem (fhem.de) as home-server.

I cannot bring the marks in the payload. My scripting has a Problem with " in between "" of a command.

Is there a chance, that you build in a check on those Inputs and add the ""-marks?

I like this Project, and hope I'll get this (big) Problem solved.

Kind regards from Baden, GER
MadNBG

MQTT Homeseer Integration

Trying to plumb the HASP into Homeseer via MQTT. Most things seem to be working (status, initialization), but for its events, Homeseer seems to require a numeric value (1 or 0) for the button status instead of "OFF' or "ON".

Is that hard-coded, or is there something I can change in either Nextion or the MQTT initialization to change that? I didn't see it anywhere.

TJC display

I bought what the seller claimed to be a nextion display, but I only discovered after receiving it that it is a tjc instead, can I do something? there is the possibility of having a tft file for this too

Too many MQTT messages.

The idea of the project is great.
However, it's very message intensive and that demands a lot of the broker. It's causing my broker to slow down for the rest of my devices.

I propose having a batch topic, that we could send one message containing several topics and values, much like the Tasmota Backlog command.
A simple JSON would suffice, like so:

{
	"command": "dim=50",
	"command/page": 1,
	"command/p[1].b[4].txt": "Lamp On"
}

Failed to mount FS - symptom, can't save MQTT setting.

Hi, I'm going through building my own - fabulous project and instructions, btw - and am running into a problem in testing the thing when all connected.

When I initially flashed the D1 Mini and connected to it unattached to anything, I could see that my logging into the website and configuring "took". At least, I could see through a serial monitor that it setup all the plates channels on MQTT.

So then I soldered up the D1 to the board and attached the screen and now I'm constantly getting, Configure MQTT. When I look at it, it has all the WiFi configs I put in there but the MQTT is gone. Configuring it again fails with the log looking like this: (starting with where I save the settings)

[+21.850s] SPIFFS: Saving config
[+21.857s] SPIFFS: Failed to open config file for writing
[+21.868s] RESET: HASP reset

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v614f7c32
~ld
   [+0.058s] 
SYSTEM: Hardware initialized, starting program load
[+0.070s] HMI OUT:  rest
[+0.075s] SPIFFS: mounting FS...
[+0.082s] SPIFFS: [ERROR] Failed to mount FS
[+0.091s] HMI OUT:  page 0
[+0.099s] HMI OUT:  'p[0].b[1].txt="WiFi Connecting"'
[+5.057s] HMI OUT:  'p[0].b[1].txt="WiFi Connected:\r172.16.1.189"'
[+5.069s] WIFI: Connected succesfully and assigned IP: 172.16.1.189
[+5.082s] HTTP: Server started @ http://172.16.1.189
[+5.093s] ESP OTA: Over the Air firmware update ready
[+5.104s] HMI OUT:  page 0
[+5.116s] HMI OUT:  'p[0].b[1].txt="WiFi Connected!\rConfigure MQTT:\r172.16.1.189\r\r\r\r\r\r\r "'
[+5.138s] HMI OUT:  'p[0].b[3].txt="http://172.16.1.189"'
[+5.149s] HMI OUT:  vis 3,1
[+13.114s] HMI OUT:  connect

Any clue what I might have done? Something in soldering or elsewhere that could result in this? And are the comments around the FS normal?

Any thoughts would be appreciated.

Thanks,

Dave

Create script for cloning packages

Create a bash script (or similar) to copy the plate01 config to a new package, renaming files and search/replacing the contents to simplify the process of adding new devices. Until then, there's this:

cp -R packages/plate01 packages/plate02
find packages/plate02 -name 'hasp_plate01_*.yaml' -type f -exec bash -c 'mv "$1" "${1/plate01/plate02}"' -- {} \;
sed -i -- 's/plate01/plate02/g' packages/plate02/*.yaml

Enhancement: Combine automations

An enhancement/suggestion, the automations for armed/disarmed status to change the button text and color on lines 247-325 can be combined with the automations on lines 100-190. All you need to do is combine the trigger sections of the two automations and keep the conditions and actions the same.

Add JSON "status" topic for commands from HASP

With the current implementation, the JSON "command" MQTT topic is great for combining multiple HA automations/openHAB items into single JSON string. However, for the return path (HASP button/dimmer events), dedicated MQTT topics are still required for each button or dimmer value. I think it would make sense to create a JSON "status" topic, that (much like the command topic) would send all HASP events onto a single MQTT channel. The home automation bus could then parse out those events to figure out which button on which page was pressed, and act accordingly. This could be as simple as sending the current MQTT topic id with the associated state, i.e.:

{
"event":"p[2].b[1]",
"value":"ON"
}

when button 1 on page 2 is pressed, or

{
"event":"p[4].b[7].val",
"value":"120"
}

when dimmer 7 on page 4 is moved (preferably on release, so only a single message is sent).

This would greatly reduce the number of MQTT topics associated with each HASP.

Change MQTT state topic names

Is it possible to break up the page and box number portion of the mqtt topic string?

from: hasp/plate01/state/p[1].b[1]
to: hasp/plate01/state/p[1]/b[1]

This would allow simplifying several of the automatons in home assistant so that they can do something like this rather than specifying each trigger manually per page

- alias: hasp_down_plate_p0_PageButton1Action
    trigger:
    - platform: mqtt
      topic: 'hasp/down_plate/state/+/.b[1]'
      payload: 'ON'
    action:
    - service: input_number.set_value
      data_template:
        entity_id: 'input_number.hasp_down_plate_activepage'
        value: '{{states.input_number.hasp_down_plate_pagebutton1page.state|int}}'

Graphical elements on the display

I have just started playing with your project. It is really cool! Thanks!

How can I send graphical elements to the display using your default code?

Is it possible or do we have to edit the code?

"No matching function for call to HTTPClient::begin(WiFiClient&, String&)"

Arduino IDE version 1.8.9 on MacOS

Could we get a list of the required libraries (and versions)? I am getting various compiler errors (like the one above), and also a complaint about MDNS.

Second question - can the binary be downloaded to the board directly from the IDE? I don't see a way to do this...

Fitting into old work electrical box

Add web server

It would probably be beneficial to add a simple web service to provide basic status info and allow simple remote control capabilities (remote reboot, factory reset, maybe OTA updates, etc)

LCD Reset

The nextionReset() function does not work.

You have set the digitalWrite(nextionResetPin, LOW); but did not set it HIGH again

void nextionReset()
{
digitalWrite(nextionResetPin, LOW);
Serial1.print("rest");
Serial1.write(nextionSuffix, sizeof(nextionSuffix));
Serial1.flush();
delay(2000);
}

I have added a digitalWrite(nextionResetPin, HIGH); and mqttClient.disconnect();. This turns on the power to the diplay again and also forces the diplay to re-connect and sync.

void nextionReset()
{
digitalWrite(nextionResetPin, LOW);
Serial1.print("rest");
Serial1.write(nextionSuffix, sizeof(nextionSuffix));
Serial1.flush();
delay(2000);
digitalWrite(nextionResetPin, HIGH);
mqttClient.disconnect();
}

MQTTClient error

Hi, I download all library (MQTT , wifimanager, arduinojson) and when I compiling the HASwithPlate code in Arduino IDE "MQTTClient does not name a type" is reported.

Please any help from you I will appreciate.

thanx

WiFi autoconfig not triggered on missing MQTT broker

The WiFi autoconfig process is triggered when the system cannot connect to WiFi with the saved SSID and password. This leaves the system in a loop trying to connect to an MQTT broker that hasn't been defined. The OTA service will work while in this loop, allowing you to push new firmware to the device while it's attempting to connect to MQTT, but that's not a great approach. I think it might be better to trigger the WiFi autoconfig process if there is no saved MQTT broker defined.

Panel infinite refresh loop

I have one of my three panels this constantly disconnects from HASSIO about every 30 seconds. I have re-flashed the WEMOS and checked everything.

Here is the status from the web page.
Any ideas?
MQTT Status: Connected
MQTT ClientID: plate02-18fe34e0c516
HASP Version: 0.30
LCD Model:
LCD Version: 0
LCD Active Page: 0
CPU Frequency: 160MHz
Sketch Size: 407808 bytes
Free Sketch Space: 2736128 bytes
Heap Free: 29456
IP Address: 192.168.1.215
Signal Strength: -66
Uptime: 22
Last reset: Fatal exception:0 flag:6 (EXT_SYS_RST) epc1:0x00000000 epc2:0x00000000 epc3:0x00000000 excvaddr:0x00000000 depc:0x00000000

Background images for HASP

Hello,

As you know, I have developed a set of background images for using with HASP. I would be honored if you could include a link to my repo into your HASP main page, so people would reach me more easily. I would be pleased to adjust the HMI/TFT files if you think it is appropriate. Just submit a request in this case.

https://github.com/lspaula/Nextion-background-for-HASwitchPlate

Thanks for this awesome job!

Best.

Add an MQTT Group Name parameter

Allow HASP to subscribe to commands under a group name. This would mean that multiple hasps would be subscribed to the same groupname (command) topics in addition to their own unique nodename topics.

This would make it simpler from a HA point to update the information on multiple HASPs at once even if all pages don't show the same thing. For my use case, I have the same status screen with the clock, date, weather on each HASP, even though the lighting controls are different. This change will allow simplified HA automations (and/or removing redundant ones) since all HASPs will subscribe to the same groupname command topics.

In theory this also makes updating easier since they can all be MQTT updated at once.

FR: Adjust switchplate model to address LCD Backlight light leakage

Just for tracking purposes at this point. I bought mine pre-printed so I haven't tried to edit the model yet. Noticed under low light that some backlight leaks through the front plastic of the cover plate (at the bottom, see pic below). Hoping just some additional thickness will help and shouldn't break the clearances required for proper fit.

image

Control without MQTT?

Question

Is it possible to adjust the backlight level when the MQTT server is unavailable?

Back story

I live in CA and am effected by the fire preventive power shutoffs. When this is scheduled, I proactively power down a bunch of things, like the MQTT server that my HASwitchPlate connects to in order to save the UPS it's connected to for other things.

However, when this happens, the HASwitchPlate displays the wifi information and sets the backlight to what looks like 100%. This plate is in our bedroom and so ideally we would be able to control/dim this backlight.

--

Thanks again for all the work here! This is one of the first things I look at every morning. I love it.

Can't Open Sketchup File

I have SketchUp Make 17 which as far as I can tell is the latest version of the downloadable free version.
When I try to open the current HASwitchPlate.skp file it says I need version 18. I can download the trial Pro version of 18, but will only have 30 days to work with it. Can you save the file be saved as version 17?
Are you using SketchUp 18 Pro?
Jeff

Custom Component?

We might be approaching the point where a custom component may be the right way to go rather than having all of the automations dealing with the MQTT directly.

Pull requests #17 , #19, #23 have been moving us towards the right direction (using python_scripts) for the actions being performed but it would be better if we created a new event that would be fired whenever a button was clicked with the button information in the event data. This would simplify the automation triggers.

Additionally, we could fire events when a HASP unit was connected/disconnected (similar to my custom automations in my own config

Another benefit of the custom component approach is that some point after making a custom component we could work to get it added to Home Assistant proper which would make setting up new HASP units much easier.

HA Invalid config on platform: time_pattern

I am using Hass.io and after the command from cli, the package was created but now I am getting an error on the configuration.yml

Invalid config for [automation]: Invalid platform specified @ data['trigger'][0]. Got None. (See /config/configuration.yaml, line 807)

HA v. 0.84.6
Any help?

Edit:
The error came from this file:
p2_clock
on platform: time_pattern

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.