Re: [mh] Support for TP-Link Kasa Smart devices
Jeff Siddall via misterhouse-users <[email protected]>
| Newsgroups | gmane.comp.misc.misterhouse.user |
|---|---|
| Message-ID | <[email protected]> |
Thanks! Yes, this could be genericized. However, there seems to a historical preference to keep items modular/self contained, perhaps with an exception being Generic_Item. I think the logic is that it makes them more maintainable down the road, and removes dependencies. In the case of Kasa devices, while they *are* HTTP devices, from MH's perspective they are more like processes, so I was reluctant to make them the same kinds of "things". Also, if things get too genericized then I think people get confused about what the generic things are doing. Kinda detaches reality. Anyway, I am open to making changes down the road. Jeff On 2020-12-17 6:58 a.m., Giles Godart-Brown wrote: > > Nice work Jeff > > I was wondering if we could genericise this a little and make it > easier to add more HTML devices. > > How about we make the device type HTML_ON_OFF_DEVICE instead of KASA > and make the type drive how to turn devices on/off. > > We may also want to shift the groups parameter around to accommodate > more parameters for other devices in the future > > For example items.mht would look like this > > # HTML_ON_OFF_DEVICE, ip_address, name, grouplist, type, child_id > HTML_ON_OFF_DEVICE, 192.168.x.y, Living_Room_KP_0, > Living_Room, kasa_ strip, 0 > HTML_ON_OFF_DEVICE, 192.168.x.z, Kitchen_KP_0, > Kitchen, tasmota_ relay > > Then could we be clever in the .pm file and call a routine based on type? > > At the moment I have a little config file e.g. > > # Device_type,on_command,Off_command > tasmota_relay, cm?cmnd=Power On, cm?cmnd=Power Off > > Since I only have Tasmota devices I've never been able to check if > this is sufficiently flexible for others, if not then we may need a > bunch of subroutines, one for each device type. I was wondering if we > could do something like; > > # Device_type,ON_command,OFF_command > tasmota_switch, GET|cm?cmnd=Power On, GET|cm?cmnd=Power Off > kasa_strip,SYSTEM|/usr/local/bin/kasa...on..., > SYSTEM|/usr/local/bin/kasa...off..., > > However as I wrote it I realised this is a big security hole, so the > bunch of subroutines is probably a better route. > > Thoughts? > > Giles > > > On 16/12/2020 21:21, Jeff Siddall via misterhouse-users wrote: >> Update: This is now in a pull request. You can have a look here if >> you want to test it out now: >> >> https://github.com/hollie/misterhouse/pull/802/commits/aa2fd64d24bfdb22e25f50020d72bba0cfa8ebd6 >> >> >> >> >> ________________________________________________________ >> 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