Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • in reply to: How To: Push notifications for OpenSprinkler #39119

    nystrom
    Participant

    Thanks for adding the code in. You code was just what I was looking for.

    Here are a couple of additions I thought about adding, but didn’t want my code to deviate too much. Maybe add this to the wish list:

    1 – Allow the station number to be appended into the IFTTT event name (like is done with the event message.) i.e.’EventName{}’ –> ‘EventName1’, ‘EventName2’, … This would allow different IFTTT actions for different stations. I already tested it, and it does work. Just not sure best way to integrate with existing code.

    2 – Retrieve the station names and use them in the event message. Retrieving the names was straight forward, but passing them to the push code was more code deviation. Would be nice to have different replace symbols in the event message to allow different information to be inserted, maybe using regular expression matching and replacement. ( {0} is replaced by station number, {1} is replaced by station name, …) I wrote something, but it is a bit of a hack, as I don’t have much Python experience.

    3 – Turn notifications on for only some stations, some actions. My stations are grouped, so that the same stations always run in sequence. I only care when station 1 starts and station 3 ends, and when station 4 starts and station 6 ends. Maybe some kind of data structure in the config that would allow customizing this on a station by station basis. Config data per station would include ‘Push when turns on’ (y/n), ‘Push when turns off’ (y/n), ‘Station name’, ‘IFTTT “value1” format’, ‘IFTTT event name’, …

    Just some thoughts for adding to the common code.

    Thanks again

    in reply to: How To: Push notifications for OpenSprinkler #39096

    nystrom
    Participant

    I was able to modify the code so that I can use IFTTT Maker channel for notifications. Also, I have it working on OSBo.

    Here is what I added to ospi_push_notifications.py:

    
    # Setup variables from config file
    ....
    iftttEventName = config["push"]["ifttt"]["eventName"]
    iftttUserKey = config["push"]["ifttt"]["userKey"]
    ....
    # Send Push Notification
    ....
            elif (pushService == "ifttt"):
                    url = "https://maker.ifttt.com/trigger/" + iftttEventName + "/with/key/" + iftttUserKey
                    payload = {'value1': event }
                    #print url
                    #print payload
                    ret = requests.post(url, data = payload)
                    syslog.syslog("Notification sent to %s. Message: %s. Return message %s" % (pushService,event,ret))
                    #print ret
    
    .....
    
    

    And I added this to the config.yaml file:

    
    push:
      service: "ifttt" # Acceptable options are "instapush" or "pushover" or "ifttt"
    ......
      ifttt:
        eventName: "YOUR_IFTTT_EVENT_NAME"
        userKey: "YOUR_IFTTT_USER_KEY"
    
    in reply to: Unified Firmware and BBB IO #38721

    nystrom
    Participant

    After reading in the OSPi forum, I think I will try writing some separate code and interface to the OS firmware through the API with web calls to the localhost.

    Does this sound correct, or is there a better way to integrate other functionality of the BBB with the OS firmware?


    nystrom
    Participant

    I did a little testing, but I’m having a problem getting ospi stopped. (I’ve have my OSBo for about a month.)

    I get to these commands:

    sudo /etc/init.d/ospi stop<br style=”color: #000000; font-family: ‘Courier 10 Pitch’, Courier, monospace; font-size: 14px; line-height: 19px; white-space: pre-wrap; background-color: #fbfbfb;” /> sudo update-rc.d ospi remove

    and I get this error:

    update-rc.d: /etc/inti.d/ospi exists during rc.d purge (use -f to force)

    Am I missing something. I’d like to switch over to the new firmware to take advantage of the sunrise/sunset feature, but I can seem to stop ospi from restarting.

    in reply to: Initial Assembly #35537

    nystrom
    Participant

    I don’t plan to use capes. I’ll probably just run some wires or ribbon cable out of the OSB0 enclosure to a second¬†enclosure.

    Mike

Viewing 5 posts - 1 through 5 (of 5 total)