Giter VIP home page Giter VIP logo

Comments (3)

elucas2uy avatar elucas2uy commented on August 20, 2024

Also some other changes are needed on switch.py to work after a restart....
On init we need to restore the correct values form "datastore" to self.

for example, the most basic to restore is the dxpin, for example adding a line after line 74
....
datastore = self._plugins.readstore(self.devicename)
self.dxpin = datastore['dxpin']
.....

this make the switch to work fine after restart , but maybe some other values are needed too....

from upyeasy.

elucas2uy avatar elucas2uy commented on August 20, 2024

Also something strange is happening with the delay. uPyEasy is not using the selected delay to check for the switch state.
It start ok, but after the first event it start "checking" the switch every second.....

Just one short example:


./micropython -m upyeasy
loaded sink log
loaded sink console
loaded sink syslog
2018-02-07T04:42:31.002 [debug] uPyEasy: Init: Init constructor
2018-02-07T04:42:31.002 [debug] uPyEasy: Init: Entering init
2018-02-07 04:42:31 [debug] uPyEasy: Init: Create directory config
2018-02-07 04:42:31 [debug] uPyEasy: Init: Create directory config exception: OSError(17,)
2018-02-07 04:42:31 [debug] uPyEasy: Init: Create directory plugins
2018-02-07 04:42:31 [debug] uPyEasy: Init: Create directory plugins exception: OSError(17,)
2018-02-07 04:42:31 [debug] uPyEasy: Init: Create directory protocols
2018-02-07 04:42:31 [debug] uPyEasy: Init: Create directory protocols exception: OSError(17,)
2018-02-07 04:42:31 [debug] uPyEasy: Init: Create directory scripts
2018-02-07 04:42:31 [debug] uPyEasy: Init: Create directory scripts exception: OSError(17,)
2018-02-07 04:42:31 [debug] uPyEasy: Init: Create directory rules
2018-02-07 04:42:31 [debug] uPyEasy: Init: Create directory rules exception: OSError(17,)
2018-02-07 04:42:31 [debug] uPyEasy: Init: config Table
2018-02-07 04:42:31 [debug] uPyEasy: Init: network Table
2018-02-07 04:42:31 [debug] uPyEasy: Init: protocol Table
2018-02-07 04:42:31 [debug] uPyEasy: Init: controller Table
2018-02-07 04:42:31 [debug] uPyEasy: Init: hardware Table
2018-02-07 04:42:31 [debug] uPyEasy: Init: dxpin Table
2018-02-07 04:42:31 [debug] uPyEasy: Init: dxmap Table
2018-02-07 04:42:31 [debug] uPyEasy: Init: plugin Table
2018-02-07 04:42:31 [debug] uPyEasy: Init: pluginstore Table
2018-02-07 04:42:31 [debug] uPyEasy: Init: device Table
2018-02-07 04:42:31 [debug] uPyEasy: Init: service Table
2018-02-07 04:42:31 [debug] uPyEasy: Init: notification Table
2018-02-07 04:42:31 [debug] uPyEasy: Init: advanced Table
2018-02-07 04:42:31 [debug] uPyEasy: Init: script Table
2018-02-07 04:42:31 [debug] uPyEasy: Init: rule Table
2018-02-07 04:42:31 [debug] uPyEasy: Hal: Init
2018-02-07 04:42:31 [debug] uPyEasy: Hal: init, network record present
2018-02-07 04:42:31 [debug] uPyEasy: Hal: linux
2018-02-07 04:42:31 [debug] uPyEasy: Protocols: Load
2018-02-07 04:42:31 [debug] uPyEasy: Protocols: Init protocol records
2018-02-07 04:42:31 [debug] uPyEasy: Protocols: Load protocol domoticz_mqtt
2018-02-07 04:42:31 [debug] uPyEasy: Protocols: Create protocol Record: domoticz_mqtt
2018-02-07 04:42:31 [debug] uPyEasy: Protocols: Load protocol domoticz_http
2018-02-07 04:42:31 [debug] uPyEasy: Protocols: Create protocol Record: domoticz_http
2018-02-07 04:42:31 [debug] uPyEasy: Protocols: Init protocol records, run async loop
2018-02-07 04:42:31 [debug] uPyEasy: Protocols: Init controller 192.168.1.29-Domoticz MQTT-1
2018-02-07 04:42:31 [debug] uPyEasy: Protocol: domoticz mqtt contruction
2018-02-07 04:42:31 [debug] uPyEasy: Utils: uPyEasy Name
2018-02-07 04:42:31 [debug] uPyEasy: Protocol Domoticz MQTT: Init
2018-02-07 04:42:31 [debug] uPyEasy: Plugins: Load
2018-02-07 04:42:31 [debug] uPyEasy: Plugins: init plugin records
2018-02-07 04:42:31 [debug] uPyEasy: Plugins: Register frozen plugin switch
2018-02-07 04:42:31 [debug] uPyEasy: Plugin: switch contruction
2018-02-07 04:42:31 [debug] uPyEasy: Plugins: Create frozen plugin Record: switch
2018-02-07 04:42:31 [debug] uPyEasy: Plugins: Register frozen plugin bme280
2018-02-07 04:42:31 [debug] uPyEasy: Plugins: Create frozen plugin Record: bme280
2018-02-07 04:42:31 [debug] uPyEasy: Plugins: Register frozen plugin test
2018-02-07 04:42:31 [debug] uPyEasy: Plugins: Create frozen plugin Record: test
2018-02-07 04:42:31 [debug] uPyEasy: Plugins: Register frozen plugin ds18
2018-02-07 04:42:31 [debug] uPyEasy: Plugin: ds18 contruction
2018-02-07 04:42:31 [debug] uPyEasy: Plugins: Create frozen plugin Record: ds18
2018-02-07 04:42:31 [debug] uPyEasy: Plugins: Init plugin records, run async loop
2018-02-07 04:42:31 [debug] uPyEasy: Plugins: Init device: SW1 with plugin: 1
2018-02-07 04:42:31 [debug] uPyEasy: Protocols: GetQueue controller 192.168.1.29-Domoticz MQTT-1
2018-02-07 04:42:31 [debug] uPyEasy: Plugin: switch contruction
2018-02-07 04:42:31 [debug] uPyEasy: Plugin: switch contruction
2018-02-07 04:42:31 [debug] uPyEasy: Plugins: Init device: SW1 ,instantiate plugin: Switch
2018-02-07 04:42:31 [debug] uPyEasy: Utils: uPyEasy Name
2018-02-07 04:42:31 [debug] uPyEasy: Plugin: switch init
2018-02-07 04:42:31 [debug] uPyEasy: Plugins: Read device store: SW1
2018-02-07 04:42:32 [debug] uPyEasy: Plugin: switch init normal, pin: d16
2018-02-07 04:42:32 [debug] uPyEasy: Hal: pin = d16
2018-02-07 04:42:32 [debug] uPyEasy: Hal: pin linux: 16
2018-02-07 04:42:32 [debug] uPyEasy: Scripts: Load
2018-02-07 04:42:32 [debug] uPyEasy: Scripts: Init
2018-02-07 04:42:32 [debug] uPyEasy: Plugins: GetQueue
2018-02-07 04:42:32 [debug] uPyEasy: Scripts: init scripts records
2018-02-07 04:42:32 [debug] uPyEasy: Scripts: init rules records
2018-02-07 04:42:32 [debug] uPyEasy: Scripts: Init script/rule records, run async loop
2018-02-07 04:42:32 [debug] uPyEasy: Utils: Sys hostname
2018-02-07 04:42:32 [debug] uPyEasy: Utils: uPyEasy Name
Set syslog hostname 0.0.0.0
reloaded sink syslog
2018-02-07 04:42:32 [debug] uPyEasy-uPyEasy: Hal: Entering SetTime
2018-02-07 04:42:32 [debug] uPyEasy-uPyEasy: Main: Pre-loading home page
2018-02-07 04:42:32 [debug] uPyEasy-uPyEasy: Hal: get_ip_address linux, ip: 192.168.1.28
2018-02-07 04:42:32 [debug] uPyEasy-uPyEasy: Main: uPyEasy Main Async Loop
2018-02-07 04:42:32 [debug] uPyEasy-uPyEasy: Scripts: Async processing scripts/rules
2018-02-07 04:42:32 [debug] uPyEasy-uPyEasy: Protocols: Async processing protocols
2018-02-07 04:42:32 [debug] uPyEasy-uPyEasy: Plugins: Async processing plugins
2018-02-07 04:42:32 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: Switch
2018-02-07 04:42:32 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: 1, Delay: 5
2018-02-07 04:42:37 [debug] uPyEasy-uPyEasy: Plugin: switch process
2018-02-07 04:42:38 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: Switch
2018-02-07 04:42:38 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: 1, Delay: 5
2018-02-07 04:42:43 [debug] uPyEasy-uPyEasy: Plugin: switch process
2018-02-07 04:42:43 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: Switch
2018-02-07 04:42:43 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: 1, Delay: 5
2018-02-07 04:42:47 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: Switch
2018-02-07 04:42:47 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: 1, Delay: 5
2018-02-07 04:42:48 [debug] uPyEasy-uPyEasy: Plugin: switch process
2018-02-07 04:42:48 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: Switch
2018-02-07 04:42:48 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: 1, Delay: 5
2018-02-07 04:42:48 [debug] uPyEasy-uPyEasy: Protocol Domoticz MQTT Processing...
2018-02-07 04:42:48 [debug] uPyEasy-uPyEasy: Protocol Domoticz MQTT: send SENSOR_TYPE_SWITCH
2018-02-07 04:42:48 [debug] uPyEasy-uPyEasy: Protocol Domoticz MQTT: connect
2018-02-07 04:42:49 [debug] uPyEasy-uPyEasy: Protocol Domoticz MQTT: SENSOR_TYPE_SWITCH
2018-02-07 04:42:49 [debug] uPyEasy-uPyEasy: Protocol Domoticz MQTT: QueueOUT: domoticz/in Message: {"idx": 33, "switchcmd": "On", "command": "switchlight"}
2018-02-07 04:42:50 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: Switch
2018-02-07 04:42:50 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: 1, Delay: 5
2018-02-07 04:42:52 [debug] uPyEasy-uPyEasy: Plugin: switch process
2018-02-07 04:42:52 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: Switch
2018-02-07 04:42:52 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: 1, Delay: 5
2018-02-07 04:42:53 [debug] uPyEasy-uPyEasy: Plugin: switch process
2018-02-07 04:42:53 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: Switch
2018-02-07 04:42:53 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: 1, Delay: 5
2018-02-07 04:42:53 [debug] uPyEasy-uPyEasy: Protocol Domoticz MQTT Processing...
2018-02-07 04:42:53 [debug] uPyEasy-uPyEasy: Protocol Domoticz MQTT: send SENSOR_TYPE_SWITCH
2018-02-07 04:42:53 [debug] uPyEasy-uPyEasy: Protocol Domoticz MQTT: connect
2018-02-07 04:42:53 [debug] uPyEasy-uPyEasy: Protocol Domoticz MQTT: SENSOR_TYPE_SWITCH
2018-02-07 04:42:53 [debug] uPyEasy-uPyEasy: Protocol Domoticz MQTT: QueueOUT: domoticz/in Message: {"idx": 33, "switchcmd": "Off", "command": "switchlight"}
2018-02-07 04:42:55 [debug] uPyEasy-uPyEasy: Plugin: switch process
2018-02-07 04:42:55 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: Switch
2018-02-07 04:42:55 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: 1, Delay: 5
2018-02-07 04:42:57 [debug] uPyEasy-uPyEasy: Plugin: switch process
2018-02-07 04:42:57 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: Switch
2018-02-07 04:42:57 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: 1, Delay: 5
2018-02-07 04:42:58 [debug] uPyEasy-uPyEasy: Plugin: switch process
2018-02-07 04:42:58 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: Switch
2018-02-07 04:42:58 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: 1, Delay: 5
2018-02-07 04:43:00 [debug] uPyEasy-uPyEasy: Plugin: switch process
2018-02-07 04:43:00 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: Switch
2018-02-07 04:43:00 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: 1, Delay: 5
2018-02-07 04:43:02 [debug] uPyEasy-uPyEasy: Plugin: switch process
2018-02-07 04:43:02 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: Switch
2018-02-07 04:43:02 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: 1, Delay: 5
2018-02-07 04:43:03 [debug] uPyEasy-uPyEasy: Plugin: switch process
2018-02-07 04:43:03 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: Switch
2018-02-07 04:43:03 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: 1, Delay: 5
2018-02-07 04:43:05 [debug] uPyEasy-uPyEasy: Plugin: switch process
2018-02-07 04:43:05 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: Switch
2018-02-07 04:43:05 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: 1, Delay: 5
2018-02-07 04:43:07 [debug] uPyEasy-uPyEasy: Plugin: switch process
2018-02-07 04:43:07 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: Switch
2018-02-07 04:43:07 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: 1, Delay: 5
2018-02-07 04:43:08 [debug] uPyEasy-uPyEasy: Plugin: switch process
2018-02-07 04:43:08 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: Switch
2018-02-07 04:43:08 [debug] uPyEasy-uPyEasy: Plugins: Scheduling Async processing plugin: 1, Delay: 5

Note: the lines "Plugins: Scheduling Async processing plugin: 1, Delay: 5" are there for an extra debugging trying to figure it out whats going wrong....

from upyeasy.

Lisa999 avatar Lisa999 commented on August 20, 2024

Actually, the bug is that it is called at all! It shouldn't call the switch plugin unless the switch is pressed and the lock therefor (lines 180-208) is released...
Bug1: Fixed in v0.2.1
Bug2: create #16 for this
Bug3: fixed in v0.2.1

from upyeasy.

Related Issues (20)

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.