Limiting the commands for a device?

9 views
Skip to first unread message

Richard F

unread,
Dec 5, 2016, 1:22:00 AM12/5/16
to pytomation
I have been using pytomation now for a few weeks to control insteon devices, and it works great!  I just set up my first schedules and figured out how to use a generic device as a button to toggle several devices together today, and it works great.

Is there a way to restrict the actions that are controllable for a device?  So for something like the b_bedtime below, I would rather have the ability to only turn it on and get rid of all of the extraneous buttons in the Phone/Web UI:

# Define button for bedtime light presets
b_bedtime
= Generic(name='Bed Time')

# Lights
l_entry
= Light(address='EF.CD.AB',
                devices
=(insteon,b_bedtime),
                name
="Entry Light",
                mapped
={
                       
Attribute.COMMAND: (Command.ON),
                       
Attribute.MAPPED:  (Command.LEVEL, 1),
                       
Attribute.SOURCE:  b_bedtime,
                       
}
               
)

l_bath
= Light(address='AB.CD.EF',
               devices
=(insteon,b_bedtime),
               name
="Bathroom Light",
               mapped
={
                       
Attribute.COMMAND: (Command.ON),
                       
Attribute.MAPPED:  (Command.LEVEL, 1),
                       
Attribute.SOURCE:  b_bedtime,
                     
}
             
)


George Farris

unread,
Dec 5, 2016, 1:53:35 PM12/5/16
to pytom...@googlegroups.com
Unfortunately at this point I think you would have to modify the web UI. David wrote the Web stuff, he might have a better answer for you. I haven't worked on Pytomation for a while but I generally have much more time around Christmas and have been thinking of getting back in and doing a bit of tinkering. I want to add ESP8266 support.

Cheers
George
--
You received this message because you are subscribed to the Google Groups "pytomation" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pytomation+...@googlegroups.com.
To post to this group, send email to pytom...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jason Sharpee

unread,
Dec 5, 2016, 1:56:19 PM12/5/16
to pytom...@googlegroups.com
I believe you might be able to monkey patch the devices states array. 

If you are talking about the web UI I created with the simple list of devices and buttons

To unsubscribe from this group and stop receiving emails from it, send an email to pytomation+unsubscribe@googlegroups.com.

To post to this group, send email to pytom...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "pytomation" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pytomation+unsubscribe@googlegroups.com.

Richard F

unread,
Dec 6, 2016, 2:55:40 AM12/6/16
to pytomation, far...@shaw.ca
Hi George, 

I just poked around a bit and after a bit of trial and error created a new device type that does not have those STATEs or COMMANDs which worked nicely. Before that I tried overloading the objects like:
b_bedtime = Generic(name='Bed Time', STATES=[State.ON, State.OFF])

But that did not work...  I don't know much about python, especially object oriented python :).

What are you going to do with the Arduino?  I'm thinking about a few sensors (like a vibration one to monitor my washing machine and dryer).  I also just plugged a small 1wire bus into the same computer for playing with.

Richard

George Farris

unread,
Dec 6, 2016, 8:30:31 PM12/6/16
to pytom...@googlegroups.com
Hi Richard,

Maybe you can call this device something different and we can add it to the GIT repo. Send me the changes and I look.

The ESP8266 addition is for exactly what you want to do. Single device addressed by IP address and using one or more I/O points I expect. I haven't really thought about it to much yet.

I think we can take the sparkio interface and start there, not sure haven't looked yet. Maybe Jason has an idea, I think he wrote that module.

Cheers
George

Richard F

unread,
Dec 7, 2016, 9:29:11 PM12/7/16
to pytomation, far...@shaw.ca
Hi George,

Yes, I will do it this weekend.  I have made two additional types, one for on/off buttons and one for insteon appliance modules.

Richard

David

unread,
Nov 21, 2017, 9:18:21 PM11/21/17
to pytomation
I know this is old, but now that I see this (sorry, been busy) I figured I'd mention that I added the ability to limit commands on a device a long time ago. See my dopeyrealm.py instance, available in the contrib folder:

d_front_door = Door(address='2AF9B7',
                     devices=(insteon),
                     name="Front Door Sensor",
                     commands=[Command.OPEN, Command.CLOSE])
Reply all
Reply to author
Forward
0 new messages