Re: [mh] Adding Tasmota HTTP support
Jeff Siddall via misterhouse-users <[email protected]>
| Newsgroups | gmane.comp.misc.misterhouse.user |
|---|---|
| Message-ID | <[email protected]> |
Steve, I should also add, I am considering sticking some old phones/tablets around and setting them up as touchscreen controllers using MH groups to configure which buttons each screen gets. Jeff On 2020-12-14 8:23 p.m., Stephen Switzer wrote: > This is GREAT news! Good job on the code! Those pesky firewalls can > cause havoc, can't they? LOL > > I have a bunch of Insteon devices that I've come to like, but there's > a couple little oddities with 1-2 of the devices that often don't > communicate and never synchronize with the PLM, even though 3 other > devices in the same wall box do!?? > > The one question that I have for you on these devices is can I set up > keypad buttons to control multiple devices on one wall plate like the > 8 key KPL? Oh, and one more question... can they respond to "scenes"? > For example, I have one button that turns off all 1st floor devices > for bedtime. All lights and fans are off at once. > > Thanks! Looking forward to more progress. > > Steve > > On Mon, Dec 14, 2020 at 6:16 PM Jeff Siddall via misterhouse-users > <[email protected] > <mailto:[email protected]>> wrote: > > Another update: yay, everything is working! > > There isn't much to screenshot here (I mean, they just look like any > other type of thing in MH) but there are a couple of log > messages. When > MH starts you get: > > [Tasmota_HTTP::Switch] Created item with address 192.168.1.128 > > And if debug=tasmota is set in your mh.private.ini then you also get > this when MH turns a device on remotely: > > [Tasmota_HTTP::Item] DEBUG: Set $Outdoor_Lights_SM state to on > [Tasmota_HTTP::Item] DEBUG: Received ack from $Outdoor_Lights_SM > (192.168.1.128) > > or if you control the Tasmota device locally you get: > > [Tasmota_HTTP::Item] DEBUG: Received set state to off from > $Outdoor_Lights_SM (192.168.1.128) > > On the Tasmota, after setting it up as the right template, it only > takes > a couple of console commands to get the local control messages > sent out > over HTTP: > > Rule1 ON Power1#State DO WebSend [<mh_address>:<mh_port>] > /SET;none?select_item=<item_name>&select_state=%value% ENDON > Rule1 1 > SwitchMode 3 > > Where: <item_name> is the name of this device in MH (ex: > Outdoor_Lights_SM), <mh_address> is the IP address of MH, and > mh_port is > the TCP port that the MH web server is listening on. > > SwitchMode 3 just sets the switch input to work like any other > typical > home automation switch where each push of the momentary button > toggles > the state. > > The issue I had with the Tasmota sending local control messages was > because I hadn't put a hole through the firewall to allow that. My > phone did work, but that is because it was going through a proxy. > > After I got two-way communication working I rewrote the module a > bit to > add ack tracking and to use an inherited classes for different > devices, > which should make it easy for people to add more Tasmota things > down the > road. Right now there is only a Tasmota_HTTP::Switch (with on and > off > states), but hopefully that will cover the most common use case. All > this added another 18 lines of code, so yeah, it still doesn't do > error > checking or other things it probably should. > > I also created a bash script to install Tasmota on Sonoff 3.1.5 (OTA) > devices, and will post that separately. One nice thing about these > devices is that they requires no special apps or utilities to > setup. I > did mine using a browser on my phone and curl on my MH machine. I > also > used apache to server the firmware, but I think I could have just > pointed them to the Tasmota OTA server if I wanted. > > I will work on creating a pull request for the module and post an > update > if/when I have success with git. > > Jeff > > On 2020-12-13 11:43 p.m., Jeff Siddall via misterhouse-users wrote: > > Update: some Sonoff Minis showed up this afternoon. It was a bit > > fiddly to get them updated to Tasmota, but I have that done now. > More > > surprisingly, I also successfully controlled them from my new perl > > module on the first attempt. I don't remember the last time I > wrote > > something that worked on the first try! > > > > Unfortunately I have had less luck getting Tasmota to send local > > control messages back to MH. It always reports a timeout when > sending > > the HTTP request, even though I can successfully send the exact > same > > URL from my phone on the same WiFi network. If I take out the port > > number from the URL then the Tasmota device does successfully > send the > > request [to port 80], but I have an apache server running on > port 80 > > on my MH machine so that doesn't exactly work. I hope I haven't > found > > a bug in the firmware. > > > > I will do some more troubleshooting to see if I can get to the > bottom > > of it. > > > > Jeff > > > > On 2020-12-13 12:45 a.m., Jeff Siddall wrote: > >> Thanks! > >> > >> I decided to take a stab at it, and after a couple of hours have > >> Tasmota_HTTP_Item.pm written. This one is a more substantial 30 > >> lines of code, plus another 5 lines in read_table_A.pl. > >> > >> Now I just need some devices to test it with. > >> > >> Jeff > >> > >> On 2020-12-12 9:55 p.m., H Plato wrote: > >>> Look at my razberry module. This is very similar to how it works. > >>> Sending a http command for control and having a web endpoint for > >>> accepting status changes. > >>> > >>> Sent from my mobile device. > >>> > >>>> On Dec 12, 2020, at 7:41 PM, Jeff Siddall via misterhouse-users > >>>> <[email protected] > <mailto:[email protected]>> wrote: > >>>> > >>>> As a follow-on to the "What’s better than Insteon?" thread, > Giles > >>>> put me onto the Tasmota open source firmware that will run on a > >>>> huge number (literally thousands) of smart things on the market. > >>>> While you can talk to those over MQTT, then you also need to > setup > >>>> a broker, and that seems awkward in a world where all the smart > >>>> things have web interfaces. > >>>> > >>>> So that got me thinking about building a "Tasmota_HTTP_Item" in > >>>> MH. There is already support for SETting things in MH using > HTTP > >>>> via the lib/http_server.pl <http://http_server.pl> code. > Tasmota devices can send updates > >>>> using HTTP, as in this example: > >>>> > >>>> > https://tasmota.github.io/docs/Rules/#two-way-light-switches-without-mqtt > > >>>> > >>>> > >>>> So combining those two would result in a rule for local switch > >>>> control on the Tasmota with a command like: > >>>> > >>>> WebSend [<mh_ip_address>:8081] > >>>> /SET;none?select_item=Tasmota_Item_Name&select_state=on > >>>> > >>>> And for remote control, MH would send a command like this > when an > >>>> item is set: > >>>> > >>>> get 'http://<tasmota_item_ip>/cm?cmnd=POWER1 ON' > >>>> > >>>> The only other thing is that the "set" function for the > >>>> Tasmota_Item would need to check if the item was set_by: > >>>> > >>>> web [<tasmota_item_ip_address>] > >>>> > >>>> ...and then not send anything in that case so it doesn't end > up in > >>>> a send loop with the Tasmota device. > >>>> > >>>> Anyone tried anything like that? If not, I guess it is time to > >>>> order some of these things and start tinkering! > >>>> > >>>> > >>>> > >>>> ________________________________________________________ > >>>> To unsubscribe from this list, go to: > >>>> https://lists.sourceforge.net/lists/listinfo/misterhouse-users > >>>> > > > > > > ________________________________________________________ > > To unsubscribe from this list, go to: > > https://lists.sourceforge.net/lists/listinfo/misterhouse-users > > > > > ________________________________________________________ > To unsubscribe from this list, go to: > https://lists.sourceforge.net/lists/listinfo/misterhouse-users > > > > -- > Best regards, > Steve Switzer > > --- > Get world-class business I.T. services and a phone system with awesome features that won't challenge your budget! > http://www.sbsROC.com > > > ________________________________________________________ > To unsubscribe from this list, go to:https://lists.sourceforge.net/lists/listinfo/misterhouse-users > ________________________________________________________ To unsubscribe from this list, go to: https://lists.sourceforge.net/lists/listinfo/misterhouse-users