Comments (18)
Could you please provide a copy
Of your status.json from your controller so I can see the information required for adding it.
from apex-ha.
Not strict JSON, but should do. It is a control value as well.
from apex-ha.
Thanks for the output I can see your Sicce pump in the outputs. What exactly can you control on it from HA.
status: [
"TBL",
"75",
"OK",
""
]
I'd need to work out what TBL and the "75" value are. I'm guessing "75" is the pump intensity.
from apex-ha.
from apex-ha.
I changed it to not use the wizard, just a "Set 75". The status changed too (I also changed the pump name).
{ status: [ "AON", "75", "OK", "" ], intensity: 75, name: "Sicce_Return", gid: "", type: "iotaPump|Sicce|Syncra", ID: 19, did: "3_1" }
from apex-ha.
Thanks. Out of interest how did iOTA represent this entity in HA. I'm thinking a sensor showing intensity (Service to change intensity) and a switch with current mode. Other alternative is to use a fan sensor to represent the pump (if doable)
from apex-ha.
I never got IOTA to work. HA removed the "official" integration and I haven't found another. I was really hoping for it to be exposed here. ;) I think it can be exposed exactly like a variable. How are you reverse engineering the REST interface? There must be a way to send the actual program numbers to the interface.
from apex-ha.
I'm not even bothering with a proxy just using network tools in the browser as it's a simple json rest API. I'm going to guess that adding the ability to set variables is as simple as sending the same json as toggling outputs but adding in the percentage variable. If that is the case then it's fairly easy to add.
If you have 5mins could you use dev tools/network in your browser and send me the output of the post request that is sent to the controller when you change the intensity of your pump.
from apex-ha.
Request URL: http://apex.local/rest/config/oconf/3_1
Request Method: PUT
Payload:
{ "name": "Sicce_Return", "icon": "Up/Down Arrows", "ctype": "Advanced", "log": false, "inuse": true, "type": "iotaPump|Sicce|Syncra", "did": "3_1", "gid": "", "gtype": "0", "ID": "19", "prog": "Set 75\n", "extra": { "temperature": true, "gph": { "min": 0, "max": 0 }, "modes": [ { "id": 0, "name": "Constant" }, { "id": 1, "name": "Lagoonal ripple" }, { "id": 2, "name": "Sharp break" }, { "id": 3, "name": "Reef crest" }, { "id": 4, "name": "Slow current" }, { "id": 5, "name": "Fast current" } ] } }
Response:
{"name":"Sicce_Return","icon":"Up/Down Arrows","ctype":"Advanced","log":false,"inuse":true,"type":"iotaPump|Sicce|Syncra","did":"3_1","gid":"","gtype":"0","ID":"19","prog":"Set 75\n","extra":{"temperature":true,"gph":{"min":0,"max":0},"modes":[{"id":0,"name":"Constant"},{"id":1,"name":"Lagoonal ripple"},{"id":2,"name":"Sharp break"},{"id":3,"name":"Reef crest"},{"id":4,"name":"Slow current"},{"id":5,"name":"Fast current"}]},"errorCode":0,"errorMessage":""}
from apex-ha.
The "extra" part doesn't seem to actually be applicable to the settings unless you are trying to send a schedule. The screen in apex fusion is like this:
from apex-ha.
but switching back to advanced mode, just like a variable:
from apex-ha.
Confirmed I can turn the switch on an off like an outlet. Next is testing whether the set variable service works on it too.
Can you expose the sicce pump as a sensor variable the same way any other variable is? I know I can access the intensity attribute, but I'm wondering about whether it should be exposed as an input_number.
from apex-ha.
Using the developer tools, I tried to call set variable on the pump and it does not work ("unknown error" is reported). The log contains:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response
await func(hass, connection, msg)
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 646, in handle_execute_script
await script_obj.async_run(msg.get("variables"), context=context)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1513, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 405, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 449, in _async_step
self._handle_exception(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 472, in _handle_exception
raise exception
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 447, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 680, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/config/custom_components/apex/init.py", line 74, in async_set_variable_service
await hass.async_add_executor_job(set_variable, hass, service_call, coordinator)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/apex/init.py", line 99, in set_variable
did = service.data.get("did").strip()
AttributeError: 'int' object has no attribute 'strip'
Would you like me to enable logging and try again?
This is important because I don't run the pump at 100% (on/off). I run it at 50%-75%.
from apex-ha.
The problem seems to be that the did for this object is "3_1", which is getting converted to an integer somewhere in the read from the setup. Adding quotes around it in the call solved that.
from apex-ha.
The only problem now is that the IOTA pump is not included in the sensors list (excluded by line 22 of sensor.py?). Since I am controlling the pump via an input_number, it's not really material, but it would be nice to be able to verify that the pump is actually set to the value I requested.
from apex-ha.
Using the developer tools, I tried to call set variable on the pump and it does not work ("unknown error" is reported). The log contains:
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response await func(hass, connection, msg) File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 646, in handle_execute_script await script_obj.async_run(msg.get("variables"), context=context) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1513, in async_run await asyncio.shield(run.async_run()) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 405, in async_run await self._async_step(log_exceptions=False) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 449, in _async_step self._handle_exception( File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 472, in _handle_exception raise exception File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 447, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 680, in _async_call_service_step await service_task File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1750, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/config/custom_components/apex/init.py", line 74, in async_set_variable_service await hass.async_add_executor_job(set_variable, hass, service_call, coordinator) File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/apex/init.py", line 99, in set_variable did = service.data.get("did").strip() AttributeError: 'int' object has no attribute 'strip'
Would you like me to enable logging and try again?
This is important because I don't run the pump at 100% (on/off). I run it at 50%-75%.
Interesting little bug, looks like HA auto converts inputs to integers and strings depending on whats input. I'll just cast the input always to a string and that should fix that use case and avoid the quotes
from apex-ha.
The only problem now is that the IOTA pump is not included in the sensors list (excluded by line 22 of sensor.py?). Since I am controlling the pump via an input_number, it's not really material, but it would be nice to be able to verify that the pump is actually set to the value I requested.
I can add it back as a sensor if it would be of use. Also as mentioned I am looking at putting pumps as a proper sensor type like a fan 👍
from apex-ha.
As a test I changed line 22, and I have the sensor value showing up now, so it really is that simple. I'm debating whether to try to set my input number if it changes, but I'm worried about some sort of backlash effect. I'll try it.
from apex-ha.
Related Issues (20)
- Entity naming is terse HOT 2
- remove __pycache__ directory HOT 1
- Rebooting Apex loses HA connection permanently HOT 3
- Consider: support some template controls from Apex HOT 1
- Another measurement type HOT 6
- Strange log error HOT 4
- More of a request... HOT 3
- pH is not technically a unit HOT 2
- Discussion: should Apex switches just be OFF/AUTO? HOT 8
- Discussion: Controlling DOS Pumps HOT 7
- Integration seems to cause the Neptune to lock the local interface HOT 3
- License? HOT 1
- Combining Sensors HOT 3
- Measurements HOT 2
- Total Daily Energy - Feature Request HOT 6
- Missing Temperature Probe Entity HOT 1
- REQ: Feed mode HOT 3
- Firmware versions don't match, update doesn't work. HOT 6
- Failed to authenticate with Apex Controller HOT 1
- Read only mode HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apex-ha.