Giter Club home page Giter Club logo

Comments (18)

itchannel avatar itchannel commented on June 15, 2024

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.

brettonw avatar brettonw commented on June 15, 2024

status.json.txt

Not strict JSON, but should do. It is a control value as well.

from apex-ha.

itchannel avatar itchannel commented on June 15, 2024

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.

brettonw avatar brettonw commented on June 15, 2024

from apex-ha.

brettonw avatar brettonw commented on June 15, 2024

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.

itchannel avatar itchannel commented on June 15, 2024

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.

brettonw avatar brettonw commented on June 15, 2024

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.

itchannel avatar itchannel commented on June 15, 2024

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.

brettonw avatar brettonw commented on June 15, 2024

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.

brettonw avatar brettonw commented on June 15, 2024

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:
Screen Shot 2022-08-24 at 11 01 17 PM

from apex-ha.

brettonw avatar brettonw commented on June 15, 2024

but switching back to advanced mode, just like a variable:

Screen Shot 2022-08-24 at 11 03 11 PM

from apex-ha.

brettonw avatar brettonw commented on June 15, 2024

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.

brettonw avatar brettonw commented on June 15, 2024

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.

brettonw avatar brettonw commented on June 15, 2024

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.

brettonw avatar brettonw commented on June 15, 2024

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.

itchannel avatar itchannel commented on June 15, 2024

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.

itchannel avatar itchannel commented on June 15, 2024

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.

brettonw avatar brettonw commented on June 15, 2024

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)

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.